You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ds...@apache.org on 2009/08/17 10:00:13 UTC
svn commit: r804893 - in
/felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl:
AbstractOBRBundleRepository.java OBRHandler.java
Author: dsavage
Date: Mon Aug 17 08:00:12 2009
New Revision: 804893
URL: http://svn.apache.org/viewvc?rev=804893&view=rev
Log:
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)
Modified:
felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java
felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
Modified: felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java?rev=804893&r1=804892&r2=804893&view=diff
==============================================================================
--- felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java (original)
+++ felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/AbstractOBRBundleRepository.java Mon Aug 17 08:00:12 2009
@@ -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;
}
-
}
Modified: felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java?rev=804893&r1=804892&r2=804893&view=diff
==============================================================================
--- felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java (original)
+++ felix/trunk/sigil/common/obr/src/org/apache/felix/sigil/obr/impl/OBRHandler.java Mon Aug 17 08:00:12 2009
@@ -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;
}