JBoss-OSGI SVN: r90472 - in projects/jboss-osgi/trunk/blueprint: impl/src/main/java/org/jboss/osgi/blueprint and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 11:11:39 -0400 (Fri, 19 Jun 2009)
New Revision: 90472
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/JBossXBParser.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaBindingParser.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java
Removed:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/JBossXBParser.java
Modified:
projects/jboss-osgi/trunk/blueprint/impl/pom.xml
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/Tcollection.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentFactory.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceReferenceMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
Log:
Add BlueprintContext
Modified: projects/jboss-osgi/trunk/blueprint/impl/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/pom.xml 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/pom.xml 2009-06-19 15:11:39 UTC (rev 90472)
@@ -64,6 +64,7 @@
org.osgi.service.blueprint.*
</Export-Package>
<Import-Package>
+ javax.xml.bind.annotation,
org.apache.xerces.dom,
org.jboss.beans.metadata.*,
org.jboss.dependency.spi*,
@@ -71,6 +72,7 @@
org.jboss.osgi.common.log;version=1.0,
org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
+ org.jboss.util.xml,
org.jboss.xb.*,
org.osgi.framework,
org.osgi.service.log,
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,45 @@
+/*
+ * 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.blueprint;
+
+//$Id$
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * The context of the Blueprint implementation
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public interface BlueprintContext
+{
+ String XMLNS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
+
+ LogService getLog();
+
+ BundleContext getBundleContext();
+
+ BlueprintParser getBlueprintParser();
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/BlueprintContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -29,10 +29,9 @@
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.spi.service.MicrocontainerService;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
@@ -57,14 +56,14 @@
public abstract class AbstractManager
{
protected LogService log;
- protected BundleContext context;
+ protected BlueprintContext context;
protected BlueprintContainer container;
private ComponentMetadata component;
- public AbstractManager(BundleContext context, BlueprintContainer container, ComponentMetadata component)
+ public AbstractManager(BlueprintContext context, BlueprintContainer container, ComponentMetadata component)
{
- this.log = new LogServiceTracker(context);
+ this.log = context.getLog();
this.context = context;
this.container = container;
this.component = component;
@@ -137,11 +136,11 @@
protected KernelController getKernelController()
{
- ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
+ ServiceReference sref = context.getBundleContext().getServiceReference(MicrocontainerService.class.getName());
if (sref == null)
throw new IllegalStateException("Cannot obtain MicrocontainerService");
- MicrocontainerService service = (MicrocontainerService)context.getService(sref);
+ MicrocontainerService service = (MicrocontainerService)context.getBundleContext().getService(sref);
KernelController controller = service.getRegisteredBean(KernelController.class, BEAN_KERNEL_CONTROLLER);
if (controller == null)
throw new IllegalStateException("Cannot obtain KernelController");
@@ -149,7 +148,7 @@
return controller;
}
- static AbstractManager createManager(BundleContext context, BlueprintContainer container, ComponentMetadata comp)
+ static AbstractManager createManager(BlueprintContext context, BlueprintContainer container, ComponentMetadata comp)
{
AbstractManager manager = null;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -26,8 +26,8 @@
import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.BeanMetadataImpl;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
@@ -56,7 +56,7 @@
private BeanMetadataImpl beanMetadata;
private BeanMetaData kernelBean;
- public BeanManager(BundleContext context, BlueprintContainer container, BeanMetadata compMetadata)
+ public BeanManager(BlueprintContext context, BlueprintContainer container, BeanMetadata compMetadata)
{
super(context, container, compMetadata);
this.beanMetadata = (BeanMetadataImpl)compMetadata;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -34,6 +34,7 @@
import java.util.Properties;
import java.util.Set;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
import org.osgi.framework.Bundle;
@@ -72,12 +73,12 @@
public static final String PROPERTY_BLUEPRINT_BUNDLE_SYMBOLIC_NAME = "osgi.blueprint.container.symbolicname";
public static final String PROPERTY_BLUEPRINT_BUNDLE_VERSION = "osgi.blueprint.container.version";
- private BundleContext context;
+ private BlueprintContext context;
private Bundle bundle;
private Map<String, AbstractManager> managers = new LinkedHashMap<String, AbstractManager>();
- public BlueprintContainerImpl(BundleContext context, Bundle bundle)
+ public BlueprintContainerImpl(BlueprintContext context, Bundle bundle)
{
this.context = context;
this.bundle = bundle;
@@ -169,7 +170,7 @@
Properties props = new Properties();
props.setProperty(PROPERTY_BLUEPRINT_BUNDLE_SYMBOLIC_NAME, symbolicName);
props.setProperty(PROPERTY_BLUEPRINT_BUNDLE_VERSION, version);
- context.registerService(BlueprintContainer.class.getName(), this, props);
+ context.getBundleContext().registerService(BlueprintContainer.class.getName(), this, props);
}
private void createManagers(BlueprintMetadata bpMetadata)
@@ -204,8 +205,8 @@
private BlueprintMetadata getBlueprintMetadata()
{
- BlueprintParser bpParser = new BlueprintParser(context);
- BlueprintMetadata bpMetadata = bpParser.getBlueprintMetadata(bundle);
+ BlueprintParser parser = context.getBlueprintParser();
+ BlueprintMetadata bpMetadata = parser.getBlueprintMetadata(bundle);
bpMetadata.initialize();
return bpMetadata;
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -27,8 +27,8 @@
import java.util.Collections;
import java.util.List;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.ServiceMetadataImpl;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
@@ -53,7 +53,7 @@
private BeanManager anonymousBean;
private List<ServiceRegistration> serviceRegs = new ArrayList<ServiceRegistration>();
- public ServiceManager(BundleContext context, BlueprintContainer container, ServiceMetadata compMetadata)
+ public ServiceManager(BlueprintContext context, BlueprintContainer container, ServiceMetadata compMetadata)
{
super(context, container, compMetadata);
this.serviceMetadata = (ServiceMetadataImpl)compMetadata;
@@ -94,7 +94,7 @@
Object targetBean = beanManager.getTargetBean();
for (String interf : serviceMetadata.getInterfaces())
{
- ServiceRegistration sreg = context.registerService(interf, targetBean, null);
+ ServiceRegistration sreg = context.getBundleContext().registerService(interf, targetBean, null);
serviceRegs.add(sreg);
}
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -23,8 +23,8 @@
//$Id$
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.reflect.ServiceReferenceMetadataImpl;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
@@ -43,7 +43,7 @@
{
private ServiceReferenceMetadataImpl srefMetadata;
- public ServiceReferenceManager(BundleContext context, BlueprintContainer container, ServiceReferenceMetadata compMetadata)
+ public ServiceReferenceManager(BlueprintContext context, BlueprintContainer container, ServiceReferenceMetadata compMetadata)
{
super(context, container, compMetadata);
this.srefMetadata = (ServiceReferenceMetadataImpl)compMetadata;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintActivator.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -45,7 +45,7 @@
BlueprintService service = new BlueprintService(){};
context.registerService(BlueprintService.class.getName(), service, null);
- extender = new BlueprintExtender(context);
+ extender = new BlueprintExtender(new BlueprintContextImpl(context));
context.addBundleListener(extender);
}
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,69 @@
+/*
+ * 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.blueprint.extender;
+
+//$Id$
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * The context of the Blueprint implementation
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class BlueprintContextImpl implements BlueprintContext
+{
+ public static final String XMLNS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
+
+ private LogService log;
+ private BundleContext context;
+ private BlueprintParser parser;
+
+ public BlueprintContextImpl(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+
+ this.parser = new BlueprintParser(this);
+ }
+
+ public LogService getLog()
+ {
+ return log;
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return context;
+ }
+
+ public BlueprintParser getBlueprintParser()
+ {
+ return parser;
+ }
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintContextImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -31,9 +31,9 @@
import java.util.List;
import java.util.Map;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.container.BlueprintContainerImpl;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.Constants;
import org.osgi.framework.SynchronousBundleListener;
@@ -46,10 +46,10 @@
*/
public class BlueprintExtender implements SynchronousBundleListener
{
- private BundleContext context;
+ private BlueprintContext context;
private Map<String, BlueprintContainerImpl> containers = new LinkedHashMap<String, BlueprintContainerImpl>();
- public BlueprintExtender(BundleContext context)
+ public BlueprintExtender(BlueprintContext context)
{
this.context = context;
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/BlueprintParser.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -26,12 +26,10 @@
import java.net.URL;
import java.util.Enumeration;
-import org.jboss.osgi.blueprint.parser.xb.JBossXBParser;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
-import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
//$Id$
@@ -45,12 +43,16 @@
public class BlueprintParser
{
private LogService log;
- private BundleContext context;
+ private BlueprintContext context;
+ private JBossXBParser parser;
- public BlueprintParser(BundleContext context)
+ public BlueprintParser(BlueprintContext context)
{
- this.log = new LogServiceTracker(context);
+ this.log = context.getLog();
this.context = context;
+
+ //this.parser = new SchemaResolverParser(context);
+ this.parser = new SchemaBindingParser(context);
}
@SuppressWarnings("unchecked")
@@ -71,7 +73,7 @@
for (String descriptor : descritors)
{
- TBlueprint aux = processDescriptor(bundle, descriptor);
+ TBlueprint aux = parse(bundle, descriptor);
tBlueprint = aux.merge(tBlueprint);
}
}
@@ -82,7 +84,7 @@
while (foundEntries.hasMoreElements())
{
URL nextEntry = foundEntries.nextElement();
- TBlueprint aux = processDescriptor(nextEntry);
+ TBlueprint aux = parse(nextEntry);
tBlueprint = aux.merge(tBlueprint);
}
}
@@ -93,15 +95,15 @@
return new BlueprintMetadata(context, tBlueprint);
}
- private TBlueprint processDescriptor(Bundle bundle, String descriptor)
+ public TBlueprint parse(Bundle bundle, String descriptor)
{
URL descriptorURL = bundle.getResource(descriptor);
- return processDescriptor(descriptorURL);
+ return parse(descriptorURL);
}
- private TBlueprint processDescriptor(URL descriptorURL)
+ public TBlueprint parse(URL descriptorURL)
{
- TBlueprint blueprint = new JBossXBParser().parse(descriptorURL);
+ TBlueprint blueprint = parser.parse(descriptorURL);
return blueprint;
}
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/JBossXBParser.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/JBossXBParser.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/JBossXBParser.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,43 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+
+import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+
+/**
+ * The SchemaBindingParser builds a JBossXB {@link SchemaBinding} from an annotated blueprint.xsd
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public interface JBossXBParser
+{
+ /*
+ * Parse a blueprint descriptor
+ */
+ public TBlueprint parse(URL xmlURL);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/JBossXBParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaBindingParser.java (from rev 90471, projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/JBossXBParser.java)
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaBindingParser.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaBindingParser.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,110 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import java.net.URL;
+
+import org.apache.xerces.dom.DOMXSImplementationSourceImpl;
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.blueprint.BlueprintException;
+import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+
+/**
+ * The SchemaBindingParser builds a JBossXB {@link SchemaBinding} from an annotated blueprint.xsd
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class SchemaBindingParser implements JBossXBParser
+{
+ private SchemaBinding schemaBinding;
+
+ public SchemaBindingParser(BlueprintContext context)
+ {
+ // https://jira.jboss.org/jira/browse/JBXB-202
+ // Inconsistent initialization of XSImplementation
+ //
+ // Please provide an JBossXB initialization entry point that is public and does not make an assumption on the availability of the TCCL
+ //
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ ClassLoader bundleCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(bundleCL);
+
+ // Make sure we import and can load the XSImplementation
+ // This is the code that is used in JBossXB Util.getXSImplementation()
+ bundleCL.loadClass(DOMXSImplementationSourceImpl.class.getName());
+
+ ClassLoader resourceLoader = getClass().getClassLoader();
+ URL schemaXSD = resourceLoader.getResource("schema/blueprint-jbxb.xsd");
+ if (schemaXSD == null)
+ throw new BlueprintException("Cannot get blueprint schema from: " + resourceLoader);
+
+ schemaBinding = XsdBinder.bind(schemaXSD.toExternalForm());
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalStateException("Cannot load: " + DOMXSImplementationSourceImpl.class.getName());
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ /*
+ * Parse a blueprint descriptor
+ */
+ public TBlueprint parse(URL xmlURL)
+ {
+ if (xmlURL == null)
+ throw new IllegalArgumentException("Cannot parse null descriptor URL");
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ ClassLoader bundleCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(bundleCL);
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ TBlueprint tBlueprint = (TBlueprint)unmarshaller.unmarshal(xmlURL.toExternalForm(), schemaBinding);
+
+ return tBlueprint;
+ }
+ catch (JBossXBException ex)
+ {
+ throw new BlueprintException("Cannot parse blueprint descriptor: " + xmlURL, ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,108 @@
+/*
+ * 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.blueprint.parser;
+
+//$Id$
+
+import static org.jboss.osgi.blueprint.BlueprintContext.XMLNS_BLUEPRINT;
+
+import java.net.URL;
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.blueprint.BlueprintException;
+import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.osgi.service.log.LogService;
+
+/**
+ * The Blueprint descriptor parser.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class SchemaResolverParser implements JBossXBParser
+{
+ private SchemaBindingResolver resolver;
+
+ public SchemaResolverParser(BlueprintContext context)
+ {
+ JBossEntityResolver.registerEntity(XMLNS_BLUEPRINT, "blueprint.xsd");
+ resolver = new BlueprintSchemaResolver(context);
+ }
+
+ /*
+ * Parse a blueprint descriptor
+ */
+ public TBlueprint parse(URL xmlURL)
+ {
+ if (xmlURL == null)
+ throw new IllegalArgumentException("Cannot parse null descriptor URL");
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ ClassLoader bundleCL = getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(bundleCL);
+
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ TBlueprint tBlueprint = (TBlueprint)unmarshaller.unmarshal(xmlURL.toExternalForm(), resolver);
+
+ return tBlueprint;
+ }
+ catch (JBossXBException ex)
+ {
+ throw new BlueprintException("Cannot parse blueprint descriptor: " + xmlURL, ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ static class BlueprintSchemaResolver extends DefaultSchemaResolver
+ {
+ private LogService log;
+
+ public BlueprintSchemaResolver(BlueprintContext context)
+ {
+ this.log = context.getLog();
+
+ try
+ {
+ addClassBinding(BlueprintContext.XMLNS_BLUEPRINT, TBlueprint.class.getName());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.log(LogService.LOG_ERROR, "Cannot create schema resolver", ex);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/SchemaResolverParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/JBossXBParser.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/JBossXBParser.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/JBossXBParser.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -1,111 +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.blueprint.parser.xb;
-
-//$Id$
-
-import java.net.URL;
-
-import org.apache.xerces.dom.DOMXSImplementationSourceImpl;
-import org.jboss.osgi.blueprint.BlueprintException;
-import org.jboss.xb.binding.JBossXBException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-
-/**
- * The Blueprint descriptor parser.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 13-May-2009
- */
-public class JBossXBParser
-{
- private static SchemaBinding schemaBinding;
-
- public JBossXBParser()
- {
- if (schemaBinding == null)
- {
- // https://jira.jboss.org/jira/browse/JBXB-202
- // Inconsistent initialization of XSImplementation
- //
- // Please provide an JBossXB initialization entry point that is public and does not make an assumption on the availability of the TCCL
- //
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- ClassLoader bundleCL = getClass().getClassLoader();
- Thread.currentThread().setContextClassLoader(bundleCL);
-
- // Make sure we import and can load the XSImplementation
- // This is the code that is used in JBossXB Util.getXSImplementation()
- bundleCL.loadClass(DOMXSImplementationSourceImpl.class.getName());
-
- ClassLoader resourceLoader = getClass().getClassLoader();
- URL schemaXSD = resourceLoader.getResource("schema/blueprint-jbxb.xsd");
- if (schemaXSD == null)
- throw new BlueprintException("Cannot get blueprint schema from: " + resourceLoader);
-
- schemaBinding = XsdBinder.bind(schemaXSD.toExternalForm());
- }
- catch (ClassNotFoundException ex)
- {
- throw new IllegalStateException("Cannot load: " + DOMXSImplementationSourceImpl.class.getName());
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
- }
-
- /*
- * Parse a blueprint descriptor
- */
- public TBlueprint parse(URL xmlURL)
- {
- if (xmlURL == null)
- throw new IllegalArgumentException("Cannot parse null descriptor URL");
-
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- ClassLoader bundleCL = getClass().getClassLoader();
- Thread.currentThread().setContextClassLoader(bundleCL);
-
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- TBlueprint tBlueprint = (TBlueprint)unmarshaller.unmarshal(xmlURL.toExternalForm(), schemaBinding);
-
- return tBlueprint;
- }
- catch (JBossXBException ex)
- {
- throw new BlueprintException("Cannot parse blueprint descriptor: " + xmlURL, ex);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/TBlueprint.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -33,9 +33,13 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.xb.annotations.JBossXmlSchema;
import org.osgi.service.blueprint.container.NoSuchComponentException;
/**
@@ -52,6 +56,9 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
+@JBossXmlSchema(namespace="urn:jboss:policy:1.0", elementFormDefault= XmlNsForm.QUALIFIED)
+@XmlRootElement(name="blueprint")
+@XmlType(name="Tblueprint")
public class TBlueprint
{
protected String description;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/Tcollection.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/Tcollection.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/parser/xb/Tcollection.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -26,7 +26,9 @@
import java.util.ArrayList;
import java.util.List;
+import javax.xml.bind.JAXBElement;
+
/**
*
*
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -25,9 +25,9 @@
import java.util.List;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.BeanArgument;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.BeanProperty;
@@ -45,12 +45,12 @@
private ComponentMetadata parent;
private TBean tBean;
- public BeanMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TBean tBean)
+ public BeanMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, TBean tBean)
{
this(context, blueprint, null, tBean);
}
- public BeanMetadataImpl(BundleContext context, BlueprintMetadata blueprint, ComponentMetadata parent, TBean tBean)
+ public BeanMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, ComponentMetadata parent, TBean tBean)
{
super(context, blueprint, tBean);
this.parent = parent;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -29,10 +29,10 @@
import java.util.List;
import java.util.Map;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.container.NoSuchComponentException;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
@@ -51,12 +51,12 @@
*/
public class BlueprintMetadata
{
- private BundleContext context;
+ private BlueprintContext context;
private TBlueprint tBlueprint;
private Map<String, ComponentMetadata> components = new LinkedHashMap<String, ComponentMetadata>();
- public BlueprintMetadata(BundleContext context, TBlueprint tBlueprint)
+ public BlueprintMetadata(BlueprintContext context, TBlueprint tBlueprint)
{
this.context = context;
this.tBlueprint = tBlueprint;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentFactory.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentFactory.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentFactory.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -23,11 +23,11 @@
// $Id$
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.blueprint.parser.xb.TServiceReference;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
/**
@@ -38,11 +38,11 @@
*/
public class ComponentFactory
{
- private BundleContext context;
+ private BlueprintContext context;
private BlueprintMetadata blueprint;
private int anonymousId;
- public ComponentFactory(BundleContext context, BlueprintMetadata blueprint)
+ public ComponentFactory(BlueprintContext context, BlueprintMetadata blueprint)
{
this.context = context;
this.blueprint = blueprint;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -25,8 +25,8 @@
import java.util.List;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
/**
@@ -39,7 +39,7 @@
{
protected TComponent tComp;
- public ComponentMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TComponent tComp)
+ public ComponentMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, TComponent tComp)
{
super(context, blueprint);
this.tComp = tComp;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -23,7 +23,7 @@
// $Id$
-import org.osgi.framework.BundleContext;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.osgi.service.blueprint.reflect.Metadata;
/**
@@ -34,10 +34,10 @@
*/
public class MetadataImpl implements Metadata
{
- protected BundleContext context;
+ protected BlueprintContext context;
protected BlueprintMetadata blueprint;
- public MetadataImpl(BundleContext context, BlueprintMetadata blueprint)
+ public MetadataImpl(BlueprintContext context, BlueprintMetadata blueprint)
{
this.context = context;
this.blueprint = blueprint;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -23,7 +23,7 @@
// $Id$
-import org.osgi.framework.BundleContext;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.osgi.service.blueprint.reflect.RefMetadata;
/**
@@ -36,7 +36,7 @@
{
private String refId;
- public RefMetadataImpl(BundleContext context, BlueprintMetadata blueprint, String refId)
+ public RefMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, String refId)
{
super(context, blueprint);
this.refId = refId;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -26,10 +26,10 @@
import java.util.Collection;
import java.util.List;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TAutoExportModes;
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.MapEntry;
import org.osgi.service.blueprint.reflect.RegistrationListener;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -46,7 +46,7 @@
private TService tService;
private Target target;
- public ServiceMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TService tService)
+ public ServiceMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, TService tService)
{
super(context, blueprint, tService);
this.tService = tService;
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceReferenceMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceReferenceMetadataImpl.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceReferenceMetadataImpl.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -26,10 +26,10 @@
import java.util.Collection;
import java.util.List;
+import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.xb.TAvailability;
import org.jboss.osgi.blueprint.parser.xb.TServiceReference;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.framework.BundleContext;
import org.osgi.service.blueprint.reflect.ReferenceListener;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
@@ -43,7 +43,7 @@
{
private TServiceReference tService;
- public ServiceReferenceMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TServiceReference tService)
+ public ServiceReferenceMetadataImpl(BlueprintContext context, BlueprintMetadata blueprint, TServiceReference tService)
{
super(context, blueprint, tService);
this.tService = tService;
Added: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -0,0 +1,100 @@
+/*
+ * 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.test.osgi.blueprint;
+
+//$Id$
+
+import org.jboss.osgi.blueprint.BlueprintContext;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * A mock {@link BlueprintContext}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class MockBlueprintContext implements BlueprintContext
+{
+ public BlueprintParser getBlueprintParser()
+ {
+ throw new NotImplementedException();
+ }
+
+ public BundleContext getBundleContext()
+ {
+ throw new NotImplementedException();
+ }
+
+ public LogService getLog()
+ {
+ return new LogService()
+ {
+ public void log(int level, String message)
+ {
+ System.out.println(logLevel(level) + " - " + message);
+ }
+
+ public void log(int level, String message, Throwable ex)
+ {
+ System.out.println(logLevel(level) + " - " + message);
+ ex.printStackTrace(System.out);
+ }
+
+ public void log(ServiceReference arg0, int arg1, String arg2)
+ {
+ throw new NotImplementedException();
+ }
+
+ public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3)
+ {
+ throw new NotImplementedException();
+ }
+ };
+ }
+
+ private String logLevel(int level)
+ {
+ String logLevel;
+ switch (level)
+ {
+ case LogService.LOG_DEBUG:
+ logLevel = "DEBUG";
+ break;
+ case LogService.LOG_INFO:
+ logLevel = "INFO";
+ break;
+ case LogService.LOG_WARNING:
+ logLevel = "WARN";
+ break;
+ case LogService.LOG_ERROR:
+ logLevel = "ERROR";
+ break;
+ default:
+ logLevel = "Level=" + level;
+ }
+ return logLevel;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/MockBlueprintContext.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -30,7 +30,7 @@
import java.util.Collection;
import java.util.List;
-import org.jboss.osgi.blueprint.parser.xb.JBossXBParser;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TAvailability;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
@@ -40,6 +40,7 @@
import org.jboss.osgi.blueprint.parser.xb.TServiceReference;
import org.jboss.osgi.blueprint.parser.xb.TTypeConverters;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -57,7 +58,7 @@
public static void beforeClass()
{
URL xmlURL = new OSGiTestHelper().getResourceURL("parser/blueprint-all-elements.xml");
- blueprint = new JBossXBParser().parse(xmlURL);
+ blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
}
@Test
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicBeansParserTestCase.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -29,11 +29,12 @@
import java.net.URL;
import java.util.List;
-import org.jboss.osgi.blueprint.parser.xb.JBossXBParser;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.jboss.test.osgi.blueprint.parser.comp.BeanA;
import org.jboss.test.osgi.blueprint.parser.comp.BeanB;
import org.junit.Test;
@@ -50,7 +51,7 @@
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
- TBlueprint blueprint = new JBossXBParser().parse(xmlURL);
+ TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
List<TComponent> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -29,10 +29,11 @@
import java.math.BigInteger;
import java.net.URL;
-import org.jboss.osgi.blueprint.parser.xb.JBossXBParser;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TAvailability;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.junit.Test;
/**
@@ -47,7 +48,7 @@
public void testBlueprintDefaultAttributes() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- TBlueprint blueprint = new JBossXBParser().parse(xmlURL);
+ TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
// assert default attributes
assertEquals(TAvailability.MANDATORY, blueprint.getDefaultAvailability());
@@ -61,7 +62,7 @@
public void testBlueprintDescription() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- TBlueprint blueprint = new JBossXBParser().parse(xmlURL);
+ TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
// assert description
assertEquals("some text", blueprint.getDescription());
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-06-19 12:53:52 UTC (rev 90471)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-06-19 15:11:39 UTC (rev 90472)
@@ -29,12 +29,13 @@
import java.net.URL;
import java.util.List;
-import org.jboss.osgi.blueprint.parser.xb.JBossXBParser;
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.parser.xb.TBean;
import org.jboss.osgi.blueprint.parser.xb.TBlueprint;
import org.jboss.osgi.blueprint.parser.xb.TComponent;
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.test.osgi.blueprint.MockBlueprintContext;
import org.jboss.test.osgi.blueprint.parser.comp.BeanA;
import org.jboss.test.osgi.blueprint.parser.comp.ServiceA;
import org.jboss.test.osgi.blueprint.parser.comp.ServiceB;
@@ -52,7 +53,7 @@
public void testBasicBeans() throws Exception
{
URL xmlURL = getResourceURL("parser/blueprint-basic-service.xml");
- TBlueprint blueprint = new JBossXBParser().parse(xmlURL);
+ TBlueprint blueprint = new BlueprintParser(new MockBlueprintContext()).parse(xmlURL);
List<TComponent> compList = blueprint.getComponents();
assertTrue(compList.size() > 0);
15 years
JBoss-OSGI SVN: r90471 - in projects/jboss-osgi/trunk/blueprint/testsuite/src/test: resources/container/OSGI-INF/blueprint and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 08:53:52 -0400 (Fri, 19 Jun 2009)
New Revision: 90471
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/container/OSGI-INF/blueprint/basic-service.xml
Log:
Allign bean impl with BP descriptor
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19 12:48:23 UTC (rev 90470)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19 12:53:52 UTC (rev 90471)
@@ -35,7 +35,6 @@
public class BeanA implements ServiceA
{
private MBeanServer mbeanServer;
- private BeanB beanB;
public BeanA()
{
@@ -52,15 +51,4 @@
System.out.println("BeanA: setMbeanServer");
this.mbeanServer = mbeanServer;
}
-
- public BeanB getBeanB()
- {
- return beanB;
- }
-
- public void setBeanB(BeanB beanB)
- {
- System.out.println("BeanA: setBeanB");
- this.beanB = beanB;
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/container/OSGI-INF/blueprint/basic-service.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/container/OSGI-INF/blueprint/basic-service.xml 2009-06-19 12:48:23 UTC (rev 90470)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/resources/container/OSGI-INF/blueprint/basic-service.xml 2009-06-19 12:53:52 UTC (rev 90471)
@@ -9,7 +9,9 @@
</service>
<service id="serviceB" interface="org.jboss.test.osgi.blueprint.container.bundle.ServiceB">
- <bean class="org.jboss.test.osgi.blueprint.container.bundle.BeanB"/>
+ <bean class="org.jboss.test.osgi.blueprint.container.bundle.BeanB">
+ <property name="beanA" ref="beanA"/>
+ </bean>
</service>
<reference id="mbeanService" interface="javax.management.MBeanServer"/>
15 years
JBoss-OSGI SVN: r90470 - in projects/jboss-osgi/trunk/blueprint: impl/src/main/java/org/jboss/osgi/blueprint/reflect and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 08:48:23 -0400 (Fri, 19 Jun 2009)
New Revision: 90470
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java
Log:
BP register services - ok
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -26,12 +26,15 @@
import static org.jboss.osgi.spi.service.MicrocontainerService.BEAN_KERNEL_CONTROLLER;
import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -55,13 +58,15 @@
{
protected LogService log;
protected BundleContext context;
+ protected BlueprintContainer container;
private ComponentMetadata component;
- public AbstractManager(BundleContext context, ComponentMetadata component)
+ public AbstractManager(BundleContext context, BlueprintContainer container, ComponentMetadata component)
{
this.log = new LogServiceTracker(context);
this.context = context;
+ this.container = container;
this.component = component;
}
@@ -95,6 +100,17 @@
log.log(LogService.LOG_DEBUG, "shutdown: " + component);
}
+ public Object getTargetBean()
+ {
+ KernelController controller = getKernelController();
+ ComponentMetadataImpl impl = (ComponentMetadataImpl)component;
+ ControllerContext ctrlContext = controller.getContext(impl.getKey(), null);
+ if (ctrlContext == null)
+ throw new IllegalStateException("Cannot obtain controller context for: " + impl.getKey());
+
+ return ctrlContext.getTarget();
+ }
+
protected KernelControllerContext installKernelBean(BeanMetaData kernelBean)
{
try
@@ -133,18 +149,18 @@
return controller;
}
- static AbstractManager createManager(BundleContext context, ComponentMetadata comp)
+ static AbstractManager createManager(BundleContext context, BlueprintContainer container, ComponentMetadata comp)
{
AbstractManager manager = null;
if (comp instanceof BeanMetadata)
- manager = new BeanManager(context, (BeanMetadata)comp);
+ manager = new BeanManager(context, container, (BeanMetadata)comp);
else if (comp instanceof ServiceMetadata)
- manager = new ServiceManager(context, (ServiceMetadata)comp);
+ manager = new ServiceManager(context, container, (ServiceMetadata)comp);
else if (comp instanceof ServiceReferenceMetadata)
- manager = new ServiceReferenceManager(context, (ServiceReferenceMetadata)comp);
+ manager = new ServiceReferenceManager(context, container, (ServiceReferenceMetadata)comp);
if (manager == null)
throw new IllegalArgumentException("Unsupported component type: " + comp);
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -28,6 +28,7 @@
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.osgi.blueprint.reflect.BeanMetadataImpl;
import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
/**
@@ -55,9 +56,9 @@
private BeanMetadataImpl beanMetadata;
private BeanMetaData kernelBean;
- public BeanManager(BundleContext context, BeanMetadata compMetadata)
+ public BeanManager(BundleContext context, BlueprintContainer container, BeanMetadata compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.beanMetadata = (BeanMetadataImpl)compMetadata;
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -36,7 +36,6 @@
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
-import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -130,10 +129,7 @@
public ComponentMetadata getComponentMetadata(String name)
{
- AbstractManager manager = managers.get(name);
- if (manager == null)
- throw new NoSuchComponentException(name);
-
+ AbstractManager manager = getComponentManager(name);
return manager.getComponentMetadata();
}
@@ -149,10 +145,20 @@
}
return Collections.unmodifiableList(compMetadata);
}
+
+ public AbstractManager getComponentManager(String name)
+ {
+ AbstractManager manager = managers.get(name);
+ if (manager == null)
+ throw new NoSuchComponentException(name);
+
+ return manager;
+ }
public Object getComponentInstance(String id)
{
- throw new NotImplementedException();
+ AbstractManager manager = getComponentManager(id);
+ return manager.getTargetBean();
}
private void registerBlueprintContainerService()
@@ -170,7 +176,7 @@
{
for (ComponentMetadata comp : bpMetadata.getComponents())
{
- AbstractManager manager = AbstractManager.createManager(context, comp);
+ AbstractManager manager = AbstractManager.createManager(context, this, comp);
String key = manager.getId();
if (key == null)
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -30,8 +30,11 @@
import org.jboss.osgi.blueprint.reflect.ServiceMetadataImpl;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
/**
* Service managers maintain the registration of an OSGi service
@@ -50,15 +53,15 @@
private BeanManager anonymousBean;
private List<ServiceRegistration> serviceRegs = new ArrayList<ServiceRegistration>();
- public ServiceManager(BundleContext context, ServiceMetadata compMetadata)
+ public ServiceManager(BundleContext context, BlueprintContainer container, ServiceMetadata compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.serviceMetadata = (ServiceMetadataImpl)compMetadata;
// Create the anonymous bean manager
- BeanMetadata beanMetadata = (BeanMetadata)serviceMetadata.getServiceComponent();
- if (beanMetadata != null)
- anonymousBean = (BeanManager)AbstractManager.createManager(context, beanMetadata);
+ Target target = serviceMetadata.getServiceComponent();
+ if (target instanceof BeanMetadata)
+ anonymousBean = (BeanManager)AbstractManager.createManager(context, container, (BeanMetadata)target);
}
@Override
@@ -75,16 +78,24 @@
{
super.activate();
+ // Get the BeanManager that backs this service
BeanManager beanManager = anonymousBean;
if (beanManager == null)
{
+ RefMetadata target = (RefMetadata)serviceMetadata.getServiceComponent();
+ BlueprintContainerImpl impl = (BlueprintContainerImpl)container;
+ beanManager = (BeanManager)impl.getComponentManager(target.getComponentId());
}
- // Register the services
+ // Activate the BeanManager that backs this service
+ beanManager.activate();
+
+ // Register the the target bean as a services
+ Object targetBean = beanManager.getTargetBean();
for (String interf : serviceMetadata.getInterfaces())
{
- //ServiceRegistration sreg = context.registerService(interf, this, null);
- //serviceRegs.add(sreg);
+ ServiceRegistration sreg = context.registerService(interf, targetBean, null);
+ serviceRegs.add(sreg);
}
}
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -25,6 +25,7 @@
import org.jboss.osgi.blueprint.reflect.ServiceReferenceMetadataImpl;
import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
/**
@@ -42,9 +43,9 @@
{
private ServiceReferenceMetadataImpl srefMetadata;
- public ServiceReferenceManager(BundleContext context, ServiceReferenceMetadata compMetadata)
+ public ServiceReferenceManager(BundleContext context, BlueprintContainer container, ServiceReferenceMetadata compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.srefMetadata = (ServiceReferenceMetadataImpl)compMetadata;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -35,16 +35,13 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class ComponentMetadataImpl implements ComponentMetadata
+public class ComponentMetadataImpl extends MetadataImpl implements ComponentMetadata
{
- protected BundleContext context;
- protected BlueprintMetadata blueprint;
protected TComponent tComp;
public ComponentMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TComponent tComp)
{
- this.context = context;
- this.blueprint = blueprint;
+ super(context, blueprint);
this.tComp = tComp;
}
@@ -58,6 +55,15 @@
return tComp.getId();
}
+ public String getKey()
+ {
+ String key = tComp.getId();
+ if (key == null)
+ throw new IllegalStateException("Cannot obtain key for componenet: " + tComp);
+
+ return key;
+ }
+
public int getInitialization()
{
return tComp.getInitialization();
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -0,0 +1,45 @@
+/*
+ * 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.blueprint.reflect;
+
+// $Id$
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.Metadata;
+
+/**
+ * Top level metadata.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class MetadataImpl implements Metadata
+{
+ protected BundleContext context;
+ protected BlueprintMetadata blueprint;
+
+ public MetadataImpl(BundleContext context, BlueprintMetadata blueprint)
+ {
+ this.context = context;
+ this.blueprint = blueprint;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -0,0 +1,54 @@
+/*
+ * 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.blueprint.reflect;
+
+// $Id$
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+
+/**
+ * A value which refers to another component in the module context by name.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class RefMetadataImpl extends MetadataImpl implements RefMetadata
+{
+ private String refId;
+
+ public RefMetadataImpl(BundleContext context, BlueprintMetadata blueprint, String refId)
+ {
+ super(context, blueprint);
+ this.refId = refId;
+ }
+
+ public String getComponentId()
+ {
+ return refId;
+ }
+
+ public String toString()
+ {
+ return "Ref[id=" + getComponentId() + "]";
+ }
+}
Property changes on: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -30,7 +30,6 @@
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.BundleContext;
-import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.MapEntry;
import org.osgi.service.blueprint.reflect.RegistrationListener;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -45,8 +44,8 @@
public class ServiceMetadataImpl extends ComponentMetadataImpl implements ServiceMetadata
{
private TService tService;
- private BeanMetadata beanMetadata;
-
+ private Target target;
+
public ServiceMetadataImpl(BundleContext context, BlueprintMetadata blueprint, TService tService)
{
super(context, blueprint, tService);
@@ -57,14 +56,14 @@
{
int modeValue = AUTO_EXPORT_DISABLED;
TAutoExportModes mode = tService.getAutoExportMode();
-
+
if (mode == TAutoExportModes.ALL_CLASSES)
- modeValue = AUTO_EXPORT_ALL_CLASSES;
+ modeValue = AUTO_EXPORT_ALL_CLASSES;
else if (mode == TAutoExportModes.CLASS_HIERARCHY)
- modeValue = AUTO_EXPORT_CLASS_HIERARCHY;
+ modeValue = AUTO_EXPORT_CLASS_HIERARCHY;
else if (mode == TAutoExportModes.INTERFACES)
- modeValue = AUTO_EXPORT_INTERFACES;
-
+ modeValue = AUTO_EXPORT_INTERFACES;
+
return modeValue;
}
@@ -85,30 +84,30 @@
public Target getServiceComponent()
{
- if (beanMetadata == null)
+ if (target == null)
{
if (tService.getBean() != null)
{
ComponentFactory factory = new ComponentFactory(context, blueprint);
- beanMetadata = (BeanMetadata)factory.createComponent(this, tService.getBean(), true);
+ target = (Target)factory.createComponent(this, tService.getBean(), true);
}
- //else if (tService.getRef() != null)
- //{
- // beanMetadata = (BeanMetadata)blueprint.getComponent(tService.getRef());
- //}
+ else if (tService.getRef() != null)
+ {
+ target = new RefMetadataImpl(context, blueprint, tService.getRef());
+ }
}
-
- //if (beanMetadata == null)
- // throw new IllegalStateException("Cannot get service component");
-
- return beanMetadata;
+
+ if (target == null)
+ throw new IllegalStateException("Cannot get service component");
+
+ return target;
}
public List<MapEntry> getServiceProperties()
{
throw new NotImplementedException();
}
-
+
public String toString()
{
return "Service[id=" + getId() + "]";
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -49,7 +49,6 @@
import org.jboss.test.osgi.blueprint.container.bundle.ServiceB;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -138,7 +137,6 @@
}
@Test
- @Ignore
public void getComponent() throws Exception
{
if (context == null)
@@ -147,10 +145,33 @@
assumeNotNull(context);
BlueprintContainer bpContainer = getBlueprintContainer();
- bpContainer.getComponentInstance("beanA");
+ BeanA beanA = (BeanA)bpContainer.getComponentInstance("beanA");
+ assertNotNull("ComponentInstance available", beanA);
}
@Test
+ public void getService() throws Exception
+ {
+ if (context == null)
+ huskyBridge.run();
+
+ assumeNotNull(context);
+
+ ServiceReference srefA = context.getServiceReference(ServiceA.class.getName());
+ assertNotNull("ServiceReference available", srefA);
+
+ ServiceA serviceA = (ServiceA)context.getService(srefA);
+ assertNotNull("Service available", serviceA);
+
+ ServiceReference srefB = context.getServiceReference(ServiceB.class.getName());
+ assertNotNull("ServiceReference available", srefB);
+
+ ServiceB serviceB = (ServiceB)context.getService(srefB);
+ assertNotNull("Service available", serviceB);
+
+ }
+
+ @Test
public void testComponentMetadataByName() throws Exception
{
if (context == null)
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -32,7 +32,7 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class BeanA
+public class BeanA implements ServiceA
{
private MBeanServer mbeanServer;
private BeanB beanB;
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java 2009-06-19 11:38:07 UTC (rev 90469)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java 2009-06-19 12:48:23 UTC (rev 90470)
@@ -30,7 +30,7 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class BeanB
+public class BeanB implements ServiceB
{
private BeanA beanA;
15 years
JBoss-OSGI SVN: r90469 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/testing/internal and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 07:38:07 -0400 (Fri, 19 Jun 2009)
New Revision: 90469
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
Disable BP testing for remote runtimes
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml 2009-06-19 11:16:46 UTC (rev 90468)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml 2009-06-19 11:38:07 UTC (rev 90469)
@@ -144,15 +144,14 @@
<profiles>
<!--
- Name: framework-equinox
- Descr: Setup for Equinox framework integration testing
+ Name: explicit-framework
+ Descr: Setup for framework integration testing
-->
<profile>
- <id>framework-equinox</id>
+ <id>explicit-framework</id>
<activation>
<property>
<name>framework</name>
- <value>equinox</value>
</property>
</activation>
<build>
@@ -166,41 +165,16 @@
</plugins>
</build>
</profile>
-
- <!--
- Name: framework-knopflerfish
- Descr: Setup for Knopflerfish framework integration testing
- -->
- <profile>
- <id>framework-knopflerfish</id>
- <activation>
- <property>
- <name>framework</name>
- <value>knopflerfish</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
<!--
- Name: jboss501
- Descr: Setup for jboss501 integration testing
+ Name: remote-testing
+ Descr: Setup for remote integration testing
-->
<profile>
- <id>jboss501</id>
+ <id>remote-testing</id>
<activation>
<property>
<name>target.container</name>
- <value>jboss501</value>
</property>
</activation>
<build>
@@ -214,55 +188,6 @@
</plugins>
</build>
</profile>
-
- <!--
- Name: jboss510
- Descr: Setup for jboss510 integration testing
- -->
- <profile>
- <id>jboss510</id>
- <activation>
- <property>
- <name>target.container</name>
- <value>jboss510</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!--
- Name: jboss600
- Descr: Setup for jboss600 integration testing
- -->
- <profile>
- <id>jboss600</id>
- <activation>
- <property>
- <name>target.container</name>
- <value>jboss600</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-06-19 11:16:46 UTC (rev 90468)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-06-19 11:38:07 UTC (rev 90469)
@@ -221,9 +221,7 @@
public void shutdown()
{
super.shutdown();
-
- // https://jira.jboss.org/jira/browse/JBOSGI-107
- //getPackageAdmin().refreshPackages(null);
+ getPackageAdmin().refreshPackages(null);
}
private RemoteFramework getRemoteFramework()
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-06-19 11:16:46 UTC (rev 90468)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-06-19 11:38:07 UTC (rev 90469)
@@ -31,7 +31,6 @@
import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
-import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -130,7 +129,6 @@
}
@Test
- @Ignore(value="[JBOSGI-107] MC service cannot be refreshed")
public void testWiringToUninstalledPackageAdmin() throws Exception
{
OSGiRuntime runtime = getDefaultRuntime();
15 years
JBoss-OSGI SVN: r90468 - in projects/jboss-osgi/trunk/testsuite/functional: src/test/java/org/jboss/test/osgi/jbosgi108 and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 07:16:46 -0400 (Fri, 19 Jun 2009)
New Revision: 90468
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ActivatorBundleA.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBeanMBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/ActivatorBundleB.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleB.bnd
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd
Modified:
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java
Log:
JBOSGI-108 - Investigate statics on PackageAdmin.refresh
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-06-19 10:02:07 UTC (rev 90467)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-06-19 11:16:46 UTC (rev 90468)
@@ -79,7 +79,8 @@
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi41-bundleA.jar" files="${tests.resources.dir}/jbosgi41/jbosgi41-bundleA.bnd" />
<!-- jbosgi108 -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi108-bundle.jar" files="${tests.resources.dir}/jbosgi108/jbosgi108-bundle.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi108-bundleA.jar" files="${tests.resources.dir}/jbosgi108/jbosgi108-bundleA.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi108-bundleB.jar" files="${tests.resources.dir}/jbosgi108/jbosgi108-bundleB.bnd" />
<!-- startlevel -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/service/startlevel.jar" files="${tests.resources.dir}/service/startlevel/startlevel.bnd" />
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java 2009-06-19 10:02:07 UTC (rev 90467)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -23,11 +23,20 @@
//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.jboss.osgi.spi.capability.JMXCapability;
+import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.jbosgi108.bundleA.SomeBeanMBean;
import org.junit.AfterClass;
+import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.osgi.framework.BundleException;
@@ -48,9 +57,7 @@
public static void beforeClass() throws BundleException
{
runtime = new OSGiTestHelper().getDefaultRuntime();
-
- OSGiBundle bundle = runtime.installBundle("jbosgi108-bundle.jar");
- bundle.start();
+ runtime.addCapability(new JMXCapability());
}
@AfterClass
@@ -60,12 +67,113 @@
runtime.shutdown();
}
+ @Before
+ public void setUp()
+ {
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+ }
+
@Test
- public void testRefresh() throws Exception
+ public void testRedeploySingle() throws Exception
{
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+
+ bundleA.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleA.uninstall();
+
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be recreated
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleA.uninstall();
+ }
+
+ @Test
+ public void testRedeployWithReference() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
+
+ bundleA.start();
+ bundleB.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 2, messages.size());
+
+ bundleA.uninstall();
+
+ // After uninstall bundleA, bundleB still holds a reference on bundleA.SomeBean
+
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be reused
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 4, messages.size());
+
+ bundleB.uninstall();
+ bundleA.uninstall();
+ }
+
+ @Test
+ public void testRedeployWithReferenceAndRefresh() throws Exception
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ OSGiBundle bundleB = runtime.installBundle("jbosgi108-bundleB.jar");
+
+ bundleA.start();
+ bundleB.start();
+
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, SomeBeanMBean.MBEAN_NAME, runtime.getMBeanServer());
+ List<String> messages = report(someBean.getMessages());
+ assertEquals("Start messages", 2, messages.size());
+
+ bundleA.uninstall();
+
+ // After uninstall bundleA, bundleB still holds a reference on bundleA.SomeBean
+
+ // Refresh all packages
OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
packageAdmin.refreshPackages(null);
- Thread.sleep(1000);
+ // Reinstall bundleA
+ bundleA = runtime.installBundle("jbosgi108-bundleA.jar");
+ bundleA.start();
+
+ // The static in bundleA.SomeBean is expected to be recreated
+
+ messages = report(someBean.getMessages());
+ assertEquals("Start messages", 1, messages.size());
+
+ bundleB.uninstall();
+ bundleA.uninstall();
}
+
+ private List<String> report(List<String> messages)
+ {
+ if (false)
+ {
+ System.out.println(">>>>>>>>>>>>");
+ for (String aux : messages)
+ {
+ System.out.println(aux);
+ }
+ System.out.println("<<<<<<<<<<<");
+ }
+ return messages;
+ }
}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA (from rev 90467, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle)
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ActivatorBundleA.java (from rev 90467, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ActivatorBundleA.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ActivatorBundleA.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,75 @@
+/*
+ * 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.test.osgi.jbosgi108.bundleA;
+
+//$Id: ServiceActivator.java 87064 2009-04-09 11:08:56Z thomas.diesler(a)jboss.com $
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class ActivatorBundleA implements BundleActivator
+{
+ private SomeBean bean;
+
+ public void start(BundleContext context)
+ {
+ bean = new SomeBean();
+
+ // Register the MBean
+ try
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ MBeanServer service = (MBeanServer)context.getService(sref);
+ service.registerMBean(bean, SomeBean.MBEAN_NAME);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "start with " + cl + " - hashCode: " + cl.hashCode();
+ bean.addMessage(msg);
+ }
+
+ public void stop(BundleContext context)
+ {
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "stop with " + cl + " - hashCode: " + cl.hashCode();
+ bean.addMessage(msg);
+
+ // Register the MBean
+ try
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ MBeanServer service = (MBeanServer)context.getService(sref);
+ service.unregisterMBean(SomeBean.MBEAN_NAME);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java 2009-06-19 10:02:07 UTC (rev 90467)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/ServiceActivator.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -1,62 +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.test.osgi.jbosgi108.bundle;
-
-//$Id: ServiceActivator.java 87064 2009-04-09 11:08:56Z thomas.diesler(a)jboss.com $
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class ServiceActivator implements BundleActivator
-{
- private static List<String> messages = new ArrayList<String>();
-
- public void start(BundleContext context)
- {
- ClassLoader cl = getClass().getClassLoader();
- String msg = "start with " + cl + " - hashCode: " + cl.hashCode();
- messages.add(msg);
- report(messages);
- }
-
- public void stop(BundleContext context)
- {
- ClassLoader cl = getClass().getClassLoader();
- String msg = "stop with " + cl + " - hashCode: " + cl.hashCode();
- messages.add(msg);
- report(messages);
- }
-
- private void report(List<String> messages)
- {
- System.out.println(">>>>>>>>>>>>");
- for (String aux : messages)
- {
- System.out.println(aux);
- }
- System.out.println("<<<<<<<<<<<");
- }
-
-}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBean.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,43 @@
+/*
+ * 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.test.osgi.jbosgi108.bundleA;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class SomeBean implements SomeBeanMBean
+{
+ private static List<String> messages = new ArrayList<String>();
+
+ public void addMessage(String msg)
+ {
+ messages.add(msg);
+ }
+
+ public List<String> getMessages()
+ {
+ return Collections.unmodifiableList(messages);
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBeanMBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBeanMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBeanMBean.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.osgi.jbosgi108.bundleA;
+
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+
+//$Id$
+
+public interface SomeBeanMBean
+{
+ ObjectName MBEAN_NAME = ObjectNameFactory.create("jboss.osgi:bean=SomeBean");
+
+ List<String> getMessages();
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleA/SomeBeanMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/ActivatorBundleB.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/ActivatorBundleB.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/ActivatorBundleB.java 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.osgi.jbosgi108.bundleB;
+
+//$Id$
+
+import org.jboss.test.osgi.jbosgi108.bundleA.SomeBean;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class ActivatorBundleB implements BundleActivator
+{
+ private SomeBean bean = new SomeBean();
+
+ public void start(BundleContext context)
+ {
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "start with " + cl + " - hashCode: " + cl.hashCode();
+ bean.addMessage(msg);
+ }
+
+ public void stop(BundleContext context)
+ {
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "stop with " + cl + " - hashCode: " + cl.hashCode();
+ bean.addMessage(msg);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/ActivatorBundleB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd 2009-06-19 10:02:07 UTC (rev 90467)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd 2009-06-19 11:16:46 UTC (rev 90468)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi108-bundle.jar src/test/resources/jbosgi108/bundle.bnd
-
-Bundle-SymbolicName: jbosgi108-bundle
-Bundle-Activator: org.jboss.test.osgi.jbosgi108.bundle.ServiceActivator
-Export-Package: org.jboss.test.osgi.jbosgi108.bundle
-
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleA.bnd (from rev 90467, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleA.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleA.bnd 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi108-bundleA.jar src/test/resources/jbosgi108/jbosgi108-bundleA.bnd
+
+Bundle-SymbolicName: jbosgi108-bundleA
+Bundle-Activator: org.jboss.test.osgi.jbosgi108.bundleA.ActivatorBundleA
+Export-Package: org.jboss.test.osgi.jbosgi108.bundleA
+
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleB.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundleB.bnd 2009-06-19 11:16:46 UTC (rev 90468)
@@ -0,0 +1,7 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi108-bundleB.jar src/test/resources/jbosgi108/jbosgi108-bundleB.bnd
+
+Bundle-SymbolicName: jbosgi108-bundleB
+Bundle-Activator: org.jboss.test.osgi.jbosgi108.bundleB.ActivatorBundleB
+Export-Package: org.jboss.test.osgi.jbosgi108.bundleB
+Import-Package: org.osgi.framework, org.jboss.test.osgi.jbosgi108.bundleA
+
15 years
JBoss-OSGI SVN: r90467 - in projects/jboss-osgi/trunk: blueprint/testsuite and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 06:02:07 -0400 (Fri, 19 Jun 2009)
New Revision: 90467
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleB/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundleX/
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
Log:
Disable BP from AS integration
Modified: projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml 2009-06-19 09:59:50 UTC (rev 90466)
+++ projects/jboss-osgi/trunk/blueprint/testsuite/pom.xml 2009-06-19 10:02:07 UTC (rev 90467)
@@ -142,6 +142,127 @@
<!-- Profiles -->
<profiles>
+
+ <!--
+ Name: framework-equinox
+ Descr: Setup for Equinox framework integration testing
+ -->
+ <profile>
+ <id>framework-equinox</id>
+ <activation>
+ <property>
+ <name>framework</name>
+ <value>equinox</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: framework-knopflerfish
+ Descr: Setup for Knopflerfish framework integration testing
+ -->
+ <profile>
+ <id>framework-knopflerfish</id>
+ <activation>
+ <property>
+ <name>framework</name>
+ <value>knopflerfish</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: jboss501
+ Descr: Setup for jboss501 integration testing
+ -->
+ <profile>
+ <id>jboss501</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss501</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: jboss510
+ Descr: Setup for jboss510 integration testing
+ -->
+ <profile>
+ <id>jboss510</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss510</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ Name: jboss600
+ Descr: Setup for jboss600 integration testing
+ -->
+ <profile>
+ <id>jboss600</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss600</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-06-19 09:59:50 UTC (rev 90466)
+++ projects/jboss-osgi/trunk/pom.xml 2009-06-19 10:02:07 UTC (rev 90467)
@@ -54,7 +54,7 @@
<version.jboss.osgi.microcontainer>1.0.0-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.jboss.osgi.remotelog>1.0.0.Beta2</version.jboss.osgi.remotelog>
<version.jboss.osgi.runtime.equinox>1.0.0.Beta2</version.jboss.osgi.runtime.equinox>
- <version.jboss.osgi.runtime.felix>1.0.0.Beta2</version.jboss.osgi.runtime.felix>
+ <version.jboss.osgi.runtime.felix>1.0.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
<version.jboss.osgi.runtime.knopflerfish>1.0.0.Beta2</version.jboss.osgi.runtime.knopflerfish>
<version.jboss.osgi.spi>1.0.0-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.webconsole>1.0.0.Beta2</version.jboss.osgi.webconsole>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-06-19 09:59:50 UTC (rev 90466)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-06-19 10:02:07 UTC (rev 90467)
@@ -78,6 +78,9 @@
<!-- jbosgi41 -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi41-bundleA.jar" files="${tests.resources.dir}/jbosgi41/jbosgi41-bundleA.bnd" />
+ <!-- jbosgi108 -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi108-bundle.jar" files="${tests.resources.dir}/jbosgi108/jbosgi108-bundle.bnd" />
+
<!-- startlevel -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/service/startlevel.jar" files="${tests.resources.dir}/service/startlevel/startlevel.bnd" />
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108 (from rev 90465, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39)
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java (from rev 90465, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI108TestCase.java 2009-06-19 10:02:07 UTC (rev 90467)
@@ -0,0 +1,71 @@
+/*
+ * 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.test.osgi.jbosgi108;
+
+//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.spi.testing.OSGiBundle;
+import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.BundleException;
+
+/**
+ * [JBOSGI-108] Investigate statics on PackageAdmin.refresh
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-108
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Jun-2009
+ */
+public class OSGI108TestCase
+{
+ private static OSGiRuntime runtime;
+
+ @BeforeClass
+ public static void beforeClass() throws BundleException
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+
+ OSGiBundle bundle = runtime.installBundle("jbosgi108-bundle.jar");
+ bundle.start();
+ }
+
+ @AfterClass
+ public static void afterClass() throws BundleException
+ {
+ if (runtime != null)
+ runtime.shutdown();
+ }
+
+ @Test
+ public void testRefresh() throws Exception
+ {
+ OSGiPackageAdmin packageAdmin = runtime.getPackageAdmin();
+ packageAdmin.refreshPackages(null);
+
+ Thread.sleep(1000);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-06-19 07:57:14 UTC (rev 90465)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/OSGI39TestCase.java 2009-06-19 10:02:07 UTC (rev 90467)
@@ -1,183 +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.test.osgi.jbosgi39;
-
-//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.spi.testing.OSGiBundle;
-import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-39
- *
- * Bundle B depends on bundle X.
- *
- * B ---> X
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class OSGI39TestCase extends OSGiTest
-{
- @Test
- public void testVerifyUnresolved() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
-
- bundleB.start();
-
- assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- /*
- * 4.3.11 Uninstalling Bundles
- *
- * Once this method returns, the state of the OSGi Service Platform must be the same as if the bundle had never been installed, unless:
- *
- * - The uninstalled bundle has exported any packages (via its Export-Package manifest header)
- * - The uninstalled bundle was selected by the Framework as the exporter of these packages.
- *
- * If none of the old exports are used, then the old exports must be removed. Otherwise, all old exports must remain available
- * for existing bundles and future resolves until the refreshPackages method is called or the Framework is restarted.
- */
- @Test
- public void testWiringToUninstalled() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Install B without X
- bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-
- @Test
- @Ignore(value="[JBOSGI-107] MC service cannot be refreshed")
- public void testWiringToUninstalledPackageAdmin() throws Exception
- {
- OSGiRuntime runtime = getDefaultRuntime();
- try
- {
- OSGiBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
- OSGiBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Forces the update (replacement) or removal of packages exported by the specified bundles.
- OSGiPackageAdmin packAdmin = runtime.getPackageAdmin();
- packAdmin.refreshPackages(null);
-
- // Install B without X
- bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
-
- bundleB.start();
-
- assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
- }
- finally
- {
- runtime.shutdown();
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java (from rev 90465, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/bundleB/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi108/bundle/ServiceActivator.java 2009-06-19 10:02:07 UTC (rev 90467)
@@ -0,0 +1,62 @@
+/*
+ * 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.test.osgi.jbosgi108.bundle;
+
+//$Id: ServiceActivator.java 87064 2009-04-09 11:08:56Z thomas.diesler(a)jboss.com $
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class ServiceActivator implements BundleActivator
+{
+ private static List<String> messages = new ArrayList<String>();
+
+ public void start(BundleContext context)
+ {
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "start with " + cl + " - hashCode: " + cl.hashCode();
+ messages.add(msg);
+ report(messages);
+ }
+
+ public void stop(BundleContext context)
+ {
+ ClassLoader cl = getClass().getClassLoader();
+ String msg = "stop with " + cl + " - hashCode: " + cl.hashCode();
+ messages.add(msg);
+ report(messages);
+ }
+
+ private void report(List<String> messages)
+ {
+ System.out.println(">>>>>>>>>>>>");
+ for (String aux : messages)
+ {
+ System.out.println(aux);
+ }
+ System.out.println("<<<<<<<<<<<");
+ }
+
+}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi108/jbosgi108-bundle.bnd 2009-06-19 10:02:07 UTC (rev 90467)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi108-bundle.jar src/test/resources/jbosgi108/bundle.bnd
+
+Bundle-SymbolicName: jbosgi108-bundle
+Bundle-Activator: org.jboss.test.osgi.jbosgi108.bundle.ServiceActivator
+Export-Package: org.jboss.test.osgi.jbosgi108.bundle
+
15 years
JBoss-OSGI SVN: r90466 - projects/jboss-osgi/projects/runtime/felix/trunk/src/main/resources.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 05:59:50 -0400 (Fri, 19 Jun 2009)
New Revision: 90466
Modified:
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/resources/osgi-deployers-jboss-beans.xml
Log:
Add BP required packages to system
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/resources/osgi-deployers-jboss-beans.xml 2009-06-19 07:57:14 UTC (rev 90465)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/resources/osgi-deployers-jboss-beans.xml 2009-06-19 09:59:50 UTC (rev 90466)
@@ -37,6 +37,10 @@
org.jboss.osgi.spi.testing;version=1.0,
<!-- jboss -->
+ org.jboss.beans.metadata.plugins.builder,
+ org.jboss.beans.metadata.spi.builder,
+ org.jboss.beans.metadata.spi,
+ org.jboss.dependency.spi,
org.jboss.logging,
org.jboss.virtual,
org.jboss.virtual.plugins.registry,
15 years
JBoss-OSGI SVN: r90465 - in projects/jboss-osgi/trunk: testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 03:57:14 -0400 (Fri, 19 Jun 2009)
New Revision: 90465
Modified:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
[JBOSGI-107] MC service cannot be refreshed
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-06-19 07:55:30 UTC (rev 90464)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/RemoteRuntime.java 2009-06-19 07:57:14 UTC (rev 90465)
@@ -221,7 +221,9 @@
public void shutdown()
{
super.shutdown();
- getPackageAdmin().refreshPackages(null);
+
+ // https://jira.jboss.org/jira/browse/JBOSGI-107
+ //getPackageAdmin().refreshPackages(null);
}
private RemoteFramework getRemoteFramework()
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-06-19 07:55:30 UTC (rev 90464)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-06-19 07:57:14 UTC (rev 90465)
@@ -46,8 +46,6 @@
public class MicrocontainerTestCase
{
static OSGiRuntime runtime;
- static OSGiBundle bundleA;
- static OSGiBundle bundleB;
@BeforeClass
public static void setUpClass() throws Exception
@@ -56,8 +54,8 @@
runtime.addCapability(new JNDICapability());
runtime.addCapability(new MicrocontainerCapability());
- bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
- bundleB = runtime.installBundle("example-mcservice-bundleB.jar");
+ OSGiBundle bundleA = runtime.installBundle("example-mcservice-bundleA.jar");
+ runtime.installBundle("example-mcservice-bundleB.jar");
bundleA.start();
}
@@ -65,20 +63,21 @@
@AfterClass
public static void tearDownClass() throws Exception
{
- if (bundleA != null)
- bundleA.uninstall();
-
- if (bundleB != null)
- bundleB.uninstall();
-
- runtime.shutdown();
+ if (runtime != null)
+ runtime.shutdown();
}
@Test
- public void testServiceRoundTrip() throws Exception
+ public void testBeanAccess() throws Exception
{
SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, MBEAN_NAME, runtime.getMBeanServer());
assertEquals("hello", someBean.echo("hello"));
+ }
+
+ @Test
+ public void testServiceService() throws Exception
+ {
+ SomeBeanMBean someBean = MBeanProxy.get(SomeBeanMBean.class, MBEAN_NAME, runtime.getMBeanServer());
assertEquals("hello", someBean.callSomeService("hello"));
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-06-19 07:55:30 UTC (rev 90464)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-06-19 07:57:14 UTC (rev 90465)
@@ -31,6 +31,7 @@
import org.jboss.osgi.spi.testing.OSGiPackageAdmin;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
+import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -129,6 +130,7 @@
}
@Test
+ @Ignore(value="[JBOSGI-107] MC service cannot be refreshed")
public void testWiringToUninstalledPackageAdmin() throws Exception
{
OSGiRuntime runtime = getDefaultRuntime();
15 years
JBoss-OSGI SVN: r90464 - projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 03:55:30 -0400 (Fri, 19 Jun 2009)
New Revision: 90464
Added:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedKernelBootstrap.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedSchemaResolverFactory.java
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java
Removed:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeansDeployer.java
Modified:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
Log:
[JBOSGI-107] Use embedded schema resolver
Deleted: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeansDeployer.java 2009-06-19 07:46:03 UTC (rev 90463)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeansDeployer.java 2009-06-19 07:55:30 UTC (rev 90464)
@@ -1,103 +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.microcontainer.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.osgi.common.log.LogServiceTracker;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
-
-/**
- * Boostrap the Microcontainer
- *
- * @author thomas.diesler(a)jboss.com
- * @since 27-Jun-2008
- */
-public class EmbeddedBeansDeployer extends BasicBootstrap
-{
- private LogService log;
- private BasicXMLDeployer deployer;
-
- public EmbeddedBeansDeployer(BundleContext context)
- {
- this.log = new LogServiceTracker(context);
-
- // Get or bootstrap the kernel
- if (kernel == null)
- {
- try
- {
- super.bootstrap();
- log.log(LogService.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.log(LogService.LOG_DEBUG, "deploy: " + url);
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- deployer.deploy(url);
- deployer.validate();
- }
- catch (Throwable e)
- {
- throw new IllegalStateException("Cannot deploy beans from: " + url, e);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- /**
- * Undeploy MC beans from URL
- */
- public void undeploy(URL url)
- {
- log.log(LogService.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
Copied: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedKernelBootstrap.java (from rev 90458, projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedBeansDeployer.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedKernelBootstrap.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedKernelBootstrap.java 2009-06-19 07:55:30 UTC (rev 90464)
@@ -0,0 +1,102 @@
+/*
+ * 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.microcontainer.internal;
+
+// $Id$
+
+import java.net.URL;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+
+/**
+ * Boostrap the Microcontainer
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-Jun-2008
+ */
+public class EmbeddedKernelBootstrap extends BasicBootstrap
+{
+ private LogService log;
+ private EmbeddedXMLDeployer deployer;
+
+ public EmbeddedKernelBootstrap(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+
+ // Get or bootstrap the kernel
+ if (kernel == null)
+ {
+ try
+ {
+ super.bootstrap();
+ log.log(LogService.LOG_DEBUG, "bootstrap kernel: " + kernel);
+ }
+ catch (Throwable e)
+ {
+ throw new IllegalStateException("Cannot bootstrap kernel", e);
+ }
+ }
+ deployer = new EmbeddedXMLDeployer(kernel);
+ }
+
+ /**
+ * Deploy MC beans from URL
+ */
+ public void deploy(URL url)
+ {
+ log.log(LogService.LOG_DEBUG, "deploy: " + url);
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ deployer.deploy(url);
+ deployer.validate();
+ }
+ catch (Throwable e)
+ {
+ throw new IllegalStateException("Cannot deploy beans from: " + url, e);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ public void undeploy(URL url)
+ {
+ log.log(LogService.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
Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedSchemaResolverFactory.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedSchemaResolverFactory.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedSchemaResolverFactory.java 2009-06-19 07:55:30 UTC (rev 90464)
@@ -0,0 +1,111 @@
+/*
+ * 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.microcontainer.internal;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * A {@link SchemaResolverFactory} that unlike the {@link SingletonSchemaResolverFactory}
+ * does not cache classes in static singletons.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-Jun-2008
+ */
+public class EmbeddedSchemaResolverFactory implements SchemaResolverFactory
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(EmbeddedSchemaResolverFactory.class);
+
+ /** The resolver */
+ private final DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ /**
+ * Create a new SingletonSchemaResolverFactory.
+ */
+ private EmbeddedSchemaResolverFactory()
+ {
+ addJaxbSchema("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
+ addJaxbSchema("urn:jboss:bean-deployer", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment10");
+ addJaxbSchema("urn:jboss:bean-deployer:2.0", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment");
+ addJaxbSchema("urn:jboss:javabean:1.0", "org.jboss.javabean.plugins.jaxb.JavaBean10");
+ addJaxbSchema("urn:jboss:javabean:2.0", "org.jboss.javabean.plugins.jaxb.JavaBean20");
+ addJaxbSchema("urn:jboss:policy:1.0", "org.jboss.beans.metadata.plugins.policy.AbstractPolicyMetaData");
+ addJaxbSchema("urn:jboss:classloading:1.0", "org.jboss.classloading.spi.metadata.ClassLoadingMetaData10");
+ addJaxbSchema("urn:jboss:classloader:1.0", "org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10");
+ addJaxbSchema("urn:jboss:deployers:2.0", "org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData");
+ }
+
+ public static SchemaResolverFactory getInstance()
+ {
+ return new EmbeddedSchemaResolverFactory();
+ }
+
+ public SchemaBindingResolver getSchemaBindingResolver()
+ {
+ return resolver;
+ }
+
+ /**
+ * Set the parse annotations for a schema
+ *
+ * @param namespace the namespace
+ * @param parseAnnotations whether to parse annotations
+ */
+ protected void setParseAnnotations(String namespace, Boolean parseAnnotations)
+ {
+ resolver.addSchemaParseAnnotations(namespace, parseAnnotations);
+ if (log.isTraceEnabled())
+ log.trace("Parse annotations '" + namespace + "' set to '" + parseAnnotations + "'");
+ }
+
+ /**
+ * Add a schema.
+ *
+ * @param namespace the namespace
+ * @param reference the schema reference class
+ * @return true when added
+ */
+ public boolean addJaxbSchema(String namespace, String reference)
+ {
+ try
+ {
+ resolver.addClassBinding(namespace, reference);
+ if (log.isTraceEnabled())
+ log.trace("Mapped '" + namespace + "' to '" + reference + "'");
+
+ return true;
+ }
+ catch (Exception ignored)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Ignored: ", ignored);
+
+ return false;
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedSchemaResolverFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java 2009-06-19 07:55:30 UTC (rev 90464)
@@ -0,0 +1,162 @@
+/*
+ * 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.microcontainer.internal;
+
+// $Id$
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.plugins.deployment.BasicKernelDeployer;
+import org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.logging.Logger;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+
+/**
+ * An XML deployer that unlike the {@link BasicXMLDeployer} does not cache
+ * classes in static singletons.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-Jun-2008
+ */
+public class EmbeddedXMLDeployer extends BasicKernelDeployer
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(EmbeddedXMLDeployer.class);
+
+ /** Unmarshaller factory */
+ private UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
+
+ /** The resolver */
+ private SchemaBindingResolver resolver = EmbeddedSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+
+ /** The deployments by url or name */
+ private Map<String, KernelDeployment> deploymentsByName = new ConcurrentHashMap<String, KernelDeployment>();
+
+ /**
+ * Create a new XML deployer
+ *
+ * @param kernel the kernel
+ */
+ public EmbeddedXMLDeployer(Kernel kernel)
+ {
+ super(kernel, null);
+ }
+
+ public Collection<String> getDeploymentNames()
+ {
+ return deploymentsByName.keySet();
+ }
+
+ public void deploy(KernelDeployment deployment) throws Throwable
+ {
+ super.deploy(deployment);
+ deploymentsByName.put(deployment.getName(), deployment);
+ }
+
+ public void undeploy(KernelDeployment deployment)
+ {
+ deploymentsByName.remove(deployment.getName());
+ super.undeploy(deployment);
+ }
+
+ /**
+ * Undeploy a url
+ *
+ * @param url the url to undeploy
+ * @throws IllegalStateException if the url is unknown
+ */
+ public void undeploy(final URL url)
+ {
+ if (url == null)
+ throw new IllegalArgumentException("Null url");
+
+ undeploy(url.toString());
+ }
+
+ /**
+ * Undeploy a name deployment
+ *
+ * @param name the name of the deployment to undeploy
+ * @throws IllegalStateException if the name is unknown
+ */
+ public void undeploy(final String name)
+ {
+ if (name == null)
+ throw new IllegalArgumentException("Null name");
+
+ KernelDeployment deployment = deploymentsByName.remove(name);
+ if (deployment == null)
+ throw new IllegalStateException("Unknown deployment " + name);
+
+ undeploy(deployment);
+ }
+
+ /**
+ * Deploy a url
+ *
+ * @param url the url to deploy
+ * @return the kernel deployment
+ * @throws Throwable for any error
+ */
+ public KernelDeployment deploy(final URL url) throws Throwable
+ {
+ final boolean trace = log.isTraceEnabled();
+
+ if (url == null)
+ throw new IllegalArgumentException("Null url");
+
+ if (trace)
+ log.trace("Parsing " + url);
+
+ long start = System.currentTimeMillis();
+
+ Unmarshaller unmarshaller = factory.newUnmarshaller();
+ KernelDeployment deployment = (KernelDeployment)unmarshaller.unmarshal(url.toString(), resolver);
+ if (deployment == null)
+ throw new RuntimeException("The xml " + url + " is not well formed!");
+
+ deployment.setName(url.toString());
+
+ if (trace)
+ {
+ long now = System.currentTimeMillis();
+ log.trace("Parsing " + url + " took " + (now - start) + " milliseconds");
+ }
+
+ deploy(deployment);
+
+ if (trace)
+ {
+ long now = System.currentTimeMillis();
+ log.trace("Deploying " + url + " took " + (now - start) + " milliseconds");
+ }
+
+ return deployment;
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/EmbeddedXMLDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-06-19 07:46:03 UTC (rev 90463)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-06-19 07:55:30 UTC (rev 90464)
@@ -58,7 +58,7 @@
public class MicrocontainerServiceImpl extends AbstractMicrocontainerService implements MicrocontainerServiceMBean
{
private BundleContext context;
- private EmbeddedBeansDeployer deployer;
+ private EmbeddedKernelBootstrap deployer;
private LogService log;
public MicrocontainerServiceImpl(BundleContext context)
@@ -68,7 +68,7 @@
VFS.init();
- deployer = new EmbeddedBeansDeployer(context);
+ deployer = new EmbeddedKernelBootstrap(context);
}
public Kernel getKernel()
15 years
JBoss-OSGI SVN: r90457 - projects/jboss-osgi/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 00:17:06 -0400 (Fri, 19 Jun 2009)
New Revision: 90457
Modified:
projects/jboss-osgi/trunk/pom.xml
Log:
izpack=4.2.0
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-06-19 03:22:06 UTC (rev 90456)
+++ projects/jboss-osgi/trunk/pom.xml 2009-06-19 04:17:06 UTC (rev 90457)
@@ -32,7 +32,7 @@
<version.apache.felix.http.jetty>1.0.0</version.apache.felix.http.jetty>
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.apache.felix.metatype>1.0.2</version.apache.felix.metatype>
- <version.izpack>4.3.0</version.izpack>
+ <version.izpack>4.2.0</version.izpack>
<version.javax.servlet>2.4</version.javax.servlet>
<version.jboss.deployers>2.0.5.GA</version.jboss.deployers>
<version.jboss.jdocbook.plugin>2.1.2</version.jboss.jdocbook.plugin>
15 years