[jboss-osgi-commits] JBoss-OSGI SVN: r99161 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers and 7 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Jan 8 09:33:29 EST 2010
Author: thomas.diesler at jboss.com
Date: 2010-01-08 09:33:26 -0500 (Fri, 08 Jan 2010)
New Revision: 99161
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleCapability.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleRequirement.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
Log:
Fix findEntry for fragment bundle
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -353,7 +353,7 @@
}
// Get the entry without checking permissions and bundle state.
- protected URL getEntryInternal(String path)
+ URL getEntryInternal(String path)
{
return null;
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -21,10 +21,13 @@
*/
package org.jboss.osgi.framework.bundle;
+import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Dictionary;
+import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;
@@ -32,6 +35,7 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
@@ -158,6 +162,60 @@
return super.getHeaders(locale);
}
+ public URL getEntry(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ return getEntryInternal(path);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getEntryPaths(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSEntryPathsEnumeration(root, child);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ protected URL getEntryInternal(String path)
+ {
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+
+ return vfsDeploymentUnit.getResourceLoader().getResource(path);
+ }
+ return null;
+ }
+
public void uninstall() throws BundleException
{
checkAdminPermission(AdminPermission.LIFECYCLE);
@@ -171,4 +229,52 @@
getBundleManager().uninstallBundle(this);
}
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ // [TODO] fragments
+ resolveBundle();
+
+ if (filePattern == null)
+ filePattern = "*";
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Try to resolve the bundle
+ * @return true when resolved
+ */
+ protected boolean resolveBundle()
+ {
+ PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
+ return packageAdmin.resolveBundles(new Bundle[] { this });
+ }
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -842,7 +842,7 @@
/**
* Updates a bundle from an InputStream.
*/
- public void updateBundle(OSGiBundleState bundleState, InputStream in) throws BundleException
+ public void updateBundle(AbstractDeployedBundleState bundleState, InputStream in) throws BundleException
{
// If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting,
// in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
@@ -927,7 +927,7 @@
if (activeBeforeUpdate)
{
if (updatedBundleState.isFragment() == false)
- startBundle((OSGiBundleState)updatedBundleState);
+ startBundle((AbstractDeployedBundleState)updatedBundleState);
}
}
@@ -958,7 +958,7 @@
try
{
if (bundleState.isFragment() == false)
- stopBundle((OSGiBundleState)bundleState);
+ stopBundle((AbstractDeployedBundleState)bundleState);
}
catch (Exception ex)
{
@@ -1027,7 +1027,7 @@
else
{
// Create a new OSGiBundleState
- OSGiBundleState bundleState = new OSGiBundleState(unit);
+ AbstractDeployedBundleState bundleState = new OSGiBundleState(unit);
absBundle = bundleState;
addBundle(bundleState);
}
@@ -1065,7 +1065,7 @@
boolean fireEvent = true;
if (bundleState instanceof OSGiBundleState)
{
- DeploymentUnit unit = ((OSGiBundleState)bundleState).getDeploymentUnit();
+ DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
Deployment dep = unit.getAttachment(Deployment.class);
fireEvent = (dep == null || dep.isBundleUpdate() == false);
}
@@ -1154,7 +1154,7 @@
if (id == 0)
throw new IllegalArgumentException("Cannot get deployment from system bundle");
- OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleById(id);
if (bundleState == null)
return null;
@@ -1247,7 +1247,7 @@
// Fallback to the deployment name
else if (aux instanceof OSGiBundleState)
{
- DeploymentUnit unit = ((OSGiBundleState)aux).getDeploymentUnit();
+ DeploymentUnit unit = ((AbstractDeployedBundleState)aux).getDeploymentUnit();
if (location.equals(unit.getName()))
{
result = aux;
@@ -1370,7 +1370,7 @@
* @see OSGiBundleActivatorDeployer
* @see OSGiBundleState#startInternal()
*/
- public void startBundle(OSGiBundleState bundleState) throws BundleException
+ public void startBundle(AbstractDeployedBundleState bundleState) throws BundleException
{
// If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
if (bundleState.getState() == Bundle.UNINSTALLED)
@@ -1442,7 +1442,7 @@
* @see OSGiBundleActivatorDeployer
* @see OSGiBundleState#stopInternal()
*/
- public void stopBundle(OSGiBundleState bundleState) throws BundleException
+ public void stopBundle(AbstractDeployedBundleState bundleState) throws BundleException
{
// If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
if (bundleState.getState() == Bundle.UNINSTALLED)
@@ -1672,7 +1672,7 @@
* @param bundleState the owning bundle
* @return registered contexts
*/
- Set<ControllerContext> getRegisteredContext(OSGiBundleState bundleState)
+ Set<ControllerContext> getRegisteredContext(AbstractDeployedBundleState bundleState)
{
DeploymentUnit unit = bundleState.getDeploymentUnit();
return registry.getContexts(unit);
@@ -1699,7 +1699,7 @@
*
* @param bundleState the stopping bundle
*/
- void unregisterContexts(OSGiBundleState bundleState)
+ void unregisterContexts(AbstractDeployedBundleState bundleState)
{
DeploymentUnit unit = bundleState.getDeploymentUnit();
Set<ControllerContext> contexts = registry.getContexts(unit);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -36,12 +36,9 @@
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData.FragmentHost;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.virtual.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
@@ -95,7 +92,7 @@
{
String hostName = getSymbolicName();
Version hostVersion = getVersion();
-
+
FragmentHost fragmentHost = fragmentState.getFragmentHost();
if (hostName.equals(fragmentHost.getSymbolicName()) == false)
return false;
@@ -103,7 +100,7 @@
Version version = fragmentHost.getBundleVersion();
if (version != null && hostVersion.equals(version) == false)
return false;
-
+
return true;
}
@@ -121,7 +118,7 @@
log.debug("Attach " + fragmentState + " -> " + this);
attachedFragments.add(fragmentState);
-
+
// attach classloading metadata to the hosts classloading metadata
clMetaData.attachedFragmentMetaData(fragMetaData);
}
@@ -136,103 +133,10 @@
return getBundleManager().getRegisteredContext(this);
}
- public URL getEntry(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- return getEntryInternal(path);
- }
-
- @Override
- protected URL getEntryInternal(String path)
- {
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-
- if (path.startsWith("/"))
- path = path.substring(1);
-
- return vfsDeploymentUnit.getResourceLoader().getResource(path);
- }
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- public Enumeration getEntryPaths(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSEntryPathsEnumeration(root, child);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
- }
-
- }
- return null;
- }
-
- @SuppressWarnings("rawtypes")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- if (path == null)
- throw new IllegalArgumentException("Null path");
-
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- // [TODO] fragments
- resolveBundle();
-
- if (filePattern == null)
- filePattern = "*";
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
- }
-
- }
- return null;
- }
-
public Class<?> loadClass(String name) throws ClassNotFoundException
{
checkInstalled();
checkAdminPermission(AdminPermission.CLASS);
- // [TODO] bundle fragment
if (resolveBundle() == false)
throw new ClassNotFoundException("Cannot load class: " + name);
@@ -241,23 +145,12 @@
return classLoader.loadClass(name);
}
- /**
- * Try to resolve the bundle
- * @return true when resolved
- */
- boolean resolveBundle()
- {
- PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
- return packageAdmin.resolveBundles(new Bundle[] { this });
- }
-
public URL getResource(String name)
{
checkInstalled();
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // [TODO] bundle fragment
if (resolveBundle() == false)
return getDeploymentUnit().getResourceLoader().getResource(name);
@@ -271,7 +164,6 @@
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // [TODO] bundle fragment
if (resolveBundle() == false)
return getDeploymentUnit().getResourceLoader().getResources(name);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiFragmentState.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -54,23 +54,6 @@
return true;
}
- @SuppressWarnings("rawtypes")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- throw new NotImplementedException();
- }
-
- public URL getEntry(String path)
- {
- throw new NotImplementedException();
- }
-
- @SuppressWarnings("rawtypes")
- public Enumeration getEntryPaths(String path)
- {
- throw new NotImplementedException();
- }
-
public URL getResource(String name)
{
// Null if the resource could not be found or if this bundle is a fragment bundle
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -244,7 +244,7 @@
ScopeKey mutableScope;
if (bundleState instanceof OSGiBundleState)
{
- OSGiBundleState obs = (OSGiBundleState)bundleState;
+ AbstractDeployedBundleState obs = (AbstractDeployedBundleState)bundleState;
DeploymentUnit unit = obs.getDeploymentUnit();
scope = unit.getScope();
mutableScope = unit.getMutableScope();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleNativeCodeDeployer.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -40,6 +40,7 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.classloading.OSGiClassLoaderPolicy;
@@ -131,7 +132,7 @@
if ((absBundleState instanceof OSGiBundleState) == false)
return;
- OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)absBundleState;
OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
List<ParameterizedAttribute> nativeCodeParams = osgiMetaData.getBundleNativeCode();
if (nativeCodeParams == null)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -38,6 +38,7 @@
import org.jboss.managed.api.ManagedObject;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.osgi.framework.Bundle;
@@ -148,7 +149,7 @@
// Use PackageAdmin to resolve the bundles
getPackageAdmin().resolveBundles(unresolved);
- for (OSGiBundleState aux : unresolved)
+ for (AbstractDeployedBundleState aux : unresolved)
{
if (aux.getState() != Bundle.RESOLVED)
log.info("Unresolved: " + aux);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -27,6 +27,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.plugins.ResolverPlugin;
@@ -61,7 +62,7 @@
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
return resolverBundleMap.get(bundleState);
}
@@ -95,7 +96,7 @@
public ResolverBundle removeBundle(Bundle bundle)
{
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
return resolverBundleMap.remove(bundleState);
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -36,6 +36,7 @@
import org.jboss.classloading.spi.version.VersionRange;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.classloading.OSGiPackageRequirement;
@@ -80,7 +81,7 @@
{
ResolverBundle removedBundle = super.removeBundle(bundle);
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
bundleCapabilitiesMap.remove(bundleState);
List<BundleRequirement> bundleRequirements = bundleRequirementsMap.remove(bundleState);
@@ -97,7 +98,7 @@
public List<ResolverBundle> resolve(List<Bundle> bundles)
{
List<ResolverBundle> resolvedBundles = new ArrayList<ResolverBundle>();
- for (OSGiBundleState aux : resolveBundles(bundles))
+ for (AbstractDeployedBundleState aux : resolveBundles(bundles))
{
ResolverBundle resBundle = getBundle(aux);
if (resBundle == null)
@@ -164,7 +165,7 @@
log.debug("END *****************************************************************");
// Log the unresolved bundles
- for (OSGiBundleState bundle : unresolvedBundles)
+ for (AbstractDeployedBundleState bundle : unresolvedBundles)
{
StringBuffer message = new StringBuffer("Unresolved bundle: " + bundle);
message.append("\n Cannot find exporter for");
@@ -186,17 +187,17 @@
public ExportPackage getExporter(Bundle bundle, String importPackage)
{
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
BundleCapability match = getMatchingCapability(bundleState, importPackage);
if (match == null)
return null;
- OSGiBundleState exportingBundle = match.getExportingBundle();
+ AbstractDeployedBundleState exportingBundle = match.getExportingBundle();
ResolverBundle resolverBundle = getBundle(exportingBundle);
return resolverBundle.getExportPackage(importPackage);
}
- private BundleCapability getMatchingCapability(OSGiBundleState bundle, String importPackage)
+ private BundleCapability getMatchingCapability(AbstractDeployedBundleState bundle, String importPackage)
{
List<BundleRequirement> requirements = bundleRequirementsMap.get(bundle);
if (requirements == null)
@@ -258,7 +259,7 @@
/**
* Logs information about a resolved bundle
*/
- private void logResolvedBundleInfo(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
+ private void logResolvedBundleInfo(AbstractDeployedBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
{
// Log the package wiring information
StringBuffer message = new StringBuffer("Resolved: " + bundle);
@@ -350,11 +351,11 @@
/**
* Get the set of bundle capabilities
*/
- private List<BundleCapability> getBundleCapabilities(OSGiBundleState bundle)
+ private List<BundleCapability> getBundleCapabilities(AbstractDeployedBundleState bundle)
{
List<BundleCapability> result = new ArrayList<BundleCapability>();
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
DeploymentUnit unit = bundleState.getDeploymentUnit();
ClassLoadingMetaData metadata = unit.getAttachment(ClassLoadingMetaData.class);
@@ -376,11 +377,11 @@
/**
* Get the set of bundle requirements
*/
- private List<BundleRequirement> getBundleRequirements(OSGiBundleState bundle)
+ private List<BundleRequirement> getBundleRequirements(AbstractDeployedBundleState bundle)
{
List<BundleRequirement> result = new ArrayList<BundleRequirement>();
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
DeploymentUnit unit = bundleState.getDeploymentUnit();
ClassLoadingMetaData classloadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
@@ -400,7 +401,7 @@
return result;
}
- private boolean processRequiredBundle(OSGiBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
+ private boolean processRequiredBundle(AbstractDeployedBundleState bundle, List<BundleCapability> bundleCapabilities, List<BundleRequirement> bundleRequirements)
{
// The Require-Bundle header specifies that all exported packages from
// another bundle must be imported, effectively requiring the public interface
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleCapability.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleCapability.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -28,6 +28,7 @@
import org.jboss.classloading.plugins.metadata.PackageCapability;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.classloading.OSGiPackageCapability;
import org.jboss.osgi.framework.classloading.OSGiPackageRequirement;
@@ -40,11 +41,11 @@
*/
class BundleCapability
{
- private OSGiBundleState bundle;
+ private AbstractDeployedBundleState bundle;
private PackageCapability packageCapability;
private List<BundleRequirement> wires;
- BundleCapability(OSGiBundleState bundle, PackageCapability packageCapability)
+ BundleCapability(AbstractDeployedBundleState bundle, PackageCapability packageCapability)
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
@@ -55,14 +56,14 @@
this.packageCapability = packageCapability;
}
- OSGiBundleState getExportingBundle()
+ AbstractDeployedBundleState getExportingBundle()
{
return bundle;
}
Module getExportingModule()
{
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
DeploymentUnit unit = bundleState.getDeploymentUnit();
return unit.getAttachment(Module.class);
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleRequirement.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BundleRequirement.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -22,7 +22,7 @@
package org.jboss.osgi.framework.resolver.internal.basic;
import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
/**
* An association of bundle/requirement.
@@ -32,11 +32,11 @@
*/
class BundleRequirement
{
- private OSGiBundleState bundle;
+ private AbstractDeployedBundleState bundle;
private PackageRequirement packageRequirement;
private BundleCapability wire;
- BundleRequirement(OSGiBundleState bundle, PackageRequirement packageRequirement)
+ BundleRequirement(AbstractDeployedBundleState bundle, PackageRequirement packageRequirement)
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
@@ -52,7 +52,7 @@
return wire;
}
- OSGiBundleState getImportingBundle()
+ AbstractDeployedBundleState getImportingBundle()
{
return bundle;
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -29,8 +29,8 @@
import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
import org.jboss.osgi.deployment.internal.InvocationContextImpl;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
@@ -66,7 +66,7 @@
protected InvocationContext getInvocationContext(Bundle bundle)
{
long bundleId = bundle.getBundleId();
- OSGiBundleState bundleState = (OSGiBundleState)bundleManager.getBundleById(bundleId);
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)bundleManager.getBundleById(bundleId);
if (bundle == null)
throw new IllegalStateException("Cannot obtain bundle for: " + bundle);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -37,6 +37,7 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
@@ -131,7 +132,7 @@
if (abstractBundleState instanceof OSGiBundleState == false)
throw new UnsupportedOperationException("FIXME: getExportedPackages for System bundle");
- OSGiBundleState bundleState = (OSGiBundleState)abstractBundleState;
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)abstractBundleState;
DeploymentUnit unit = bundleState.getDeploymentUnit();
ClassLoadingMetaData metaData = unit.getAttachment(ClassLoadingMetaData.class);
if (metaData == null)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -28,6 +28,7 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.virtual.VirtualFile;
@@ -50,7 +51,7 @@
name = parseName(rootURI);
- OSGiBundleState bundleState = getBundleState(rootURI, manager);
+ AbstractDeployedBundleState bundleState = getBundleState(rootURI, manager);
String path = parsePath(rootURI);
URL resource = bundleState.getEntry(path); // permission check
if (resource == null)
@@ -99,7 +100,7 @@
* @param manager the osgi manager
* @return bundle state or exception if no such bundle exists
*/
- protected OSGiBundleState getBundleState(URI uri, OSGiBundleManager manager)
+ protected AbstractDeployedBundleState getBundleState(URI uri, OSGiBundleManager manager)
{
String host = uri.getHost();
long id = Long.parseLong(host);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/DeployersTest.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -27,6 +27,7 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.osgi.framework.Bundle;
@@ -139,7 +140,7 @@
protected Bundle getBundle(DeploymentUnit unit) throws Exception
{
- OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
assertNotNull(bundle);
return bundle.getBundleInternal();
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -41,6 +41,7 @@
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
@@ -129,7 +130,7 @@
{
if (aux.getBundleId() != 0)
{
- OSGiBundleState bundleState = (OSGiBundleState)aux;
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)aux;
bundleManager.uninstallBundle(bundleState);
}
}
@@ -204,7 +205,7 @@
{
if (bundle.getState() != Bundle.UNINSTALLED)
{
- OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
getBundleManager().uninstallBundle(bundleState);
}
}
@@ -284,7 +285,7 @@
try
{
DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
- OSGiBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
+ AbstractDeployedBundleState bundleState = unit.getAttachment(OSGiBundleState.class);
if (bundleState == null)
throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/service/support/LazyBundle.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -26,6 +26,7 @@
import java.lang.reflect.Proxy;
import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.osgi.framework.Bundle;
@@ -60,7 +61,7 @@
{
if (bundle == null)
{
- OSGiBundleState bundle = unit.getAttachment(OSGiBundleState.class);
+ AbstractDeployedBundleState bundle = unit.getAttachment(OSGiBundleState.class);
if (bundle == null)
throw new IllegalArgumentException("No such OSGiBundleState attachment: " + unit);
this.bundle = bundle.getBundleInternal();
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-08 13:58:04 UTC (rev 99160)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/fragments/FragmentTestCase.java 2010-01-08 14:33:26 UTC (rev 99161)
@@ -55,12 +55,12 @@
OSGiBundle host = runtime.installBundle("fragments-simple-hostA.jar");
assertBundleState(Bundle.INSTALLED, host.getState());
+ host.start();
+ assertBundleState(Bundle.ACTIVE, host.getState());
+
URL resourceURL = host.getResource("resources/resource.txt");
assertNull("Resource URL null", resourceURL);
- host.start();
- assertBundleState(Bundle.ACTIVE, host.getState());
-
host.uninstall();
assertBundleState(Bundle.UNINSTALLED, host.getState());
}
More information about the jboss-osgi-commits
mailing list