no longer copy file:obr.xml files into cache as these are already up to date on the filesystem FELIX-1491
also hide some implementation level methods (was public, now private)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@804893 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java b/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java
index 6a58019..3a9e07d 100644
--- a/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java
+++ b/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
@@ -65,13 +66,32 @@
syncOBRIndex();
OBRHandler handler = new OBRHandler( getObrURL(), getBundleCache(), listener );
SAXParser parser = factory.newSAXParser();
- parser.parse( getObrlCache(), handler );
+ parser.parse( findLocalOBR(), handler );
+ }
+
+
+ private File findLocalOBR()
+ {
+ if ( "file".equals( getObrURL().getProtocol() ) ) {
+ try
+ {
+ return new File( getObrURL().toURI() );
+ }
+ catch ( URISyntaxException e )
+ {
+ // should be impossible ?
+ throw new IllegalStateException( "Failed to convert file url to uri", e );
+ }
+ }
+ else {
+ return getObrlCache();
+ }
}
private void syncOBRIndex()
{
- if ( isUpdated() )
+ if ( !"file".equals( getObrURL().getProtocol() ) && isUpdated() )
{
InputStream in = null;
OutputStream out = null;
@@ -159,27 +179,26 @@
}
- public URL getObrURL()
+ private URL getObrURL()
{
return obrURL;
}
- public File getObrlCache()
+ private File getObrlCache()
{
return obrlCache;
}
- public File getBundleCache()
+ private File getBundleCache()
{
return bundleCache;
}
- public long getUpdatePeriod()
+ private long getUpdatePeriod()
{
return updatePeriod;
}
-
}
diff --git a/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java b/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
index 28ab9fb..0e7a8cf 100644
--- a/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
+++ b/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
@@ -142,7 +142,12 @@
info.setName( attributes.getValue( "", PRESENTATION_NAME ) );
URI l = makeAbsolute( uri );
info.setUpdateLocation( l );
- b.setLocation( cachePath( info ) );
+ if ( "file".equals( l.getScheme() ) ) {
+ b.setLocation( new Path( new File( l ).getAbsolutePath() ) );
+ }
+ else {
+ b.setLocation( cachePath( info ) );
+ }
b.setBundleInfo( info );
bundle = b;
}