[jboss-cvs] JBossAS SVN: r93472 - in projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi: testing and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Sep 14 08:59:02 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-09-14 08:59:02 -0400 (Mon, 14 Sep 2009)
New Revision: 93472
Added:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
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/RemoteRuntime.java
Log:
Add LogServiceCapability and Runtime.installCompendium()
Added: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -0,0 +1,46 @@
+/*
+ * 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.spi.capability;
+
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.osgi.service.log.LogService;
+
+/**
+ * Adds the OSGi compedium LogService capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if the {@link LogService} is already registered.
+ *
+ * Installed bundles: org.apache.felix.log.jar, jboss-osgi-common.jar
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 14-Sep-2009
+ */
+public class LogServiceCapability extends Capability
+{
+ public LogServiceCapability()
+ {
+ super(LogService.class.getName());
+ addBundle("bundles/org.apache.felix.log.jar");
+ addBundle("bundles/jboss-osgi-common.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/capability/LogServiceCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -59,6 +59,11 @@
OSGiBundle installBundle(String location) throws BundleException;
/**
+ * Install the compedium bundle for this runtime
+ */
+ OSGiBundle installCompendium() throws BundleException;
+
+ /**
* Get the array of installed {@link OSGiBundle}s
*/
OSGiBundle[] getBundles();
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-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -87,6 +87,12 @@
return registerBundle(location, bundle);
}
+ public OSGiBundle installCompendium() throws BundleException
+ {
+ String compendiumLocation = System.getProperty("org.osgi.compendium.jar", "bundles/org.osgi.compendium.jar");
+ return installBundle(compendiumLocation);
+ }
+
public OSGiBundle[] getBundles()
{
List<OSGiBundle> absBundles = new ArrayList<OSGiBundle>();
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 12:57:00 UTC (rev 93471)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-09-14 12:59:02 UTC (rev 93472)
@@ -94,6 +94,25 @@
}
}
+ public OSGiBundle installCompendium() throws BundleException
+ {
+ try
+ {
+ // Asume that the compendium is already installed in the remote runtime
+ ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle("osgi.cmpn", null);
+ RemoteBundle bundle = new RemoteBundle(this, bundleMBean, null);
+ return bundle;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot install compendium", ex);
+ }
+ }
+
@Override
public void deploy(String location) throws Exception
{
More information about the jboss-cvs-commits
mailing list