[Osgi-messages] SF.net SVN: osgi:[268] papoose-core/trunk
Status: Beta
Brought to you by:
maguro
|
From: <osg...@li...> - 2010-04-20 19:31:11
|
Revision: 268
http://osgi.svn.sourceforge.net/osgi/?rev=268&view=rev
Author: maguro
Date: 2010-04-20 19:31:05 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Intermediate checkin
Modified Paths:
--------------
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java
papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java
papoose-core/trunk/core/src/main/java/org/papoose/core/Generation.java
papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java
papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java 2010-04-20 19:30:34 UTC (rev 267)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleController.java 2010-04-20 19:31:05 UTC (rev 268)
@@ -50,6 +50,7 @@
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.framework.Version;
+
import org.papoose.core.spi.ArchiveStore;
import org.papoose.core.spi.BundleStore;
import org.papoose.core.util.AttributeUtils;
@@ -203,7 +204,7 @@
if (getState() == UNINSTALLED) throw new IllegalStateException("This bundle is uninstalled");
Papoose framework = getFramework();
- BundleGeneration bundleGeneration = (BundleGeneration)getCurrentGeneration();
+ BundleGeneration bundleGeneration = (BundleGeneration) getCurrentGeneration();
framework.requestStart(bundleGeneration, options);
}
@@ -218,7 +219,7 @@
if (getState() == UNINSTALLED) throw new IllegalStateException("This bundle is uninstalled");
Papoose framework = getFramework();
- BundleGeneration bundleGeneration = (BundleGeneration)getCurrentGeneration();
+ BundleGeneration bundleGeneration = (BundleGeneration) getCurrentGeneration();
framework.requestStop(bundleGeneration, options);
}
@@ -356,11 +357,11 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration)currentGeneration;
+ bundleGeneration = (BundleGeneration) currentGeneration;
}
else
{
- bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().getResource(name);
@@ -460,16 +461,16 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration)currentGeneration;
+ bundleGeneration = (BundleGeneration) currentGeneration;
}
else if (currentGeneration instanceof FragmentGeneration)
{
- FragmentGeneration fragmentGeneration = (FragmentGeneration)currentGeneration;
+ FragmentGeneration fragmentGeneration = (FragmentGeneration) currentGeneration;
bundleGeneration = fragmentGeneration.getHost();
}
else
{
- bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().loadClass(name);
@@ -527,11 +528,11 @@
if (currentGeneration instanceof BundleGeneration)
{
- bundleGeneration = (BundleGeneration)currentGeneration;
+ bundleGeneration = (BundleGeneration) currentGeneration;
}
else
{
- bundleGeneration = (BundleGeneration)getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
+ bundleGeneration = (BundleGeneration) getFramework().getBundleManager().getBundle(0).getCurrentGeneration();
}
return bundleGeneration.getClassLoader().findResources(name);
@@ -665,7 +666,7 @@
if (currentGeneration instanceof BundleGeneration)
{
- BundleGeneration bundleGeneration = (BundleGeneration)currentGeneration;
+ BundleGeneration bundleGeneration = (BundleGeneration) currentGeneration;
for (FragmentGeneration fragment : bundleGeneration.getFragments())
{
@@ -783,7 +784,7 @@
{
if (syncBundleListeners == null) syncBundleListeners = new CopyOnWriteArraySet<SynchronousBundleListener>();
- syncBundleListeners.add((SynchronousBundleListener)bundleListener);
+ syncBundleListeners.add((SynchronousBundleListener) bundleListener);
}
else
{
@@ -918,7 +919,7 @@
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- ServiceListenerWithFilter that = (ServiceListenerWithFilter)o;
+ ServiceListenerWithFilter that = (ServiceListenerWithFilter) o;
return delegate == that.delegate;
}
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java 2010-04-20 19:30:34 UTC (rev 267)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/BundleManager.java 2010-04-20 19:31:05 UTC (rev 268)
@@ -607,11 +607,14 @@
{
try
{
- long bundleId = bundleCounter.incrementAndGet();
+ while (bundleCounter.get() < bundleStore.getBundleId()) bundleCounter.incrementAndGet();
+ long bundleId = bundleStore.getBundleId();
+
String location = bundleStore.getLocation();
ArchiveStore archiveStore = store.loadArchiveStore(framework, bundleId);
+ // todo: this always seemed kinda a wacky way to do this
archiveStore.assignNativeCodeDescriptions(resolveNativeCodeDependencies(archiveStore.getBundleNativeCodeList()));
confirmRequiredExecutionEnvironment(archiveStore.getBundleRequiredExecutionEnvironment());
@@ -631,6 +634,12 @@
locations.put(location, bundle);
installedbundles.put(bundleId, bundle);
bundles.put(bundleId, bundle);
+
+ bundleStore.markModified();
+
+ generation.setState(Bundle.INSTALLED);
+
+ fireBundleEvent(new BundleEvent(BundleEvent.INSTALLED, bundle));
}
catch (BundleException e)
{
Modified: papoose-core/trunk/core/src/main/java/org/papoose/core/Generation.java
===================================================================
--- papoose-core/trunk/core/src/main/java/org/papoose/core/Generation.java 2010-04-20 19:30:34 UTC (rev 267)
+++ papoose-core/trunk/core/src/main/java/org/papoose/core/Generation.java 2010-04-20 19:31:05 UTC (rev 268)
@@ -21,6 +21,7 @@
import java.util.Enumeration;
import java.util.SortedSet;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
@@ -35,7 +36,7 @@
{
private final BundleController bundleController;
private final ArchiveStore archiveStore;
- private volatile int state;
+ private volatile int state = Bundle.INSTALLED;
private volatile ProtectionDomain protectionDomain;
protected Generation(BundleController bundleController, ArchiveStore archiveStore)
Modified: papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java
===================================================================
--- papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java 2010-04-20 19:30:34 UTC (rev 267)
+++ papoose-core/trunk/store/file-store/src/main/java/org/papoose/store/file/BundleFileStore.java 2010-04-20 19:31:05 UTC (rev 268)
@@ -164,6 +164,12 @@
}
}
+ @Override
+ public String toString()
+ {
+ return "[" + bundleId + ", " + location + ", " + bundleRoot + "]";
+ }
+
private void save() throws IOException
{
Properties properties = new Properties();
Modified: papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java
===================================================================
--- papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java 2010-04-20 19:30:34 UTC (rev 267)
+++ papoose-core/trunk/tck/tests/src/test/java/org/papoose/tck/core/PapooseFrameworkFactoryTest.java 2010-04-20 19:31:05 UTC (rev 268)
@@ -52,8 +52,8 @@
Map<String, String> configuration = new HashMap<String, String>();
configuration.put(Constants.FRAMEWORK_STORAGE, "target/papoose");
- FrameworkFactory factory = new PapooseFrameworkFactory();
- final Framework framework = factory.newFramework(configuration);
+ final FrameworkFactory factory = new PapooseFrameworkFactory();
+ Framework framework = factory.newFramework(configuration);
framework.init();
@@ -77,6 +77,7 @@
framework.stop();
+ framework = factory.newFramework(configuration);
framework.init();
systemBundle = framework.getBundleContext().getBundle(0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|