JBoss-OSGI SVN: r91711 - in projects/jboss-osgi/projects/spi/trunk: src/main/java/org/jboss/osgi/spi/framework and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-07-28 11:00:32 -0400 (Tue, 28 Jul 2009)
New Revision: 91711
Removed:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/EmbeddedBeansDeployer.java
Modified:
projects/jboss-osgi/projects/spi/trunk/.project
projects/jboss-osgi/projects/spi/trunk/pom.xml
Log:
Add FrameworkLoader
Modified: projects/jboss-osgi/projects/spi/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/.project 2009-07-28 14:38:35 UTC (rev 91710)
+++ projects/jboss-osgi/projects/spi/trunk/.project 2009-07-28 15:00:32 UTC (rev 91711)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jboss-osgi-runtime-spi</name>
+ <name>jboss-osgi-spi</name>
<comment></comment>
<projects>
</projects>
Modified: projects/jboss-osgi/projects/spi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/pom.xml 2009-07-28 14:38:35 UTC (rev 91710)
+++ projects/jboss-osgi/projects/spi/trunk/pom.xml 2009-07-28 15:00:32 UTC (rev 91711)
@@ -32,9 +32,7 @@
<!-- Properties -->
<properties>
<version.args4j>2.0.12</version.args4j>
- <version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
<version.jboss.logging>2.0.5.GA</version.jboss.logging>
- <version.jboss.microcontainer>2.0.5.GA</version.jboss.microcontainer>
<version.jboss.vfs>2.1.0.GA</version.jboss.vfs>
<version.osgi>r4v42</version.osgi>
</properties>
@@ -77,24 +75,6 @@
<version>${version.osgi}</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <version>${version.jboss.deployers}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>${version.jboss.microcontainer}</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<!-- Build -->
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java 2009-07-28 14:38:35 UTC (rev 91710)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/MicrocontainerBootstrapProvider.java 2009-07-28 15:00:32 UTC (rev 91711)
@@ -1,177 +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.spi.framework;
-
-//$Id$
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
-import org.jboss.osgi.spi.NotImplementedException;
-import org.jboss.osgi.spi.internal.EmbeddedBeansDeployer;
-
-/**
- * Bootstrap the OSGiFramework through the MC
- *
- * <pre>
- * <deployment xmlns="urn:jboss:bean-deployer:2.0" ...>
- *
- * <!-- The OSGiFramework -->
- * <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- * <property name="felixProperties">
- * <map keyClass="java.lang.String" valueClass="java.lang.String">
- * <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- * <entry>
- * <key>org.osgi.framework.system.packages</key>
- * <value>
- * org.osgi.framework; version=1.4,
- * org.osgi.util.tracker
- * </value>
- * </entry>
- * </map>
- * </property>
- * </bean>
- * ...
- * </deployment>
- * </pre>
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class MicrocontainerBootstrapProvider implements OSGiBootstrapProvider
-{
- /** The default framework beans property: jboss.osgi.bootstrap.beans */
- public static final String OSGI_BOOTSTRAP_BEANS = "jboss.osgi.bootstrap.beans";
- /** The default framework beans: jboss-osgi-bootstrap-beans.xml */
- public static final String DEFAULT_OSGI_BOOTSTRAP_XML = "jboss-osgi-bootstrap-beans.xml";
- /** The default framework beans property: jboss.osgi.framework.beans */
- public static final String OSGI_FRAMEWORK_BEANS = "jboss.osgi.framework.beans";
- /** The default framework beans: jboss-osgi-beans.xml */
- public static final String DEFAULT_OSGI_FRAMEWORK_XML = "jboss-osgi-beans.xml";
-
- private EmbeddedBeansDeployer deployer = new EmbeddedBeansDeployer();
- private boolean bootstraped;
- private boolean configured;
-
- public OSGiFramework getFramework()
- {
- return getFramework(DEFAULT_FRAMEWORK_NAME);
- }
-
- public OSGiFramework getFramework(String beanName)
- {
- OSGiFramework framework = getInstance(beanName, OSGiFramework.class);
- if (framework == null && configured == false)
- {
- configureWithDefaultBeans();
- framework = getInstance(beanName, OSGiFramework.class);
- }
- return framework;
- }
-
- public void configure()
- {
- configureWithDefaultBeans();
- }
-
- public void configure(InputStream streamConfig)
- {
- throw new NotImplementedException("Cannot bootstrap JBossMC from InputStream");
- }
-
- public void configure(String resourceConfig)
- {
- URL urlConfig = Thread.currentThread().getContextClassLoader().getResource(resourceConfig);
- if (urlConfig == null)
- throw new IllegalStateException("Cannot find resource: " + resourceConfig);
-
- configure(urlConfig);
- }
-
- public void configure(URL urlConfig)
- {
- deployer.deploy(urlConfig);
- configured = true;
- }
-
- public Object getInstance(String name)
- {
- Object retObj = null;
-
- if (bootstraped == false)
- {
- bootstrapKernel();
- bootstraped = true;
- }
-
- if (KernelConstants.KERNEL_NAME.equals(name))
- {
- retObj = deployer.getKernel();
- }
- else
- {
- Controller controller = deployer.getKernel().getController();
- ControllerContext context = controller.getInstalledContext(name);
- if (context != null)
- retObj = context.getTarget();
- }
-
- return retObj;
- }
-
- public <T> T getInstance(String name, Class<T> expectedType)
- {
- if (name == null)
- throw new IllegalArgumentException("Null name");
-
- if (expectedType == null)
- throw new IllegalArgumentException("Null expected type.");
-
- Object attribute = getInstance(name);
- if (attribute != null)
- {
- if (expectedType.isInstance(attribute) == false)
- throw new IllegalArgumentException("Not of expected type [" + expectedType + "]: " + attribute);
-
- return expectedType.cast(attribute);
- }
- return null;
- }
-
- private void configureWithDefaultBeans()
- {
- String defaultFrameworkBeans = System.getProperty(OSGI_FRAMEWORK_BEANS, DEFAULT_OSGI_FRAMEWORK_XML);
- configure(defaultFrameworkBeans);
- }
-
- private void bootstrapKernel()
- {
- // Deploy the bootstrap beans if DEFAULT_BOOTSTRAP_BEANS is on the classpath
- String defaultBootstrapBeans = System.getProperty(OSGI_BOOTSTRAP_BEANS, DEFAULT_OSGI_BOOTSTRAP_XML);
- URL urlBootstrap = Thread.currentThread().getContextClassLoader().getResource(defaultBootstrapBeans);
- if (urlBootstrap != null)
- deployer.deploy(urlBootstrap);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/EmbeddedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/EmbeddedBeansDeployer.java 2009-07-28 14:38:35 UTC (rev 91710)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/EmbeddedBeansDeployer.java 2009-07-28 15:00:32 UTC (rev 91711)
@@ -1,95 +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.spi.internal;
-
-// $Id$
-
-import java.net.URL;
-
-import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
-import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
-import org.jboss.logging.Logger;
-
-/**
- * Boostrap the Microcontainer
- *
- * @author thomas.diesler(a)jboss.com
- * @since 27-Jun-2008
- */
-public class EmbeddedBeansDeployer extends BasicBootstrap
-{
- // Provide logging
- final Logger log = Logger.getLogger(EmbeddedBeansDeployer.class);
-
- private BasicXMLDeployer deployer;
-
- public EmbeddedBeansDeployer()
- {
- // Get or bootstrap the kernel
- if (getKernel() == null)
- {
- try
- {
- super.bootstrap();
- log.debug("bootstrap kernel: " + kernel);
- }
- catch (Throwable e)
- {
- throw new IllegalStateException("Cannot bootstrap kernel", e);
- }
- }
- deployer = new BasicXMLDeployer(kernel);
- }
-
- /**
- * Deploy MC beans from URL
- */
- public void deploy(URL url)
- {
- log.debug("deploy: " + url);
- try
- {
- deployer.deploy(url);
- deployer.validate();
- }
- catch (Throwable e)
- {
- throw new IllegalStateException("Cannot deploy beans from: " + url, e);
- }
- }
-
- /**
- * Undeploy MC beans from URL
- */
- public void undeploy(URL url)
- {
- log.debug("undeploy: " + url);
- try
- {
- deployer.undeploy(url);
- }
- catch (Throwable e)
- {
- throw new IllegalStateException("Cannot undeploy beans from: " + url, e);
- }
- }
-}
\ No newline at end of file