Author: thomas.diesler(a)jboss.com
Date: 2009-11-19 08:46:19 -0500 (Thu, 19 Nov 2009)
New Revision: 96566
Added:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/ResolverBundle.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolverBundleImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion100/
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/META-INF/
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/META-INF/MANIFEST.MF
Removed:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolvable.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolvableImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion/
Modified:
projects/jboss-osgi/trunk/reactor/framework/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/NamedElement.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/RequiredBundle.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolver.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ExportPackageImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ImportPackageImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/NamedElementImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/RequiredBundleImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/drools/RuleBasedResolverImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/resolver-rules.drl
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion100/META-INF/MANIFEST.MF
Log:
Prefer wire to exporter with higher package version
Modified:
projects/jboss-osgi/trunk/reactor/framework/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/.settings/org.eclipse.jdt.core.prefs 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/.settings/org.eclipse.jdt.core.prefs 2009-11-19
13:46:19 UTC (rev 96566)
@@ -1,5 +1,12 @@
-#Thu Sep 03 16:27:07 CEST 2009
+#Thu Nov 19 14:05:44 CET 2009
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/AbstractResolver.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -31,32 +31,32 @@
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.plugins.ResolverPlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractPlugin;
-import org.jboss.osgi.framework.resolver.internal.ResolvableImpl;
+import org.jboss.osgi.framework.resolver.internal.ResolverBundleImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
/**
- * An abstract resolver that maintains the {@link Resolvable} bundles.
+ * An abstract resolver that maintains the {@link ResolverBundle} bundles.
*
* @author thomas.diesler(a)jboss.com
* @since 09-Nov-2009
*/
public abstract class AbstractResolver extends AbstractPlugin implements ResolverPlugin
{
- private Map<OSGiBundleState, Resolvable> resolverBundleMap = new
ConcurrentHashMap<OSGiBundleState, Resolvable>();
+ private Map<OSGiBundleState, ResolverBundle> resolverBundleMap = new
ConcurrentHashMap<OSGiBundleState, ResolverBundle>();
public AbstractResolver(OSGiBundleManager bundleManager)
{
super(bundleManager);
}
- public List<Resolvable> getBundles()
+ public List<ResolverBundle> getBundles()
{
- List<Resolvable> values = new
ArrayList<Resolvable>(resolverBundleMap.values());
+ List<ResolverBundle> values = new
ArrayList<ResolverBundle>(resolverBundleMap.values());
return Collections.unmodifiableList(values);
}
- public Resolvable getBundle(Bundle bundle)
+ public ResolverBundle getBundle(Bundle bundle)
{
if (bundle == null)
throw new IllegalArgumentException("Null bundle");
@@ -65,7 +65,7 @@
return resolverBundleMap.get(bundleState);
}
- public Resolvable getBundle(String symbolicName, Version version)
+ public ResolverBundle getBundle(String symbolicName, Version version)
{
if (symbolicName == null)
throw new IllegalArgumentException("Null symbolicName");
@@ -73,8 +73,8 @@
if (version == null)
version = Version.emptyVersion;
- Resolvable retBundle = null;
- for (Resolvable aux : resolverBundleMap.values())
+ ResolverBundle retBundle = null;
+ for (ResolverBundle aux : resolverBundleMap.values())
{
if (aux.getSymbolicName().equals(symbolicName) &&
aux.getVersion().equals(version))
{
@@ -85,15 +85,15 @@
return retBundle;
}
- public Resolvable addBundle(Bundle bundle)
+ public ResolverBundle addBundle(Bundle bundle)
{
OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
- ResolvableImpl resolvable = new ResolvableImpl(bundle);
- resolverBundleMap.put(bundleState, resolvable);
- return resolvable;
+ ResolverBundleImpl resBundle = new ResolverBundleImpl(bundle);
+ resolverBundleMap.put(bundleState, resBundle);
+ return resBundle;
}
- public Resolvable removeBundle(Bundle bundle)
+ public ResolverBundle removeBundle(Bundle bundle)
{
OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
return resolverBundleMap.remove(bundleState);
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/NamedElement.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/NamedElement.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/NamedElement.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -37,7 +37,7 @@
*
* @return the owner
*/
- Resolvable getOwner();
+ ResolverBundle getOwner();
/**
* Get the element name
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/RequiredBundle.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/RequiredBundle.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/RequiredBundle.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -57,10 +57,10 @@
*
* @return the owner
*/
- Resolvable getProvider();
+ ResolverBundle getProvider();
/**
* Set the provider for this bundle requirement
*/
- void setProvider(Resolvable provider);
+ void setProvider(ResolverBundle provider);
}
\ No newline at end of file
Deleted:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolvable.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolvable.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolvable.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.osgi.framework.resolver;
-
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * An abstraction of a resolvable bundle.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Nov-2009
- */
-public interface Resolvable
-{
- /**
- * Get the underlying bundle that this resolvable is associated with.
- *
- * @return the bundle
- */
- Bundle getBundle();
-
- /**
- * Get the bundle's symbolic name.
- *
- * @return the symbolic name
- */
- String getSymbolicName();
-
- /**
- * Get the bundle's version.
- *
- * @return the version
- */
- Version getVersion();
-
- /**
- * Get the bundle's state.
- *
- * @return the state
- */
- int getState();
-
- /**
- * Get the list of exported packages in the declared order.
- * @return The list of exported packages or an empty list if the bundle does not
export any packages.
- */
- List<ExportPackage> getExportPackages();
-
- /**
- * Get an exported package by name.
- *
- * @param packageName the package name
- * @return The exported package or null if the bundle does not export that package.
- */
- ExportPackage getExportPackage(String packageName);
-
- /**
- * Get the list of imported packages in the declared order.
- * @return The list of imported packages or an empty list if the bundle does not
import any packages.
- */
- List<ImportPackage> getImportPackages();
-
- /**
- * Get an imported package by name.
- *
- * @param packageName the package name
- * @return The imported package or null if the bundle does not import that package.
- */
- ImportPackage getImportPackage(String packageName);
-
- /**
- * Get the list of required bundles.
- *
- * @return The list of required bundles or an empty list.
- */
- List<RequiredBundle> getRequiredBundles();
-
- /**
- * Get the required bundle by symbolic name.
- *
- * @param symbolicName the required bundle's symbolic name
- * @return null if there is no required bundle by this name
- */
- RequiredBundle getRequiredBundle(String symbolicName);
-
- /**
- * Return true if this resolvable is a singleton.
- *
- * @return true when this is a singleton
- */
- boolean isSingleton();
-
- /**
- * Return true if this resolvable has been resolved.
- *
- * @return true when it is resolved
- */
- boolean isResolved();
-
- /**
- * Mark this resolvable as resolved.
- */
- void markResolved();
-}
\ No newline at end of file
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolver.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolver.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolver.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -35,43 +35,43 @@
public interface Resolver
{
/**
- * Get the registered resolvable bundles.
- * @return The list of registered resolvable bundles.
+ * Get the registered resBundle bundles.
+ * @return The list of registered resBundle bundles.
*/
- List<Resolvable> getBundles();
+ List<ResolverBundle> getBundles();
/**
- * Get the registered resolvable bundle.
+ * Get the registered resBundle bundle.
*
* @param symbolicName the symbolic name of the bundle
* @param version the version of the bundle
- * @return The registered resolvable bundle.
+ * @return The registered resBundle bundle.
*/
- Resolvable getBundle(String symbolicName, Version version);
+ ResolverBundle getBundle(String symbolicName, Version version);
/**
- * Get the registered resolvable bundle.
+ * Get the registered resBundle bundle.
*
* @param bundle the bundle
- * @return The registered resolvable bundle.
+ * @return The registered resBundle bundle.
*/
- Resolvable getBundle(Bundle bundle);
+ ResolverBundle getBundle(Bundle bundle);
/**
* Add a bundle to the resolver.
*
* @param bundle the bundle
- * @return The resolvable associated with the added bundle.
+ * @return The resBundle associated with the added bundle.
*/
- Resolvable addBundle(Bundle bundle);
+ ResolverBundle addBundle(Bundle bundle);
/**
* Remove a bundle from the resolver.
* @param bundle the bundle
- * @return The resolvable associated with the removed bundle.
+ * @return The resBundle associated with the removed bundle.
*/
- Resolvable removeBundle(Bundle bundle);
+ ResolverBundle removeBundle(Bundle bundle);
/**
* Resolve the given list of bundles.
@@ -79,7 +79,7 @@
* @param bundles the bundles to resolve
* @return The list of resolved bundles in the resolve order or an empty list
*/
- List<Resolvable> resolve(List<Bundle> bundles);
+ List<ResolverBundle> resolve(List<Bundle> bundles);
/**
* Get the exporter for the given import package.
Copied:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/ResolverBundle.java
(from rev 96553,
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/Resolvable.java)
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/ResolverBundle.java
(rev 0)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/ResolverBundle.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.resolver;
+
+import java.util.List;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * An abstraction of a resBundle bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 09-Nov-2009
+ */
+public interface ResolverBundle
+{
+ /**
+ * Get the underlying bundle.
+ *
+ * @return the bundle
+ */
+ Bundle getBundle();
+
+ /**
+ * Get the bundle's id.
+ *
+ * @return the bundle id
+ */
+ long getBundleId();
+
+ /**
+ * Get the bundle's symbolic name.
+ *
+ * @return the symbolic name
+ */
+ String getSymbolicName();
+
+ /**
+ * Get the bundle's version.
+ *
+ * @return the version
+ */
+ Version getVersion();
+
+ /**
+ * Get the bundle's state.
+ *
+ * @return the state
+ */
+ int getState();
+
+ /**
+ * Get the list of exported packages in the declared order.
+ * @return The list of exported packages or an empty list if the bundle does not
export any packages.
+ */
+ List<ExportPackage> getExportPackages();
+
+ /**
+ * Get an exported package by name.
+ *
+ * @param packageName the package name
+ * @return The exported package or null if the bundle does not export that package.
+ */
+ ExportPackage getExportPackage(String packageName);
+
+ /**
+ * Get the list of imported packages in the declared order.
+ * @return The list of imported packages or an empty list if the bundle does not
import any packages.
+ */
+ List<ImportPackage> getImportPackages();
+
+ /**
+ * Get an imported package by name.
+ *
+ * @param packageName the package name
+ * @return The imported package or null if the bundle does not import that package.
+ */
+ ImportPackage getImportPackage(String packageName);
+
+ /**
+ * Get the list of required bundles.
+ *
+ * @return The list of required bundles or an empty list.
+ */
+ List<RequiredBundle> getRequiredBundles();
+
+ /**
+ * Get the required bundle by symbolic name.
+ *
+ * @param symbolicName the required bundle's symbolic name
+ * @return null if there is no required bundle by this name
+ */
+ RequiredBundle getRequiredBundle(String symbolicName);
+
+ /**
+ * Return true if this resBundle is a singleton.
+ *
+ * @return true when this is a singleton
+ */
+ boolean isSingleton();
+
+ /**
+ * Return true if this resBundle has been resolved.
+ *
+ * @return true when it is resolved
+ */
+ boolean isResolved();
+
+ /**
+ * Mark this resBundle as resolved.
+ */
+ void markResolved();
+}
\ No newline at end of file
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ExportPackageImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ExportPackageImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ExportPackageImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -32,7 +32,7 @@
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
import org.jboss.osgi.framework.resolver.ExportPackage;
import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -46,7 +46,7 @@
{
private Set<ImportPackage> importers = new HashSet<ImportPackage>();
- public ExportPackageImpl(Resolvable owner, ParameterizedAttribute attr)
+ public ExportPackageImpl(ResolverBundle owner, ParameterizedAttribute attr)
{
super(owner, attr);
}
@@ -108,7 +108,7 @@
public String toShortString()
{
- ResolvableImpl owner = (ResolvableImpl)getOwner();
+ ResolverBundleImpl owner = (ResolverBundleImpl)getOwner();
return owner.toShortString() + super.toShortString();
}
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ImportPackageImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ImportPackageImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ImportPackageImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -27,7 +27,7 @@
import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
import org.jboss.osgi.framework.resolver.ExportPackage;
import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.osgi.framework.Constants;
/**
@@ -40,7 +40,7 @@
{
private ExportPackage exporter;
- public ImportPackageImpl(Resolvable owner, ParameterizedAttribute attr)
+ public ImportPackageImpl(ResolverBundle owner, ParameterizedAttribute attr)
{
super(owner, attr);
}
@@ -89,7 +89,7 @@
public String toShortString()
{
- ResolvableImpl owner = (ResolvableImpl)getOwner();
+ ResolverBundleImpl owner = (ResolverBundleImpl)getOwner();
return owner.toShortString() + super.toShortString();
}
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/NamedElementImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/NamedElementImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/NamedElementImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -29,7 +29,7 @@
import org.jboss.osgi.framework.metadata.Parameter;
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
import org.jboss.osgi.framework.resolver.NamedElement;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
/**
* A common named element
@@ -39,11 +39,11 @@
*/
abstract class NamedElementImpl implements NamedElement
{
- private Resolvable owner;
+ private ResolverBundle owner;
private OSGiMetaData metaData;
private ParameterizedAttribute paramattr;
- public NamedElementImpl(Resolvable owner, ParameterizedAttribute attr)
+ public NamedElementImpl(ResolverBundle owner, ParameterizedAttribute attr)
{
if (owner == null)
throw new IllegalArgumentException("Null element owner");
@@ -57,7 +57,7 @@
this.metaData = bundleState.getOSGiMetaData();
}
- public Resolvable getOwner()
+ public ResolverBundle getOwner()
{
return owner;
}
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/RequiredBundleImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/RequiredBundleImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/RequiredBundleImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -26,7 +26,7 @@
import org.jboss.osgi.framework.metadata.VersionRange;
import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
import org.jboss.osgi.framework.resolver.RequiredBundle;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.osgi.framework.Constants;
/**
@@ -37,9 +37,9 @@
*/
public class RequiredBundleImpl extends NamedElementImpl implements RequiredBundle
{
- private Resolvable provider;
+ private ResolverBundle provider;
- public RequiredBundleImpl(Resolvable owner, ParameterizedAttribute attr)
+ public RequiredBundleImpl(ResolverBundle owner, ParameterizedAttribute attr)
{
super(owner, attr);
if (getSymbolicName().equals(owner.getSymbolicName()))
@@ -70,12 +70,12 @@
return optional;
}
- public Resolvable getProvider()
+ public ResolverBundle getProvider()
{
return provider;
}
- public void setProvider(Resolvable provider)
+ public void setProvider(ResolverBundle provider)
{
this.provider = provider;
}
Deleted:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolvableImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolvableImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolvableImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -1,175 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.osgi.framework.resolver.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.PackageAttribute;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.resolver.ExportPackage;
-import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.RequiredBundle;
-import org.jboss.osgi.framework.resolver.Resolvable;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * An abstraction of a resolvable bundle.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Nov-2009
- */
-public class ResolvableImpl implements Resolvable
-{
- private OSGiBundleState bundleState;
- private OSGiMetaData metaData;
- private boolean resolved;
-
- private Map<String, ExportPackage> exportedPackages = new
LinkedHashMap<String, ExportPackage>();
- private Map<String, ImportPackage> importedPackages = new
LinkedHashMap<String, ImportPackage>();
- private Map<String, RequiredBundle> requiredBundles = new
LinkedHashMap<String, RequiredBundle>();
-
- public ResolvableImpl(Bundle bundle)
- {
- this.bundleState = OSGiBundleState.assertBundleState(bundle);
- this.metaData = bundleState.getOSGiMetaData();
-
- // Initialize exported packages
- List<PackageAttribute> exportPackages = metaData.getExportPackages();
- if (exportPackages != null)
- {
- for (PackageAttribute attr : exportPackages)
- {
- String packageName = attr.getAttribute();
- exportedPackages.put(packageName, new ExportPackageImpl(this, attr));
- }
- }
-
- // Initialize imported packages
- List<PackageAttribute> importPackages = metaData.getImportPackages();
- if (importPackages != null)
- {
- for (PackageAttribute attr : importPackages)
- {
- String packageName = attr.getAttribute();
- importedPackages.put(packageName, new ImportPackageImpl(this, attr));
- }
- }
-
- // Initialize required bundles
- List<ParameterizedAttribute> requireBundles = metaData.getRequireBundles();
- if (requireBundles != null)
- {
- for (ParameterizedAttribute attr : requireBundles)
- {
- String symbolicName = attr.getAttribute();
- RequiredBundleImpl req = new RequiredBundleImpl(this, attr);
- requiredBundles.put(symbolicName, req);
- }
- }
- }
-
- public Bundle getBundle()
- {
- return bundleState.getBundleInternal();
- }
-
- public String getSymbolicName()
- {
- return bundleState.getSymbolicName();
- }
-
- public Version getVersion()
- {
- return bundleState.getVersion();
- }
-
- public int getState()
- {
- return bundleState.getState();
- }
-
- public ExportPackage getExportPackage(String packageName)
- {
- return exportedPackages.get(packageName);
- }
-
- public List<ExportPackage> getExportPackages()
- {
- List<ExportPackage> values = new
ArrayList<ExportPackage>(exportedPackages.values());
- return Collections.unmodifiableList(values);
- }
-
- public ImportPackage getImportPackage(String packageName)
- {
- return importedPackages.get(packageName);
- }
-
- public List<ImportPackage> getImportPackages()
- {
- List<ImportPackage> values = new
ArrayList<ImportPackage>(importedPackages.values());
- return Collections.unmodifiableList(values);
- }
-
- public List<RequiredBundle> getRequiredBundles()
- {
- List<RequiredBundle> values = new
ArrayList<RequiredBundle>(requiredBundles.values());
- return Collections.unmodifiableList(values);
- }
-
- public RequiredBundle getRequiredBundle(String symbolicName)
- {
- return requiredBundles.get(symbolicName);
- }
-
- public boolean isResolved()
- {
- return resolved;
- }
-
- public void markResolved()
- {
- this.resolved = true;
- }
-
- public boolean isSingleton()
- {
- return metaData.isSingleton();
- }
-
- public String toShortString()
- {
- return getSymbolicName() + "-" + getVersion();
- }
-
- @Override
- public String toString()
- {
- return "Resolvable[" + toShortString() + "]";
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolverBundleImpl.java
(from rev 96553,
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolvableImpl.java)
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolverBundleImpl.java
(rev 0)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/ResolverBundleImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.resolver.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.PackageAttribute;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.resolver.ExportPackage;
+import org.jboss.osgi.framework.resolver.ImportPackage;
+import org.jboss.osgi.framework.resolver.RequiredBundle;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * An abstraction of a resBundle bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 09-Nov-2009
+ */
+public class ResolverBundleImpl implements ResolverBundle
+{
+ private OSGiBundleState bundleState;
+ private OSGiMetaData metaData;
+ private boolean resolved;
+
+ private Map<String, ExportPackage> exportedPackages = new
LinkedHashMap<String, ExportPackage>();
+ private Map<String, ImportPackage> importedPackages = new
LinkedHashMap<String, ImportPackage>();
+ private Map<String, RequiredBundle> requiredBundles = new
LinkedHashMap<String, RequiredBundle>();
+
+ public ResolverBundleImpl(Bundle bundle)
+ {
+ this.bundleState = OSGiBundleState.assertBundleState(bundle);
+ this.metaData = bundleState.getOSGiMetaData();
+
+ // Initialize exported packages
+ List<PackageAttribute> exportPackages = metaData.getExportPackages();
+ if (exportPackages != null)
+ {
+ for (PackageAttribute attr : exportPackages)
+ {
+ String packageName = attr.getAttribute();
+ exportedPackages.put(packageName, new ExportPackageImpl(this, attr));
+ }
+ }
+
+ // Initialize imported packages
+ List<PackageAttribute> importPackages = metaData.getImportPackages();
+ if (importPackages != null)
+ {
+ for (PackageAttribute attr : importPackages)
+ {
+ String packageName = attr.getAttribute();
+ importedPackages.put(packageName, new ImportPackageImpl(this, attr));
+ }
+ }
+
+ // Initialize required bundles
+ List<ParameterizedAttribute> requireBundles = metaData.getRequireBundles();
+ if (requireBundles != null)
+ {
+ for (ParameterizedAttribute attr : requireBundles)
+ {
+ String symbolicName = attr.getAttribute();
+ RequiredBundleImpl req = new RequiredBundleImpl(this, attr);
+ requiredBundles.put(symbolicName, req);
+ }
+ }
+ }
+
+ public Bundle getBundle()
+ {
+ return bundleState.getBundleInternal();
+ }
+
+ public long getBundleId()
+ {
+ return bundleState.getBundleId();
+ }
+
+ public String getSymbolicName()
+ {
+ return bundleState.getSymbolicName();
+ }
+
+ public Version getVersion()
+ {
+ return bundleState.getVersion();
+ }
+
+ public int getState()
+ {
+ return bundleState.getState();
+ }
+
+ public ExportPackage getExportPackage(String packageName)
+ {
+ return exportedPackages.get(packageName);
+ }
+
+ public List<ExportPackage> getExportPackages()
+ {
+ List<ExportPackage> values = new
ArrayList<ExportPackage>(exportedPackages.values());
+ return Collections.unmodifiableList(values);
+ }
+
+ public ImportPackage getImportPackage(String packageName)
+ {
+ return importedPackages.get(packageName);
+ }
+
+ public List<ImportPackage> getImportPackages()
+ {
+ List<ImportPackage> values = new
ArrayList<ImportPackage>(importedPackages.values());
+ return Collections.unmodifiableList(values);
+ }
+
+ public List<RequiredBundle> getRequiredBundles()
+ {
+ List<RequiredBundle> values = new
ArrayList<RequiredBundle>(requiredBundles.values());
+ return Collections.unmodifiableList(values);
+ }
+
+ public RequiredBundle getRequiredBundle(String symbolicName)
+ {
+ return requiredBundles.get(symbolicName);
+ }
+
+ public boolean isResolved()
+ {
+ return resolved;
+ }
+
+ public void markResolved()
+ {
+ this.resolved = true;
+ }
+
+ public boolean isSingleton()
+ {
+ return metaData.isSingleton();
+ }
+
+ public String toShortString()
+ {
+ return getSymbolicName() + "-" + getVersion();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Bundle[" + toShortString() + "]";
+ }
+}
\ No newline at end of file
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/basic/BasicResolverImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -43,7 +43,7 @@
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
import org.jboss.osgi.framework.resolver.AbstractResolver;
import org.jboss.osgi.framework.resolver.ExportPackage;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
@@ -66,9 +66,9 @@
super(bundleManager);
}
- public Resolvable removeBundle(Bundle bundle)
+ public ResolverBundle removeBundle(Bundle bundle)
{
- Resolvable removedBundle = super.removeBundle(bundle);
+ ResolverBundle removedBundle = super.removeBundle(bundle);
OSGiBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
bundleCapabilitiesMap.remove(bundleState);
@@ -84,12 +84,12 @@
return removedBundle;
}
- public List<Resolvable> resolve(List<Bundle> bundles)
+ public List<ResolverBundle> resolve(List<Bundle> bundles)
{
- List<Resolvable> resolvedBundles = new ArrayList<Resolvable>();
+ List<ResolverBundle> resolvedBundles = new
ArrayList<ResolverBundle>();
for (OSGiBundleState aux : resolveBundles(bundles))
{
- Resolvable resBundle = getBundle(aux);
+ ResolverBundle resBundle = getBundle(aux);
if (resBundle == null)
throw new IllegalStateException("Cannot obtain bundle for: " +
aux);
resolvedBundles.add(resBundle);
@@ -182,7 +182,7 @@
return null;
OSGiBundleState exportingBundle = match.getExportingBundle();
- Resolvable resolverBundle = getBundle(exportingBundle);
+ ResolverBundle resolverBundle = getBundle(exportingBundle);
return resolverBundle.getExportPackage(importPackage);
}
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/drools/RuleBasedResolverImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/drools/RuleBasedResolverImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/resolver/internal/drools/RuleBasedResolverImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -39,7 +39,7 @@
import org.jboss.osgi.framework.resolver.AbstractResolver;
import org.jboss.osgi.framework.resolver.ExportPackage;
import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.osgi.framework.Bundle;
/**
@@ -51,7 +51,7 @@
public class RuleBasedResolverImpl extends AbstractResolver
{
private StatefulKnowledgeSession ksession;
- private Map<Resolvable, FactHandle> facts = new ConcurrentHashMap<Resolvable,
FactHandle>();
+ private Map<ResolverBundle, FactHandle> facts = new
ConcurrentHashMap<ResolverBundle, FactHandle>();
public RuleBasedResolverImpl(OSGiBundleManager bundleManager)
{
@@ -68,33 +68,33 @@
}
@Override
- public Resolvable addBundle(Bundle bundle)
+ public ResolverBundle addBundle(Bundle bundle)
{
- Resolvable resolvable = super.addBundle(bundle);
- return resolvable;
+ ResolverBundle resBundle = super.addBundle(bundle);
+ return resBundle;
}
@Override
- public Resolvable removeBundle(Bundle bundle)
+ public ResolverBundle removeBundle(Bundle bundle)
{
- Resolvable resolvable = super.removeBundle(bundle);
- FactHandle factHandle = facts.get(resolvable);
+ ResolverBundle resBundle = super.removeBundle(bundle);
+ FactHandle factHandle = facts.get(resBundle);
if (factHandle != null)
{
- ksession.update(factHandle, resolvable);
+ ksession.update(factHandle, resBundle);
ksession.fireAllRules();
ksession.retract(factHandle);
}
- return resolvable;
+ return resBundle;
}
- public List<Resolvable> resolve(List<Bundle> bundles)
+ public List<ResolverBundle> resolve(List<Bundle> bundles)
{
- // Get the list of unresolved resolvables
- List<Resolvable> unresolved = new ArrayList<Resolvable>();
+ // Get the list of unresolved resBundles
+ List<ResolverBundle> unresolved = new ArrayList<ResolverBundle>();
if (bundles == null)
{
- for (Resolvable aux : getBundles())
+ for (ResolverBundle aux : getBundles())
{
if (aux.isResolved() == false)
unresolved.add(aux);
@@ -104,17 +104,17 @@
{
for (Bundle bundle : bundles)
{
- Resolvable aux = getBundle(bundle);
+ ResolverBundle aux = getBundle(bundle);
if (aux == null)
- throw new IllegalStateException("Cannot obtain resolvable for: "
+ bundle);
+ throw new IllegalStateException("Cannot obtain resBundle for: "
+ bundle);
if (aux.isResolved() == false)
unresolved.add(aux);
}
}
- // Insert the missing resolvables into the knowledge base
- for (Resolvable aux : unresolved)
+ // Insert the missing resBundles into the knowledge base
+ for (ResolverBundle aux : unresolved)
{
FactHandle factHandle = ksession.getFactHandle(aux);
if (factHandle == null)
@@ -128,8 +128,8 @@
ksession.fireAllRules();
// Return teh list of resolved bundles
- List<Resolvable> resolved = new ArrayList<Resolvable>();
- for (Resolvable aux : getBundles())
+ List<ResolverBundle> resolved = new ArrayList<ResolverBundle>();
+ for (ResolverBundle aux : getBundles())
{
if (aux.isResolved())
resolved.add(aux);
@@ -139,11 +139,11 @@
public ExportPackage getExporter(Bundle bundle, String packageName)
{
- Resolvable resolvable = getBundle(bundle);
- if (resolvable == null)
+ ResolverBundle resBundle = getBundle(bundle);
+ if (resBundle == null)
throw new IllegalStateException("Cannot find resovable for: " +
bundle);
- ImportPackage importPackage = resolvable.getImportPackage(packageName);
+ ImportPackage importPackage = resBundle.getImportPackage(packageName);
if (importPackage == null)
throw new IllegalStateException("Cannot find import package: " +
packageName);
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/service/internal/PackageAdminImpl.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -39,7 +39,7 @@
import org.jboss.osgi.framework.plugins.PackageAdminServicePlugin;
import org.jboss.osgi.framework.plugins.ResolverPlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.jboss.osgi.framework.resolver.Resolver;
import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
@@ -187,7 +187,7 @@
// Resolve the bundles through the resolver
Resolver bundleResolver = bundleManager.getPlugin(ResolverPlugin.class);
List<OSGiBundleState> resolvableBundles = new
ArrayList<OSGiBundleState>();
- for (Resolvable aux : bundleResolver.resolve(unresolvedBundles))
+ for (ResolverBundle aux : bundleResolver.resolve(unresolvedBundles))
resolvableBundles.add(OSGiBundleState.assertBundleState(aux.getBundle()));
boolean allResolved = resolvableBundles.containsAll(unresolvedBundles);
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -34,7 +34,7 @@
import org.jboss.osgi.framework.resolver.ExportPackage;
import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.jboss.osgi.framework.resolver.Resolver;
import org.jboss.test.osgi.classloader.support.a.A;
import org.jboss.virtual.VirtualFile;
@@ -71,20 +71,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to the exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertEquals(bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers not null", 1,
exportPackage.getImporters().size());
}
finally
@@ -113,10 +113,10 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired
@@ -148,19 +148,19 @@
try
{
// Only resolve BundleB
- List<Resolvable> resolved = resolver.resolve(Arrays.asList(new Bundle[]
{ bundleB }));
+ List<ResolverBundle> resolved = resolver.resolve(Arrays.asList(new
Bundle[] { bundleB }));
assertEquals("BundleB resolved", 1, resolved.size());
assertEquals(bundleB.getSymbolicName(), resolved.get(0).getSymbolicName());
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ assertTrue("BundleA resolved", resBundleA.isResolved());
}
finally
{
@@ -189,10 +189,10 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to the exporter
@@ -217,29 +217,29 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- //Bundle-SymbolicName: packageexportversion
+ //Bundle-SymbolicName: packageexportversion100
//Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion", A.class);
+ VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion100", A.class);
Bundle bundleB = framework.installBundle(fileB);
try
{
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to the exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertEquals(bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers not null", 1,
exportPackage.getImporters().size());
}
finally
@@ -265,29 +265,29 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- //Bundle-SymbolicName: packageexportversion
+ //Bundle-SymbolicName: packageexportversion100
//Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion", A.class);
+ VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion100", A.class);
Bundle bundleB = framework.installBundle(fileB);
try
{
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertNull("Exporter null", exporter);
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers null", 0,
exportPackage.getImporters().size());
}
finally
@@ -316,10 +316,10 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired to an exporter
@@ -353,20 +353,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to an exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertEquals(bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers not null", 1,
exportPackage.getImporters().size());
}
finally
@@ -404,20 +404,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired to an exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertNull("Exporter null", exporter);
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers null", 0,
exportPackage.getImporters().size());
}
finally
@@ -452,20 +452,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to the exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertEquals(bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers not null", 1,
exportPackage.getImporters().size());
}
finally
@@ -500,20 +500,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertNull("Exporter null", exporter);
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers null", 0,
exportPackage.getImporters().size());
}
finally
@@ -551,20 +551,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNotNull("Exporter not null", importPackage.getExporter());
// Verify that bundleA is wired to an exporter
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertEquals(bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers not null", 1,
exportPackage.getImporters().size());
}
finally
@@ -602,20 +602,20 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
- ImportPackage importPackage =
resolvableA.getImportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
+ ImportPackage importPackage =
resBundleA.getImportPackage(A.class.getPackage().getName());
assertNull("Exporter null", importPackage.getExporter());
// Verify that bundleA is not wired
ExportPackage exporter = resolver.getExporter(bundleA,
A.class.getPackage().getName());
assertNull("Exporter null", exporter);
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
- ExportPackage exportPackage =
resolvableB.getExportPackage(A.class.getPackage().getName());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+ ExportPackage exportPackage =
resBundleB.getExportPackage(A.class.getPackage().getName());
assertEquals("Importers null", 0,
exportPackage.getImporters().size());
}
finally
@@ -650,13 +650,13 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
}
finally
{
@@ -684,9 +684,9 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
}
finally
{
@@ -709,9 +709,9 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
}
finally
{
@@ -740,13 +740,13 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
}
finally
{
@@ -780,13 +780,13 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertFalse("BundleA not resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertFalse("BundleA not resolved", resBundleA.isResolved());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
}
finally
{
@@ -800,7 +800,7 @@
}
@Test
- public void testResolvedExporterPreferred() throws Exception
+ public void testPreferredExporterResolved() throws Exception
{
Resolver resolver = getTestResolver();
assertEquals("No bundles in resolver", 0, resolver.getBundles().size());
@@ -823,9 +823,9 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
Bundle bundleB = framework.installBundle(fileB);
try
@@ -836,13 +836,13 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
- // Verify resolvable for bundleC
- Resolvable resolvableC = resolver.getBundle(bundleC);
- assertTrue("BundleC resolved", resolvableC.isResolved());
+ // Verify resBundle for bundleC
+ ResolverBundle resBundleC = resolver.getBundle(bundleC);
+ assertTrue("BundleC resolved", resBundleC.isResolved());
// Verify that bundleC is wired to bundleA
ExportPackage exporter = resolver.getExporter(bundleC,
A.class.getPackage().getName());
@@ -866,7 +866,7 @@
}
@Test
- public void testResolvedExporterPreferredReverse() throws Exception
+ public void testPreferredExporterResolvedReverse() throws Exception
{
Resolver resolver = getTestResolver();
assertEquals("No bundles in resolver", 0, resolver.getBundles().size());
@@ -889,9 +889,9 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
Bundle bundleA = framework.installBundle(fileA);
try
@@ -902,13 +902,13 @@
// Resolve the installed bundles
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
- // Verify resolvable for bundleC
- Resolvable resolvableC = resolver.getBundle(bundleC);
- assertTrue("BundleC resolved", resolvableC.isResolved());
+ // Verify resBundle for bundleC
+ ResolverBundle resBundleC = resolver.getBundle(bundleC);
+ assertTrue("BundleC resolved", resBundleC.isResolved());
// Verify that bundleC is wired to bundleB
ExportPackage exporter = resolver.getExporter(bundleC,
A.class.getPackage().getName());
@@ -931,7 +931,133 @@
}
}
- @Ignore
+ @Test
+ public void testPreferredExporterHigherVersion() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ assertEquals("No bundles in resolver", 0, resolver.getBundles().size());
+
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileA = assembleBundle("bundleA",
"/bundles/resolver/packageexportversion100", A.class);
+
+ //Bundle-SymbolicName: packageexportversion200
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
+ VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion200", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC",
"/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ // Resolve the installed bundles
+ resolver.resolve(null);
+
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+
+ // Verify resBundle for bundleC
+ ResolverBundle resBundleC = resolver.getBundle(bundleC);
+ assertTrue("BundleC resolved", resBundleC.isResolved());
+
+ // Verify that bundleC is wired to bundleB
+ ExportPackage exporter = resolver.getExporter(bundleC,
A.class.getPackage().getName());
+ assertNotNull("Exporter not null", exporter);
+ assertEquals("Wired to bundleB", bundleB.getSymbolicName(),
exporter.getOwner().getSymbolicName());
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterHigherVersionReverse() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ assertEquals("No bundles in resolver", 0, resolver.getBundles().size());
+
+ //Bundle-SymbolicName: packageexportversion200
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
+ VirtualFile fileA = assembleBundle("bundleA",
"/bundles/resolver/packageexportversion200", A.class);
+
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileB = assembleBundle("bundleB",
"/bundles/resolver/packageexportversion100", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC",
"/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ // Resolve the installed bundles
+ resolver.resolve(null);
+
+ // Verify resBundle for bundleA
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
+
+ // Verify resBundle for bundleB
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
+
+ // Verify resBundle for bundleC
+ ResolverBundle resBundleC = resolver.getBundle(bundleC);
+ assertTrue("BundleC resolved", resBundleC.isResolved());
+
+ // Verify that bundleC is wired to bundleA
+ ExportPackage exporter = resolver.getExporter(bundleC,
A.class.getPackage().getName());
+ assertNotNull("Exporter not null", exporter);
+ assertEquals("Wired to bundleA", bundleA.getSymbolicName(),
exporter.getOwner().getSymbolicName());
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ /*
public void testLogger() throws Exception
{
Resolver resolver = getTestResolver();
@@ -951,13 +1077,13 @@
// Resolve the logging bundle
resolver.resolve(null);
- // Verify resolvable for bundleA
- Resolvable resolvableA = resolver.getBundle(bundleA);
- assertTrue("BundleA resolved", resolvableA.isResolved());
+ // Verify resBundle for bundleA
+ resBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("BundleA resolved", resBundleA.isResolved());
- // Verify resolvable for bundleB
- Resolvable resolvableB = resolver.getBundle(bundleB);
- assertTrue("BundleB resolved", resolvableB.isResolved());
+ // Verify resBundle for bundleB
+ resBundle resBundleB = resolver.getBundle(bundleB);
+ assertTrue("BundleB resolved", resBundleB.isResolved());
}
finally
@@ -970,6 +1096,7 @@
bundleA.uninstall();
}
}
+ */
@Test
public void testAttributeImportPackage() throws Exception
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -34,7 +34,7 @@
import org.jboss.osgi.framework.resolver.ExportPackage;
import org.jboss.osgi.framework.resolver.ImportPackage;
import org.jboss.osgi.framework.resolver.RequiredBundle;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.jboss.osgi.framework.resolver.Resolver;
import org.jboss.test.osgi.classloader.support.a.A;
import org.jboss.virtual.VirtualFile;
@@ -62,7 +62,7 @@
Resolver resolver = getTestResolver();
assertEquals(1, resolver.getBundles().size());
- Resolvable resolvableA = resolver.getBundle(bundleA.getSymbolicName(), null);
+ ResolverBundle resolvableA = resolver.getBundle(bundleA.getSymbolicName(),
null);
assertNotNull("Resolvable not null", resolvableA);
resolvableA = resolver.getBundle(bundleA.getSymbolicName(),
bundleA.getVersion());
@@ -111,7 +111,7 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- Resolvable resolvableA = getTestResolver().getBundle(bundleA);
+ ResolverBundle resolvableA = getTestResolver().getBundle(bundleA);
List<ImportPackage> importPackages = resolvableA.getImportPackages();
assertNotNull("ImportPackages not null", importPackages);
@@ -140,7 +140,7 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- Resolvable resolvableA = getTestResolver().getBundle(bundleA);
+ ResolverBundle resolvableA = getTestResolver().getBundle(bundleA);
assertTrue("Sigleton", resolvableA.isSingleton());
}
finally
@@ -158,7 +158,7 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- Resolvable resolvableA = getTestResolver().getBundle(bundleA);
+ ResolverBundle resolvableA = getTestResolver().getBundle(bundleA);
List<RequiredBundle> requiredBundles = resolvableA.getRequiredBundles();
assertEquals("RequiredBundles not null", 1, requiredBundles.size());
RequiredBundle reqBundle = requiredBundles.get(0);
@@ -181,7 +181,7 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- Resolvable resolvableA = getTestResolver().getBundle(bundleA);
+ ResolverBundle resolvableA = getTestResolver().getBundle(bundleA);
List<RequiredBundle> requiredBundles = resolvableA.getRequiredBundles();
assertEquals("RequiredBundles not null", 1, requiredBundles.size());
RequiredBundle reqBundle = requiredBundles.get(0);
@@ -204,7 +204,7 @@
Bundle bundleA = framework.installBundle(fileA);
try
{
- Resolvable resolvableA = getTestResolver().getBundle(bundleA);
+ ResolverBundle resolvableA = getTestResolver().getBundle(bundleA);
List<RequiredBundle> requiredBundles = resolvableA.getRequiredBundles();
assertEquals("RequiredBundles not null", 1, requiredBundles.size());
RequiredBundle reqBundle = requiredBundles.get(0);
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/java/org/jboss/test/osgi/resolver/ResolverSmokeTest.java 2009-11-19
13:46:19 UTC (rev 96566)
@@ -32,7 +32,7 @@
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.launch.OSGiFramework;
import org.jboss.osgi.framework.plugins.ResolverPlugin;
-import org.jboss.osgi.framework.resolver.Resolvable;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
import org.jboss.osgi.framework.resolver.Resolver;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
@@ -87,10 +87,10 @@
unresolved.add(bundle);
}
- List<Resolvable> installedBundles = resolver.getBundles();
+ List<ResolverBundle> installedBundles = resolver.getBundles();
assertEquals("All bundles installed", bundlePaths.size(),
installedBundles.size());
- List<Resolvable> resolved = resolver.resolve(unresolved);
+ List<ResolverBundle> resolved = resolver.resolve(unresolved);
assertEquals("All bundles resolved", unresolved.size(),
resolved.size());
}
finally
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/resolver-rules.drl
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/resolver-rules.drl 2009-11-19
13:33:05 UTC (rev 96565)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/resolver-rules.drl 2009-11-19
13:46:19 UTC (rev 96566)
@@ -51,12 +51,12 @@
/**************************************************************************************************
* A rule that inserts the ImportPackage facts for newly inserted
-* Resolvable objects.
+* ResolverBundle objects.
*/
-rule "Add ImportPackage for new Resolvable"
-salience 10000
+rule "Add ImportPackage for new ResolverBundle"
+salience 2000
when
- $importer : Resolvable( resolved == false, state == Bundle.INSTALLED )
+ $importer : ResolverBundle( state == Bundle.INSTALLED, resolved == false )
$import : ImportPackage( ) from $importer.importPackages
not ImportPackage( owner == $importer, this == $import )
then
@@ -66,12 +66,12 @@
/**************************************************************************************************
* A rule that inserts the ExportPackage facts for newly inserted
-* Resolvable objects.
+* ResolverBundle objects.
*/
-rule "Add ExportPackage for new Resolvable"
-salience 10000
+rule "Add ExportPackage for new ResolverBundle"
+salience 2000
when
- $exporter : Resolvable( resolved == false, state == Bundle.INSTALLED )
+ $exporter : ResolverBundle( state == Bundle.INSTALLED, resolved == false )
$export : ExportPackage( ) from $exporter.exportPackages
not ExportPackage( owner == $exporter, this == $export )
then
@@ -81,12 +81,12 @@
/**************************************************************************************************
* A rule that inserts the RequiredBundle facts for newly inserted
-* Resolvable objects.
+* ResolverBundle objects.
*/
-rule "Add RequiredBundle for new Resolvable"
-salience 10000
+rule "Add RequiredBundle for new ResolverBundle"
+salience 2000
when
- $importer : Resolvable( resolved == false, state == Bundle.INSTALLED )
+ $importer : ResolverBundle( state == Bundle.INSTALLED, resolved == false )
$reqbundle : RequiredBundle( ) from $importer.requiredBundles
not RequiredBundle( owner == $importer, this == $reqbundle )
then
@@ -94,6 +94,7 @@
insert( $reqbundle );
end
+
/**************************************************************************************************
* A rule that inserts the WireCandidate facts for every combination
* of matching import/export package names.
@@ -116,7 +117,7 @@
* version miss-match.
*/
rule "Retract package version miss-match"
-salience 100
+salience 1000
when
$import : ImportPackage( exporter == null, version != VersionRange.allVersions )
$wc : WireCandidate( importPackage == $import )
@@ -131,7 +132,7 @@
* of the bundle-symbolic-name on the ImportPackage.
*/
rule "Retract bundle symbolic name miss-match"
-salience 100
+salience 1000
when
$import : ImportPackage( exporter == null, bundleSymbolicName != null )
$wc : WireCandidate( importPackage == $import, exportPackage.owner.symbolicName !=
$import.bundleSymbolicName )
@@ -145,7 +146,7 @@
* of the bundle-version on the ImportPackage.
*/
rule "Retract bundle version miss-match"
-salience 100
+salience 1000
when
$import : ImportPackage( exporter == null, bundleVersion != null )
$wc : WireCandidate( importPackage == $import )
@@ -157,21 +158,37 @@
/**************************************************************************************************
* A rule that retracts a WireCandidate if there is another
+* associated with a higher version on the ExportPackage.
+*/
+rule "Retract WireCandidate to lower version"
+salience 1000
+when
+ $expkeep : ExportPackage( )
+ $wckeep : WireCandidate( exportPackage == $expkeep )
+ $resdel : ResolverBundle( resolved == false )
+ $expdel : ExportPackage( this != $expkeep, owner == $resdel )
+ $wcdel : WireCandidate( importPackage == $wckeep.importPackage, exportPackage ==
$expdel )
+ eval ( $expkeep.getVersion().compareTo($expdel.getVersion()) > 0 )
+then
+ log("Retract lower version " + $wcdel);
+ retract ( $wcdel );
+end
+
+/**************************************************************************************************
+* A rule that retracts a WireCandidate if there is another
* associated with an already resolved exporter.
*/
rule "Retract WireCandidate to unresolved exporter"
-salience 100
+salience 200
when
- $importer : Resolvable( resolved == false )
- $import : ImportPackage( owner == $importer, exporter == null )
- $reskeep : Resolvable( resolved == true )
+ $reskeep : ResolverBundle( resolved == true )
$expkeep : ExportPackage( owner == $reskeep )
- $wckeep : WireCandidate( importPackage == $import, exportPackage == $expkeep )
- $resdel : Resolvable( resolved == false )
+ $wckeep : WireCandidate( exportPackage == $expkeep )
+ $resdel : ResolverBundle( resolved == false )
$expdel : ExportPackage( this != $expkeep, owner == $resdel )
- $wcdel : WireCandidate( importPackage == $import, exportPackage == $expdel )
+ $wcdel : WireCandidate( importPackage == $wckeep.importPackage, exportPackage ==
$expdel )
then
- log("Restract unresolved exporter " + $wcdel);
+ log("Retract unresolved exporter " + $wcdel);
retract ( $wcdel );
end
@@ -181,7 +198,7 @@
rule "RequiredBundle match on bundle-symbolic-name only"
salience 100
when
- $provider : Resolvable( )
+ $provider : ResolverBundle( )
$reqbundle : RequiredBundle( symbolicName == $provider.symbolicName, version == null,
provider == null )
then
log("RequiredBundle match " + $reqbundle + " --> " +
$provider);
@@ -195,7 +212,7 @@
rule "RequiredBundle match on bundle-symbolic-name and bundle-version"
salience 100
when
- $provider : Resolvable( )
+ $provider : ResolverBundle( )
$reqbundle : RequiredBundle( symbolicName == $provider.symbolicName, version != null,
provider == null )
eval( inRange( $reqbundle.getVersion(), $provider.getVersion()))
then
@@ -211,9 +228,9 @@
rule "Wire to resolved exporter"
salience 50
when
- $importer : Resolvable( resolved == false )
+ $importer : ResolverBundle( resolved == false )
$import : ImportPackage( owner == $importer, exporter == null )
- $exporter : Resolvable( resolved == true )
+ $exporter : ResolverBundle( resolved == true )
$export : ExportPackage( owner == $exporter )
$wc : WireCandidate( importPackage == $import, exportPackage == $export )
not( WireCandidate( this != $wc, importPackage == $import ) )
@@ -242,16 +259,16 @@
end
/**************************************************************************************************
-* A rule that marks the Resolvable as resolved on the condition that
+* A rule that marks the ResolverBundle as resolved on the condition that
*
-* # All ImportPackage wire to an exporter
+* # There are no ImportPackages
* # All non-optional RequiredBundles have a provider
*/
rule "Resolve required imports"
salience 20
when
- $importer : Resolvable( state != Bundle.UNINSTALLED, resolved == false )
- not( ImportPackage( owner == $importer, exporter == null ))
+ $importer : ResolverBundle( state != Bundle.UNINSTALLED, resolved == false )
+ not( ImportPackage( owner == $importer ))
not( RequiredBundle( owner == $importer, optional == false, provider == null ))
then
log("Resolved " + $importer);
@@ -259,14 +276,14 @@
end
/**************************************************************************************************
-* A rule that marks the Resolvable as resolved on the condition that
+* A rule that marks the ResolverBundle as resolved on the condition that
*
* # All non-optional ImportPackage wire to an exporter
* # All non-optional RequiredBundles have a provider
*/
rule "Resolve optional imports"
when
- $importer : Resolvable( state != Bundle.UNINSTALLED, resolved == false )
+ $importer : ResolverBundle( state != Bundle.UNINSTALLED, resolved == false )
not( ImportPackage( owner == $importer, optional == false, exporter == null ))
not( RequiredBundle( owner == $importer, optional == false, provider == null ))
then
@@ -279,7 +296,7 @@
*/
rule "Retract uninstalled ImportPackage"
when
- $importer : Resolvable( state == Bundle.UNINSTALLED )
+ $importer : ResolverBundle( state == Bundle.UNINSTALLED )
$import : ImportPackage( owner == $importer )
then
log("Uninstall " + $import);
@@ -291,7 +308,7 @@
*/
rule "Retract uninstalled ExportPackage"
when
- $exporter : Resolvable( state == Bundle.UNINSTALLED )
+ $exporter : ResolverBundle( state == Bundle.UNINSTALLED )
$export : ExportPackage( owner == $exporter )
then
log("Uninstall " + $export);
@@ -323,11 +340,11 @@
end
/**************************************************************************************************
-* A rule that retracts RequiredBundles facts for UNINSTALLED Resolvables
+* A rule that retracts RequiredBundles facts for UNINSTALLED ResolverBundles
*/
rule "Retract uninstalled RequiredBundles"
when
- $importer : Resolvable( state == Bundle.UNINSTALLED )
+ $importer : ResolverBundle( state == Bundle.UNINSTALLED )
$reqbundle : RequiredBundle( owner == $importer )
then
log("Uninstall " + $reqbundle);
Copied:
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion100
(from rev 96553,
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion)
Modified:
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion100/META-INF/MANIFEST.MF
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion/META-INF/MANIFEST.MF 2009-11-19
07:09:26 UTC (rev 96553)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion100/META-INF/MANIFEST.MF 2009-11-19
13:46:19 UTC (rev 96566)
@@ -1,3 +1,3 @@
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: packageexportversion
+Bundle-SymbolicName: packageexportversion100
Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
Added:
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/META-INF/MANIFEST.MF
===================================================================
---
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/META-INF/MANIFEST.MF
(rev 0)
+++
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/bundles/resolver/packageexportversion200/META-INF/MANIFEST.MF 2009-11-19
13:46:19 UTC (rev 96566)
@@ -0,0 +1,3 @@
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: packageexportversion200
+Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0