[jboss-osgi-commits] JBoss-OSGI SVN: r93605 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing: internal and 1 other directory.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Wed Sep 16 09:15:22 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-09-16 09:15:21 -0400 (Wed, 16 Sep 2009)
New Revision: 93605
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
Log:
Use org.osgi.framework Version where possible
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-09-16 12:31:48 UTC (rev 93604)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-09-16 13:15:21 UTC (rev 93605)
@@ -28,6 +28,7 @@
import org.jboss.osgi.spi.capability.Capability;
import org.osgi.framework.BundleException;
import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
import org.osgi.service.packageadmin.PackageAdmin;
/**
@@ -72,7 +73,7 @@
* @param version may be null
* @return The bundle or null if there is none
*/
- OSGiBundle getBundle(String symbolicName, String version);
+ OSGiBundle getBundle(String symbolicName, Version version);
/**
* Get the {@link OSGiBundle} for a given bundle id.
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-16 12:31:48 UTC (rev 93604)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-16 13:15:21 UTC (rev 93605)
@@ -41,12 +41,14 @@
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiServiceReference;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.osgi.spi.util.BundleDeployment;
+import org.jboss.osgi.spi.util.BundleDeploymentFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
import org.osgi.framework.launch.Framework;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -65,13 +67,14 @@
public OSGiBundle installBundle(String location) throws BundleException
{
- String symbolicName = getManifestEntry(location, Constants.BUNDLE_SYMBOLICNAME);
- String version = getManifestEntry(location, Constants.BUNDLE_VERSION);
+ URL bundleURL = getTestHelper().getTestArchiveURL(location);
+ BundleDeployment bundleDep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
+ String symbolicName = bundleDep.getSymbolicName();
+ Version version = bundleDep.getVersion();
OSGiBundle bundle;
BundleContext context = getBundleContext();
- URL bundleURL = getTestHelper().getTestArchiveURL(location);
ServiceReference sref = context.getServiceReference(DeployerService.class.getName());
if (sref != null)
{
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-09-16 12:31:48 UTC (rev 93604)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-09-16 13:15:21 UTC (rev 93605)
@@ -189,22 +189,21 @@
return helper.getServerHost();
}
- public OSGiBundle getBundle(String symbolicName, String version)
+ public OSGiBundle getBundle(String symbolicName, Version version)
{
OSGiBundle bundle = getBundle(symbolicName, version, false);
return bundle;
}
- protected OSGiBundle getBundle(String symbolicName, String versionStr, boolean mustExist)
+ protected OSGiBundle getBundle(String symbolicName, Version version, boolean mustExist)
{
OSGiBundle bundle = null;
- Version version = Version.parseVersion(versionStr);
List<OSGiBundle> bundles = Arrays.asList(getBundles());
for (OSGiBundle aux : bundles)
{
if (aux.getSymbolicName().equals(symbolicName))
{
- if (versionStr == null || version.equals(aux.getVersion()))
+ if (version == null || version.equals(aux.getVersion()))
{
bundle = aux;
break;
More information about the jboss-osgi-commits
mailing list