Skip to Content.
Sympa Menu

notify-dpml - r2039 - in trunk/main/transit/core: etc/config etc/prefs src/main/dpml/transit/local

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: davidoff at BerliOS <davidoff AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r2039 - in trunk/main/transit/core: etc/config etc/prefs src/main/dpml/transit/local
  • Date: Sun, 16 Sep 2007 18:03:13 +0200

Author: davidoff
Date: 2007-09-16 18:03:13 +0200 (Sun, 16 Sep 2007)
New Revision: 2039

Added:
trunk/main/transit/core/etc/config/propertiess/
Removed:
trunk/main/transit/core/etc/prefs/propertiess/
Modified:
trunk/main/transit/core/src/main/dpml/transit/local/LocalURLConnection.java
Log:
Update the local protocol handler to fallback to config resources if they
exist and update the bootstrap and build procedures to refelect the change.

Copied: trunk/main/transit/core/etc/config/propertiess (from rev 2037,
trunk/main/transit/core/etc/prefs/propertiess)

Modified:
trunk/main/transit/core/src/main/dpml/transit/local/LocalURLConnection.java
===================================================================
---
trunk/main/transit/core/src/main/dpml/transit/local/LocalURLConnection.java
2007-09-16 15:28:02 UTC (rev 2038)
+++
trunk/main/transit/core/src/main/dpml/transit/local/LocalURLConnection.java
2007-09-16 16:03:13 UTC (rev 2039)
@@ -96,23 +96,11 @@
try
{
Artifact artifact = Artifact.createArtifact( spec );
- String groupSpec = artifact.getGroup();
- String artifactName = artifact.getName();
- String typeSpec = artifact.getType();
- String versionSpec = artifact.getVersion();
- File prefs = Transit.PREFS;
- File group = new File( prefs, groupSpec );
- File type = new File( group, typeSpec + "s" );
- if( null == versionSpec )
- {
- final String filename = artifactName + "." +
typeSpec;
- m_target = new File( type, filename );
- }
- else
- {
- final String filename = artifactName + "-" +
versionSpec + "." + typeSpec;
- m_target = new File( type, filename );
- }
+ String group = artifact.getGroup();
+ String name = artifact.getName();
+ String type = artifact.getType();
+ String version = artifact.getVersion();
+ m_target = getTargetFile( group, name, version, type
);
}
catch( Throwable e )
{
@@ -130,7 +118,44 @@
{
throw (IOException) e.getException();
}
+ }
+
+ private File getTargetFile( String group, String name, String version,
String type )
+ {
+ File prefs = getTargetFile( Transit.PREFS, group, name, version,
type );
+ if( prefs.exists() )
+ {
+ return prefs;
+ }
+ else
+ {
+ File config = getTargetFile( Transit.CONFIG, group, name,
version, type );
+ if( !config.exists() )
+ {
+ return null;
+ }
+ else
+ {
+ return config;
+ }
+ }
}
+
+ private File getTargetFile( File root, String group, String name, String
version, String type )
+ {
+ File base = new File( root, group );
+ File file = new File( base, type + "s" );
+ if( null == version )
+ {
+ final String filename = name + "." + type;
+ return new File( file, filename );
+ }
+ else
+ {
+ final String filename = name + "-" + version + "." + type;
+ return new File( file, filename );
+ }
+ }

/**
* Return an input stream to the resource.




  • r2039 - in trunk/main/transit/core: etc/config etc/prefs src/main/dpml/transit/local, davidoff at BerliOS, 09/16/2007

Archive powered by MHonArc 2.6.24.

Top of Page