Author: thomas.diesler(a)jboss.com
Date: 2009-06-17 09:32:50 -0400 (Wed, 17 Jun 2009)
New Revision: 90329
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/
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/osgi/framework/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/framework/ServiceException.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/Converter.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/package.html
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/packageinfo
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
Removed:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/context/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/context/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/convert/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/namespace/
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/Listener.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefCollectionMetadata.java
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/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/ComponentMetadataImpl.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/ServicePropertyEntry.java
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/osgi/service/blueprint/reflect/BeanMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/package.html
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.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/BasicServiceParserTestCase.java
Log:
Update BP API - WIP
Added:
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
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,168 @@
+/*
+ * 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.container;
+
+//$Id: BlueprintContextImpl.java 90313 2009-06-17 10:37:51Z thomas.diesler(a)jboss.com $
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Set;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.log.LogService;
+
+/**
+ * When a Blueprint extender bundle detects that a Blueprint bundle is
+ * ready, it creates a Blueprint Container to manage that Blueprint Bundle.
+ *
+ * The Blueprint Container then parses the definitions into metadata objects.
+ * All top-level elements in the definitions are ComponentMetadata objects
+ * and are registered in the Blueprint Container by their id.
+ *
+ * For each of the ComponentMetadata objects, the Blueprint Container has a
+ * corresponding component manager. For example, a BeanMetadata object
+ * relates to a Bean Manager. There are the following types of managers:
+ *
+ * - Bean Managers – Can provide general objects that are properly configured
+ * - Service Managers – Can register services
+ * - Service Reference Managers – Provide proxies to one or more services. There are two
sub-types: ref-list and reference.
+ * - Environment Managers – Holding environment values like the Blueprint Bundle object
+ *
+ * After creation, all managers are not yet activated. A manager is activated
+ * when it has to provide a component instance for the first time.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 17-Jun-2009
+ */
+public class BlueprintContainerImpl implements BlueprintContainer
+{
+ public static final String HEADER_BUNDLE_BLUEPRINT = "Bundle-Blueprint";
+
+ private LogService log;
+
+ private BundleContext context;
+ private Bundle bundle;
+
+ private BlueprintMetadata bpMetadata;
+
+ public BlueprintContainerImpl(BundleContext context, Bundle bundle)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ this.bundle = bundle;
+ }
+
+ public void initialize()
+ {
+ bpMetadata = getBlueprintMetadata(bundle);
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return bundle.getBundleContext();
+ }
+
+ public ComponentMetadata getComponentMetadata(String name)
+ {
+ return bpMetadata.getComponentMetadata(name);
+ }
+
+ public int getCompliance()
+ {
+ return COMPLIANCE_STRICT;
+ }
+
+ public Set<String> getComponentIds()
+ {
+ return bpMetadata.getComponentNames();
+ }
+
+ public <T extends ComponentMetadata> Collection<T>
getMetadata(Class<T> type)
+ {
+ return bpMetadata.getMetadata(type);
+ }
+
+ public Object getComponentInstance(String id)
+ {
+ throw new NotImplementedException();
+ }
+
+ @SuppressWarnings("unchecked")
+ private BlueprintMetadata getBlueprintMetadata(Bundle bundle)
+ {
+ BlueprintMetadata bpMetadata = null;
+
+ // If a Bundle-Blueprint manifest header is defined, then this header contains a
list of paths.
+ // If this header is not defined, then resources ending in .xml in the bundle’s
+ // OSGI-INF/blueprint directory must be used. These are the resources that
+ // would be found by calling the Bundle findEntries("OSGI-INF/blueprint",
"*.xml", false) method.
+
+ String descriptorPaths = (String)bundle.getHeaders().get(HEADER_BUNDLE_BLUEPRINT);
+ if (descriptorPaths != null)
+ {
+ log.log(LogService.LOG_INFO, HEADER_BUNDLE_BLUEPRINT + ": " +
descriptorPaths + " in bundle: " + bundle);
+ String[] descritors = descriptorPaths.split(", ");
+
+ for (String descriptor : descritors)
+ {
+ BlueprintMetadata aux = processDescriptor(bundle, descriptor);
+ bpMetadata = aux.merge(bpMetadata);
+ }
+ }
+
+ Enumeration<URL> foundEntries =
bundle.findEntries("OSGI-INF/blueprint", "*.xml", false);
+ if (foundEntries != null)
+ {
+ while (foundEntries.hasMoreElements())
+ {
+ URL nextEntry = foundEntries.nextElement();
+ BlueprintMetadata aux = processDescriptor(bundle, nextEntry);
+ bpMetadata = aux.merge(bpMetadata);
+ }
+ }
+
+ if (bpMetadata == null)
+ throw new IllegalStateException("Cannot obtain blueprint metadata");
+
+ return bpMetadata;
+ }
+
+ private BlueprintMetadata processDescriptor(Bundle bundle, String descriptor)
+ {
+ URL descriptorURL = bundle.getResource(descriptor);
+ return processDescriptor(bundle, descriptorURL);
+ }
+
+ private BlueprintMetadata processDescriptor(Bundle bundle, URL descriptorURL)
+ {
+ BlueprintMetadata blueprint = new BlueprintParser().parse(descriptorURL);
+ return blueprint;
+ }
+}
\ No newline at end of file
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/extender/BlueprintExtender.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -23,19 +23,13 @@
//$Id$
-import java.net.URL;
import java.util.Enumeration;
-import org.jboss.osgi.blueprint.context.BlueprintContextImpl;
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
-import org.jboss.osgi.common.log.LogServiceTracker;
+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.SynchronousBundleListener;
-import org.osgi.service.blueprint.context.BlueprintContext;
-import org.osgi.service.log.LogService;
/**
* The Blueprint extender
@@ -45,14 +39,10 @@
*/
public class BlueprintExtender implements SynchronousBundleListener
{
- private static final String HEADER_BUNDLE_BLUEPRINT = "Bundle-Blueprint";
-
- private LogService log;
private BundleContext context;
public BlueprintExtender(BundleContext context)
{
- this.log = new LogServiceTracker(context);
this.context = context;
}
@@ -61,7 +51,7 @@
{
Bundle bundle = event.getBundle();
- BlueprintMetadata bpMetadata = null;
+ boolean hasBlueprintMetadata = false;
if (event.getType() == BundleEvent.STARTING)
{
@@ -70,36 +60,17 @@
// OSGI-INF/blueprint directory must be used. These are the resources that
// would be found by calling the Bundle
findEntries("OSGI-INF/blueprint", "*.xml", false) method.
- String descriptorPaths =
(String)bundle.getHeaders().get(HEADER_BUNDLE_BLUEPRINT);
- if (descriptorPaths != null)
- {
- log.log(LogService.LOG_INFO, HEADER_BUNDLE_BLUEPRINT + ": " +
descriptorPaths + " in bundle: " + bundle);
- String[] descritors = descriptorPaths.split(", ");
-
- for (String descriptor : descritors)
- {
- BlueprintMetadata aux = processDescriptor(bundle, descriptor);
- bpMetadata = aux.merge(bpMetadata);
- }
- }
+ String descriptorPaths =
(String)bundle.getHeaders().get(BlueprintContainerImpl.HEADER_BUNDLE_BLUEPRINT);
+ hasBlueprintMetadata = (descriptorPaths != null);
Enumeration foundEntries = bundle.findEntries("OSGI-INF/blueprint",
"*.xml", false);
- if (foundEntries != null)
- {
- while (foundEntries.hasMoreElements())
- {
- URL nextEntry = (URL)foundEntries.nextElement();
- BlueprintMetadata aux = processDescriptor(bundle, nextEntry);
- bpMetadata = aux.merge(bpMetadata);
- }
- }
+ hasBlueprintMetadata |= (foundEntries != null);
}
-
- // Register the BlueprintContext
- if (bpMetadata != null)
+
+ if (hasBlueprintMetadata == true)
{
- BlueprintContext bpContext = new BlueprintContextImpl(bundle, bpMetadata);
- context.registerService(BlueprintContext.class.getName(), bpContext, null);
+ BlueprintContainerImpl bpContainer = new BlueprintContainerImpl(context,
bundle);
+ bpContainer.initialize();
}
}
@@ -110,16 +81,4 @@
{
// currently does nothing
}
-
- private BlueprintMetadata processDescriptor(Bundle bundle, String descriptor)
- {
- URL descriptorURL = bundle.getResource(descriptor);
- return processDescriptor(bundle, descriptorURL);
- }
-
- private BlueprintMetadata processDescriptor(Bundle bundle, URL descriptorURL)
- {
- BlueprintMetadata blueprint = new BlueprintParser().parse(descriptorURL);
- return blueprint;
- }
}
\ No newline at end of file
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -48,7 +48,6 @@
protected String description;
protected List<Object> argumentOrPropertyOrAny;
protected String className;
- protected String dependsOn;
protected String initMethod;
protected String destroyMethod;
protected String factoryMethod;
@@ -120,28 +119,6 @@
}
/**
- * Gets the value of the dependsOn property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getDependsOn()
- {
- return dependsOn;
- }
-
- /**
- * Sets the value of the dependsOn property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setDependsOn(String value)
- {
- this.dependsOn = value;
- }
-
- /**
* Gets the value of the initMethod property.
*
* @return possible object is {@link String }
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/BlueprintMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -36,11 +36,8 @@
import javax.xml.namespace.QName;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.service.blueprint.context.NoSuchComponentException;
-import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.container.NoSuchComponentException;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
-import org.osgi.service.blueprint.reflect.ServiceMetadata;
-import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
/**
* The blueprint element is the top element.
@@ -159,39 +156,18 @@
return compMetadata;
}
- public Collection<BeanMetadata> getBeanComponentsMetadata()
+ @SuppressWarnings("unchecked")
+ public <T extends ComponentMetadata> Collection<T>
getMetadata(Class<T> type)
{
- List<BeanMetadata> beanMetadata = new ArrayList<BeanMetadata>();
+ List<T> compMetadata = new ArrayList<T>();
for (ComponentMetadata comp : getComponents())
{
- if (comp instanceof BeanMetadata)
- beanMetadata.add((BeanMetadata)comp);
+ if (type.isAssignableFrom(comp.getClass()))
+ compMetadata.add((T)comp);
}
- return Collections.unmodifiableList(beanMetadata);
+ return Collections.unmodifiableList(compMetadata);
}
-
- public Collection<ServiceMetadata> getExportedServicesMetadata()
- {
- List<ServiceMetadata> servMetadata = new ArrayList<ServiceMetadata>();
- for (ComponentMetadata comp : getComponents())
- {
- if (comp instanceof ServiceMetadata)
- servMetadata.add((ServiceMetadata)comp);
- }
- return Collections.unmodifiableList(servMetadata);
- }
- public Collection<ServiceReferenceMetadata> getReferencedServicesMetadata()
- {
- List<ServiceReferenceMetadata> srefMetadata = new
ArrayList<ServiceReferenceMetadata>();
- for (ComponentMetadata comp : getComponents())
- {
- if (comp instanceof ServiceReferenceMetadata)
- srefMetadata.add((ServiceReferenceMetadata)comp);
- }
- return Collections.unmodifiableList(srefMetadata);
- }
-
/**
* Gets the value of the defaultLazyInit property.
*
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -23,6 +23,9 @@
//$Id$
+import java.util.ArrayList;
+import java.util.List;
+
import org.osgi.service.blueprint.reflect.ComponentMetadata;
/**
@@ -41,6 +44,8 @@
public abstract class ComponentMetadataImpl implements ComponentMetadata
{
protected String id;
+ protected List<String> dependsOn;
+ protected int initialization;
/**
* Gets the value of the id property.
@@ -58,4 +63,26 @@
this.id = value;
}
+ public List<String> getDependsOn()
+ {
+ if (dependsOn == null)
+ dependsOn = new ArrayList<String>();
+
+ return dependsOn;
+ }
+
+ public void setDependsOn(List<String> dependsOn)
+ {
+ this.dependsOn = dependsOn;
+ }
+
+ public int getInitialization()
+ {
+ return initialization;
+ }
+
+ public void setInitialization(int initialization)
+ {
+ this.initialization = initialization;
+ }
}
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -32,6 +32,7 @@
import javax.xml.namespace.QName;
import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.service.blueprint.reflect.MapEntry;
import org.osgi.service.blueprint.reflect.RegistrationListener;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
import org.osgi.service.blueprint.reflect.Target;
@@ -47,14 +48,13 @@
{
protected String description;
protected List<String> interfaces;
- protected List<ServicePropertyEntry> serviceProperties;
+ protected List<MapEntry> serviceProperties;
protected Collection<RegistrationListener> registrationListener;
protected BeanMetadataImpl bean;
protected RefImpl refFIXME;
protected List<Object> any;
protected String ref;
- protected String dependsOn;
- protected AutoExportModes autoExport;
+ protected int autoExport;
protected int ranking;
private Map<QName, String> otherAttributes = new HashMap<QName,
String>();
@@ -83,7 +83,7 @@
/**
* Gets the value of the interfaces property.
*/
- public List<String> getInterfaceNames()
+ public List<String> getInterfaces()
{
if (interfaces == null)
interfaces = new ArrayList<String>();
@@ -94,15 +94,15 @@
/**
* Gets the value of the serviceProperties property.
*/
- public List<ServicePropertyEntry> getServiceProperties()
+ public List<MapEntry> getServiceProperties()
{
if (serviceProperties == null)
- serviceProperties = new ArrayList<ServicePropertyEntry>();
+ serviceProperties = new ArrayList<MapEntry>();
return serviceProperties;
}
- public void setServiceProperties(List<ServicePropertyEntry> serviceProperties)
+ public void setServiceProperties(List<MapEntry> serviceProperties)
{
this.serviceProperties = serviceProperties;
}
@@ -219,52 +219,24 @@
}
/**
- * Gets the value of the dependsOn property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getDependsOn()
- {
- return dependsOn;
- }
-
- /**
- * Sets the value of the dependsOn property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setDependsOn(String value)
- {
- this.dependsOn = value;
- }
-
- /**
* Gets the value of the autoExport property.
*
* @return possible object is {@link AutoExportModes }
- *
*/
- public AutoExportModes getAutoExport()
+ public int getAutoExport()
{
- if (autoExport == null)
- {
- return AutoExportModes.DISABLED;
- }
- else
- {
- return autoExport;
- }
+ if (autoExport == 0)
+ autoExport = AUTO_EXPORT_DISABLED;
+
+ return autoExport;
}
/**
* Sets the value of the autoExport property.
*
* @param value allowed object is {@link AutoExportModes }
- *
*/
- public void setAutoExport(AutoExportModes value)
+ public void setAutoExport(int value)
{
this.autoExport = value;
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -7,12 +7,14 @@
package org.jboss.osgi.blueprint.reflect;
+import org.osgi.service.blueprint.reflect.MapEntry;
+
/**
* TservicePropertyEntry is an entry value used for the <service-properties>
element. This does not allow a child <key> element and there are no key-ref or
value-ref
* attributes.
*
*/
-public class ServicePropertyEntry
+public class ServicePropertyEntry implements MapEntry
{
protected String key;
protected String value;
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceReferenceMetadataImpl.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -24,7 +24,6 @@
// $Id$
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,9 +31,8 @@
import javax.xml.namespace.QName;
import org.jboss.osgi.spi.NotImplementedException;
-import org.osgi.service.blueprint.reflect.Listener;
+import org.osgi.service.blueprint.reflect.ReferenceListener;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
-import org.w3c.dom.Element;
/**
* TserviceReference is the base element type used for <reference>,
<ref-set>, and <ref-list> elements. This type defines all of the
characteristics common to both
@@ -72,7 +70,7 @@
{
protected String description;
protected List<String> interfaces;
- protected List<ReferenceListenerImpl> listener;
+ protected List<ReferenceListener> listener;
protected List<Object> any;
protected String filter;
protected String componentName;
@@ -105,7 +103,7 @@
* Gets the value of the interfaces property.
*
*/
- public List<String> getInterfaceNames()
+ public List<String> getInterfaces()
{
if (interfaces == null)
interfaces = new ArrayList<String>();
@@ -115,56 +113,22 @@
/**
* Gets the value of the listener property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot.
Therefore any modification you make to the returned list will be present inside the
- * JAXB object. This is why there is not a <CODE>set</CODE> method for the
listener property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getListener().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link
ReferenceListenerImpl }
- *
- *
*/
- public List<ReferenceListenerImpl> getListener()
+ public List<ReferenceListener> getReferenceListeners()
{
if (listener == null)
- listener = new ArrayList<ReferenceListenerImpl>();
+ listener = new ArrayList<ReferenceListener>();
return this.listener;
}
- public void setListener(List<ReferenceListenerImpl> listener)
+ public void setReferenceListeners(List<ReferenceListener> listener)
{
this.listener = listener;
}
/**
* Gets the value of the any property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot.
Therefore any modification you make to the returned list will be present inside the
- * JAXB object. This is why there is not a <CODE>set</CODE> method for the
any property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getAny().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link Object } {@link
Element }
- *
- *
*/
public List<Object> getAny()
{
@@ -260,7 +224,7 @@
return otherAttributes;
}
- public Collection<Listener> getServiceListeners()
+ public String getInterface()
{
throw new NotImplementedException();
}
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/framework/ServiceException.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/framework/ServiceException.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/framework/ServiceException.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) OSGi Alliance (2007, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework;
+
+/**
+ * A service exception used to indicate that a service problem occurred.
+ *
+ * <p>
+ * A <code>ServiceException</code> object is created by the Framework or
+ * service implementation to denote an exception condition in the service. A
+ * type code is used to identify the exception type for future extendability.
+ * Service implementations may also create subclasses of
+ * <code>ServiceException</code>. When subclassing, the subclass should set
+ * the type to {@link #SUBCLASSED} to indicate that
+ * <code>ServiceException</code> has been subclassed.
+ *
+ * <p>
+ * This exception conforms to the general purpose exception chaining mechanism.
+ *
+ * @version $Revision$
+ * @since 1.5
+ */
+
+public class ServiceException extends RuntimeException {
+ static final long serialVersionUID = 3038963223712959631L;
+
+ /**
+ * Type of service exception.
+ */
+ private final int type;
+
+ /**
+ * No exception type is unspecified.
+ */
+ public static final int UNSPECIFIED = 0;
+ /**
+ * The service has been unregistered.
+ */
+ public static final int UNREGISTERED = 1;
+ /**
+ * The service factory produced an invalid service object.
+ */
+ public static final int FACTORY_ERROR = 2;
+ /**
+ * The service factory threw an exception.
+ */
+ public static final int FACTORY_EXCEPTION = 3;
+ /**
+ * The exception is a subclass of ServiceException. The subclass should be
+ * examined for the type of the exception.
+ */
+ public static final int SUBCLASSED = 4;
+ /**
+ * An error occurred invoking a remote service.
+ */
+ public static final int REMOTE = 5;
+
+ /**
+ * Creates a <code>ServiceException</code> with the specified message and
+ * exception cause.
+ *
+ * @param msg The associated message.
+ * @param cause The cause of this exception.
+ */
+ public ServiceException(String msg, Throwable cause) {
+ this(msg, UNSPECIFIED, cause);
+ }
+
+ /**
+ * Creates a <code>ServiceException</code> with the specified message.
+ *
+ * @param msg The message.
+ */
+ public ServiceException(String msg) {
+ this(msg, UNSPECIFIED);
+ }
+
+ /**
+ * Creates a <code>ServiceException</code> with the specified message,
+ * type and exception cause.
+ *
+ * @param msg The associated message.
+ * @param type The type for this exception.
+ * @param cause The cause of this exception.
+ */
+ public ServiceException(String msg, int type, Throwable cause) {
+ super(msg, cause);
+ this.type = type;
+ }
+
+ /**
+ * Creates a <code>ServiceException</code> with the specified message and
+ * type.
+ *
+ * @param msg The message.
+ * @param type The type for this exception.
+ */
+ public ServiceException(String msg, int type) {
+ super(msg);
+ this.type = type;
+ }
+
+ /**
+ * Returns the type for this exception or <code>UNSPECIFIED</code> if the
+ * type was unspecified or unknown.
+ *
+ * @return The type of this exception.
+ */
+ public int getType() {
+ return type;
+ }
+}
\ No newline at end of file
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/framework/ServiceException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+
+/**
+ * BlueprintContainer providing access to the components, service exports, and
+ * service references of a bundle using blueprint services. Only bundles in the
+ * ACTIVE state may have an associated BlueprintContainer. A given BundleContext
+ * has at most one associated BlueprintContainer.
+ *
+ * An instance of BlueprintContainer may be obtained from within a blueprint context by
+ * injecting the predefined "blueprintContainer" component.
+ * Alternatively you can look up BlueprintContainer services in the service registry.
+ * The Constants.BUNDLE_SYMBOLICNAME and Constants.BUNDLE_VERSION service
+ * properties can be used to determine which bundle the published BlueprintContainer
+ * service is associated with.
+ *
+ * A BlueprintContainer implementation must support safe concurrent access. It is
+ * legal for the set of named components and component metadata to change
+ * between invocations on the same thread if another thread is concurrently
+ * modifying the same mutable BlueprintContainer implementation object.
+ *
+ * @see org.osgi.framework.Constants
+ *
+ */
+public interface BlueprintContainer {
+
+ /**
+ * The container will apply strict compliance rules
+ */
+ static final int COMPLIANCE_STRICT = 1;
+
+ /**
+ * The container will use loose compliance rules
+ */
+ static final int COMPLIANCE_LOOSE = 2;
+
+ /**
+ * The set of component names recognized by the blueprint context.
+ *
+ * @return an immutable set (of Strings) containing the names of all of the components
within the
+ * context.
+ */
+ Set<String> getComponentIds();
+
+ /**
+ * Get the component instance for a given named component. If the component has
+ * not yet been instantiated, calling this operation will cause the component instance
+ * to be created and initialized. If the component
+ * has a prototype scope then each call to getComponent will return a new
+ * component instance. If the component has a bundle scope then the component
+ * instance returned will be the instance for the caller's bundle (and that
+ * instance will be instantiated if it has not already been created).
+ *
+ * Note: calling getComponent from logic executing during the instantiation and
+ * configuration of a component, before the init method (if specified) has returned,
+ * may trigger a circular dependency (for a trivial example, consider a component
+ * that looks itself up by name during its init method). Implementations of the
+ * Blueprint Service are not required to support cycles in the dependency graph
+ * and may throw an exception if a cycle is detected. Implementations that can
+ * support certain kinds of cycles are free to do so.
+ *
+ * @param id the name of the component for which the instance is to be
+ * retrieved.
+ *
+ * @return the component instance, the type of the returned object is
+ * dependent on the component definition, and may be determined by
+ * introspecting the component metadata.
+ *
+ * @throws NoSuchComponentException if the name specified is not the
+ * name of a component within the context.
+ */
+ Object getComponentInstance(String id);
+
+ /**
+ * Get the component metadata for a given named component.
+ *
+ * @param id the name of the component for which the metadata is to be
+ * retrieved.
+ *
+ * @return the component metadata for the component.
+ *
+ * @throws NoSuchComponentException if the name specified is not the
+ * name of a component within the context.
+ */
+ ComponentMetadata getComponentMetadata(String id);
+
+ /**
+ * Returns all ComponentMetadata instances of the given type. The supported
+ * metadata types are ComponentMetadata (which returns the metadata for all defined
+ * component types), BeanMetadata, ServiceReferenceMetadata (which returns both
+ * ReferenceMetadata and RefListMetadata instances), ReferenceMetadata,
+ * RefListMetadata, and ServiceMetadata. The collection will include all
+ * metadata instances of the requested type, including components that are declared
+ * as inline values.
+ *
+ * @return an immutable collection of ComponentMetadata objects of the matching type.
+ */
+ <T extends ComponentMetadata> Collection<T> getMetadata(Class<T>
type);
+
+ /**
+ * Get the bundle context of the bundle this blueprint context is associated
+ * with.
+ *
+ * @return the blueprint context's bundle context
+ */
+ BundleContext getBundleContext();
+
+
+ /**
+ * Returns the compliance rule in effect for the target
+ * BlueprintContainer. COMPLIANCE_LOOSE is returned if
+ * any configuration file for the container specifies
+ * loose compliance.
+ *
+ * @return The value COMPLIANCE_STRICT if strict compliance (the
+ * default) is used for all configuration files, or the
+ * value COMPLIANCE_LOOSE if loose complance is specified
+ * in any of the configuration files.
+ */
+ int getCompliance();
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,316 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A Blueprint Event.
+ *
+ * <p>
+ * <code>BlueprintEvent</code> objects are delivered to all registered
<code>BlueprintListener</code>
+ * service objects. BlueprintEvents must be asynchronously delivered in chronological
order
+ * with respect to each listener.
+ *
+ * <p>
+ * In addition, when a listener is registered, the blueprint extender
+ * will synchronously send to this listener the last event for each blueprint bundle
managed
+ * by this extender. This replay of events is designed so that the new listener can
+ * be informed of the state of each managed bundle. Events sent during this replay will
+ * have the {@link #replay} flag set. The blueprint extender must ensure that this replay
phase
+ * does not interfere with new events so that the chronological order of all events
received
+ * by the listener is preserved. If the last event for a given blueprint bundle is
DESTROYED,
+ * the extender must not send it during this replay phase.
+ *
+ * <p>
+ * A type code is used to identify the type of event. The following event types are
defined:
+ * <ul>
+ * <li>{@link #CREATING}
+ * <li>{@link #CREATED}
+ * <li>{@link #DESTROYING}
+ * <li>{@link #DESTROYED}
+ * <li>{@link #FAILURE}
+ * <li>{@link #GRACE_PERIOD}
+ * <li>{@link #WAITING}
+ * </ul>
+ *
+ * <p>
+ * <h2>Blueprint Events and EventAdmin</h2>
+ * In addition to calling the registered {@link BlueprintListener}s, the blueprint
extender
+ * must also send those events to the EventAdmin service, if it is available.
<br/>
+ * See {@link EventConstants} for more informations.
+ *
+ * @see BlueprintListener
+ * @see EventConstants
+ */
+public class BlueprintEvent {
+
+ /**
+ * The Blueprint extender has started creating a Blueprint Container for the bundle.
+ */
+ public static final int CREATING = 1;
+ /**
+ * The Blueprint extender has creating a Blueprint Container for the bundle.
+ * This event is sent after the BlueprintContainer service has been registered.
+ */
+ public static final int CREATED = 2;
+ /**
+ * The Blueprint extender has started detroying the Blueprint Container for the bundle.
+ */
+ public static final int DESTROYING = 3;
+ /**
+ * The Blueprint Container for the bundle has been completely destroyed.
+ * This event is sent after the BlueprintContainer service has been unregistered.
+ */
+ public static final int DESTROYED = 4;
+ /**
+ * The Blueprint Container creation for the bundle has failed.
+ * If this event is sent after a timeout in the Grace Period, the {@link
#getDependencies()}
+ * method must return an array of missing mandatory dependencies. The event must also
contain
+ * the cause of the failure as a <code>Throwable</code> through the {@link
#getException()} method.
+ */
+ public static final int FAILURE = 5;
+ /**
+ * The Blueprint Container has entered the Grace Period.
+ * The list of missing dependencies must be made available through the {@link
#getDependencies()}
+ * method. During the grace period, a GRACE_PERIOD event is sent each time the set of
+ * unsatisfied dependencies changes.
+ */
+ public static final int GRACE_PERIOD = 6;
+ /**
+ * The Blueprint Extender is waiting on the availability of a service to satisfy an
+ * invocation on a referenced service.
+ * The missing dependency must be made available through the {@link #getDependencies()}
+ * method which will return an array containing one filter object as a String.
+ */
+ public static final int WAITING = 7;
+
+
+ /**
+ * Type of this event.
+ *
+ * @see #getType()
+ */
+ private final int type;
+ /**
+ * The time when the event occured.
+ *
+ * @see #getTimestamp()
+ */
+ private final long timestamp;
+ /**
+ * The blueprint bundle.
+ *
+ * @see #getBundle()
+ */
+ private final Bundle bundle;
+ /**
+ * The blueprint extender bundle.
+ *
+ * @see #getExtenderBundle()
+ */
+ private final Bundle extenderBundle;
+ /**
+ * An array containing filters identifying the missing dependencies.
+ *
+ * @see #getDependencies()
+ */
+ private final String[] dependencies;
+ /**
+ * Cause of the failure.
+ *
+ * @see #getException()
+ */
+ private final Throwable exception;
+ /**
+ * Indicate if this event is a replay event or not.
+ *
+ * @see #isReplay()
+ */
+ private final boolean replay;
+
+
+ /**
+ * Create a simple BlueprintEvent object.
+ *
+ * @param type The type of the event.
+ * @param bundle The managed bundle this event is originating from.
+ * @param extenderBundle
+ * The bundle of the blueprint extender that is generating
+ * the event.
+ */
+ public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle) {
+ this(type, bundle, extenderBundle, null, null);
+ }
+
+
+ /**
+ * Create a BlueprintEvent object associated with a
+ * set of dependencies.
+ *
+ * @param type The type of the event.
+ * @param bundle The managed bundle this event is originating from.
+ * @param extenderBundle
+ * The bundle of the blueprint extender that is generating
+ * the event.
+ * @param dependencies
+ * An array of String filters for each dependency associated
+ * with this event.
+ */
+ public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, String[]
dependencies) {
+ this(type, bundle, extenderBundle, dependencies, null);
+ }
+
+
+ /**
+ * Create a BlueprintEvent object associated with a
+ * failure cause.
+ *
+ * @param type The type of the event.
+ * @param bundle The managed bundle this event is originating from.
+ * @param extenderBundle
+ * The bundle of the blueprint extender that is generating
+ * the event.
+ * @param exception A Throwable object describing the root cause of the
+ * event.
+ */
+ public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, Throwable
exception) {
+ this(type, bundle, extenderBundle, null, exception);
+ }
+
+
+ /**
+ * Create a BlueprintEvent object associated with a
+ * failure cause and related to a set of dependencies.
+ *
+ * @param type The type of the event.
+ * @param bundle The managed bundle this event is originating from.
+ * @param extenderBundle
+ * The bundle of the blueprint extender that is generating
+ * the event.
+ * @param dependencies
+ * An array of String filters for each dependency associated
+ * with this event.
+ * @param exception A Throwable object describing the root cause of the
+ * event.
+ */
+ public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, String[]
dependencies, Throwable exception) {
+ this.type = type;
+ this.timestamp = System.currentTimeMillis();
+ this.bundle = bundle;
+ this.extenderBundle = extenderBundle;
+ this.dependencies = dependencies;
+ this.exception = exception;
+ this.replay = false;
+ }
+
+ /**
+ * Create a new blueprint event from the given blueprint event.
+ * The timestamp property will be copied from the original event and only the
+ * replay property will be overriden with the given value.
+ *
+ * @param event the original event to copy
+ * @param replay if the copied event should be used as a replay event
+ */
+ public BlueprintEvent(BlueprintEvent event, boolean replay) {
+ this.type = event.type;
+ this.timestamp = event.timestamp;
+ this.bundle = event.bundle;
+ this.extenderBundle = event.extenderBundle;
+ this.dependencies = event.dependencies;
+ this.exception = event.exception;
+ this.replay = replay;
+ }
+
+ /**
+ * Return the type of this event.
+ * <p>
+ * The type values are:
+ * <ul>
+ * <li>{@link #CREATING}
+ * <li>{@link #CREATED}
+ * <li>{@link #DESTROYING}
+ * <li>{@link #DESTROYED}
+ * <li>{@link #FAILURE}
+ * <li>{@link #GRACE_PERIOD}
+ * <li>{@link #WAITING}
+ * </ul>
+ *
+ * @return The type of this event.
+ */
+ public int getType() {
+ return type;
+ }
+
+ /**
+ * Return the time at which this event occured.
+ *
+ * @return The time at which this event occured.
+ */
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Return the blueprint bundle.
+ *
+ * @return The blueprint bundle. Never <code>null</code>.
+ */
+ public Bundle getBundle() {
+ return bundle;
+ }
+
+ /**
+ * Return the Bundle of the blueprint extender.
+ *
+ * @return The Bundle of the blueprint extender. Never <code>null</code>.
+ */
+ public Bundle getExtenderBundle() {
+ return extenderBundle;
+ }
+
+ /**
+ * Return the filters identifying the missing dependencies that caused this event.
+ * <p>
+ * This field is only valid for {@link #WAITING},
+ * {@link #GRACE_PERIOD} and {@link #FAILURE}
+ * events.
+ *
+ * @return The missing dependencies informations. May be
<code>null</code>.
+ */
+ public String[] getDependencies() {
+ return dependencies;
+ }
+
+ /**
+ * Return the cause for a {@link #FAILURE} event.
+ *
+ * @return The cause of the failure. May be <code>null</code>.
+ */
+ public Throwable getException() {
+ return exception;
+ }
+
+ /**
+ * Return the fact that this event is a replay event or not.
+ *
+ * @return a boolean indicating if this event is a replay event.
+ */
+ public boolean isReplay() {
+ return replay;
+ }
+
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+/**
+ * Listener for <code>BlueprintEvent</code>s.
+ *
+ * @see BlueprintEvent
+ */
+public interface BlueprintListener {
+
+ /**
+ * Receives notifications of a blueprint event.
+ *
+ * @param event The <code>BlueprintEvent</code>.
+ */
+ void blueprintEvent(BlueprintEvent event);
+
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+/**
+ * Exception thrown when a configuration-related error occurs during
+ * creation of a module context.
+ */
+public class ComponentDefinitionException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with no message or
+ * exception cause.
+ */
+ public ComponentDefinitionException() {
+ super();
+ }
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with the specified
message
+ *
+ * @param msg The associated message.
+ */
+ public ComponentDefinitionException(String explanation) {
+ super(explanation);
+ }
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with the specified
message and
+ * exception cause.
+ *
+ * @param msg The associated message.
+ * @param cause The cause of this exception.
+ */
+ public ComponentDefinitionException(String explanation, Throwable cause) {
+ super(explanation, cause);
+ }
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with the
+ * exception cause.
+ *
+ * @param cause The cause of this exception.
+ */
+ public ComponentDefinitionException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/Converter.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/Converter.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/Converter.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+/**
+ * Provides access to the type conversions (both predefined and user registered)
+ * that are defined for the blueprint container.
+ */
+public interface Converter {
+
+ /**
+ * Check if the converter is able to convert the given value to the specified
+ * type.
+ *
+ * @return <code>true</code> if the conversion is possible,
<code>false</code> otherwise.
+ */
+ boolean canConvert(Object fromValue, Class<?> toType);
+
+ /**
+ * Convert an object to an instance of the given class, using the built-in and
+ * user-registered type converters as necessary.
+ * @param fromValue the object to be converted
+ * @param toType the type that the instance is to be converted to
+ * @return an instance of the class 'toType'
+ * @throws Exception if the conversion cannot succeed. This exception is
+ * checked because callers should expect that not all source objects
+ * can be successfully converted.
+ */
+ Object convert(Object fromValue, Class<?> toType) throws Exception;
+
+}
\ No newline at end of file
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/Converter.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/EventConstants.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Event property names used in EventAdmin events published for a
+ * blueprint container.
+ *
+ * Each type of event is sent to a different topic:<br/>
+ * <pre>
+ * org/osgi/service/blueprint/container/<event-type>
+ * </pre>
+ * where <code><event-type></code> can have the values
<code>CREATING</code>, <code>CREATED</code>,
+ * <code>DESTROYING</code>, <code>DESTROYED</code>,
<code>FAILURE</code>, <code>GRACE_PERIOD</code> or
+ * <code>WAITING</code>. <br/>
+ * Such events have the following properties:<ul>
+ * <li><code>type<code>
+ * <li><code>event<code>
+ * <li><code>timestamp<code>
+ * <li><code>bundle<code>
+ * <li><code>bundle.symbolicName<code>
+ * <li><code>bundle.id<code>
+ * <li><code>bundle.version<code>
+ * <li><code>extender.bundle<code>
+ * <li><code>extender.bundle.symbolicName<code>
+ * <li><code>extender.bundle.id<code>
+ * <li><code>extender.bundle.version<code>
+ * <li><code>dependencies<code>
+ * <li><code>cause<code>
+ * </ul>
+ */
+public interface EventConstants {
+
+ /**
+ * The type of the event that has been issued.
+ * This property is of type {@link java.lang.Integer} and can take one of the values
defined in {@link BlueprintEvent}.
+ */
+ public static final String TYPE = "type";
+
+ /**
+ * The <code>BlueprintEvent</code> that caused this event.
+ * This property is of type {@link BlueprintEvent}.
+ */
+ public static final String EVENT = "event";
+
+ /**
+ * The type of the event that has been issued.
+ * This property is of type {@link java.lang.Long}.
+ */
+ public static final String TIMESTAMP = "timestamp";
+
+ /**
+ * The bundle property defining the blueprint bundle for which an event has been
issued.
+ * This property is of type {@link org.osgi.framework.Bundle}.
+ *
+ * @see Bundle
+ */
+ public static final String BUNDLE = "bundle";
+
+ /**
+ * The bundle id property defining the id of the blueprint bundle for which an event
has been issued.
+ * This property is of type {@link java.lang.Integer}.
+ */
+ public static final String BUNDLE_ID = "bundle.id";
+
+ /**
+ * The bundle symbolic name property defining the symbolic name of
+ * the blueprint bundle for which an event has been issued.
+ * This property is of type {@link java.lang.String}.
+ */
+ public static final String BUNDLE_SYMBOLICNAME = "bundle.symbolicName";
+
+ /**
+ * The bundle id property defining the id of the blueprint bundle for which an event
has been issued.
+ * This property is of type {@link java.lang.Integer}.
+ */
+ public static final String BUNDLE_VERSION = "bundle.version";
+
+ /**
+ * The extender bundle property defining the extender bundle processing the
+ * blueprint container for which an event has been issued.
+ * This property is of type {@link org.osgi.framework.Bundle}.
+ *
+ * @see Bundle
+ */
+ public static final String EXTENDER_BUNDLE = "extender.bundle";
+
+ /**
+ * The extender bundle id property defining the id of the extender bundle
+ * processing the blueprint container for which an event has been issued.
+ * This property is of type {@link java.lang.Integer}.
+ */
+ public static final String EXTENDER_BUNDLE_ID = "extender.bundle.id";
+
+ /**
+ * The extender bundle symbolic name property defining the symbolic name of
+ * the extender bundle processing the blueprint container for which an event
+ * has been issued.
+ * This property is of type {@link java.lang.String}.
+ */
+ public static final String EXTENDER_BUNDLE_SYMBOLICNAME =
"extender.bundle.symbolicName";
+
+ /**
+ * The extender bundle version property defining the version of the extender bundle
+ * processing the blueprint container for which an event has been issued.
+ * This property is of type {@link java.lang.Integer}.
+ */
+ public static final String EXTENDER_BUNDLE_VERSION =
"extender.bundle.version";
+
+ /**
+ * The dependencies property containing an array of filters describing the missing
+ * mandatory dependencies for a FAILED, GRACE_PERIOD or WAITING event.
+ * This property is an array of {@link java.lang.String}.
+ */
+ public static final String DEPENDENCIES = "dependencies";
+
+ /**
+ * The exception property containing the cause for a FAILED event.
+ * This property is of type {@link java.lang.Throwable}.
+ */
+ public static final String EXCEPTION = "exception";
+
+ /**
+ * Topic prefix for all events issued by the Blueprint Service
+ */
+ public static final String TOPIC_BLUEPRINT_EVENTS =
"org/osgi/service/blueprint";
+
+ /**
+ * Topic for Blueprint Container CREATING events
+ */
+ public static final String TOPIC_CREATING = TOPIC_BLUEPRINT_EVENTS +
"/container/CREATING";
+
+ /**
+ * Topic for Blueprint Container CREATED events
+ */
+ public static final String TOPIC_CREATED = TOPIC_BLUEPRINT_EVENTS +
"/container/CREATED";
+
+ /**
+ * Topic for Blueprint Container DESTROYING events
+ */
+ public static final String TOPIC_DESTROYING = TOPIC_BLUEPRINT_EVENTS +
"/container/DESTROYING";
+
+ /**
+ * Topic for Blueprint Container DESTROYED events
+ */
+ public static final String TOPIC_DESTROYED = TOPIC_BLUEPRINT_EVENTS +
"/container/DESTROYED";
+
+ /**
+ * Topic for Blueprint Container FAILURE events
+ */
+ public static final String TOPIC_FAILURE = TOPIC_BLUEPRINT_EVENTS +
"/container/FAILURE";
+
+ /**
+ * Topic for Blueprint Container GRACE_PERIOD events
+ */
+ public static final String TOPIC_GRACE_PERIOD = TOPIC_BLUEPRINT_EVENTS +
"/container/GRACE_PERIOD";
+
+ /**
+ * Topic for Blueprint Container WAITING events
+ */
+ public static final String TOPIC_WAITING = TOPIC_BLUEPRINT_EVENTS +
"/container/WAITING";
+
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+/**
+ * Thrown when an attempt is made to lookup a component by name and no such named
+ * component exists in the blueprint container.
+ */
+public class NoSuchComponentException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The name of the component request that generated the
+ * exception.
+ */
+ private final String componentName;
+
+ /**
+ * Create an exception for a single component name request.
+ *
+ * @param componentName
+ * The name of the non-existent component.
+ */
+ public NoSuchComponentException(String componentName) {
+ this.componentName = componentName;
+ }
+
+ /**
+ * Returns the component name that generated the exception.
+ *
+ * @return The String name of the component associated with an unresolved
+ * request.
+ */
+ public String getComponentName() {
+ return this.componentName;
+ }
+
+ /**
+ * Returns a human readable message associated with the exception.
+ *
+ * @return The descriptive message for the exception.
+ */
+ public String getMessage() {
+ return "No component named '" +
+ (this.componentName == null ? "<null>" : this.componentName) +
+ "' could be found";
+ }
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.container;
+
+import org.osgi.framework.ServiceException;
+
+/**
+ * Thrown when an invocation is made on an OSGi service reference component, and
+ * a backing service is not available.
+ */
+public class ServiceUnavailableException extends ServiceException {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The filter string associated with the exception.
+ */
+ private final String filter;
+
+
+ /**
+ * Creates a <code>ServiceUnavaiableException</code> with the specified
message.
+ *
+ * @param message The associated message.
+ * @param filterExpression
+ * The filter expression used for the service lookup.
+ */
+ public ServiceUnavailableException(String message, String filterExpression) {
+ super(message, UNREGISTERED);
+ this.filter = filterExpression;
+ }
+
+
+ /**
+ * Creates a <code>ServiceUnavaiableException</code> with the specified
message and
+ * exception cause.
+ *
+ * @param message The associated message.
+ * @param filterExpression
+ * The filter expression used for the service lookup.
+ * @param cause The cause of this exception.
+ */
+ public ServiceUnavailableException(String message, String filterExpression, Throwable
cause) {
+ super(message, UNREGISTERED, cause);
+ this.filter = filterExpression;
+ }
+
+ /**
+ * Returns the filter expression that a service would have needed to satisfy in order
+ * for the invocation to proceed.
+ *
+ * @return The failing filter expression.
+ */
+ public String getFilter() {
+ return this.filter;
+ }
+}
+
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/package.html
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/package.html
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/package.html 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,21 @@
+<!-- $Revision: 5654 $ -->
+<BODY>
+<p>Blueprint Service Container Package Version 1.0.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.service.blueprint.container;
version="[1.0,2.0)"
+</pre>
+<p>
+ This package defines the primary interface to a blueprint container,
+ <code>BlueprintContainer</code>. An instance of this type is available
+ inside a blueprint context as an implicitly defined component with name
+ "blueprintContainer".
+</p>
+<p>
+ This package also declares the supporting exception types, listener, and constants for
working with a blueprint
+ container.
+</p>
+</BODY>
+
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/packageinfo
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/packageinfo
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/container/packageinfo 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1 @@
+version 1.0
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -26,7 +26,6 @@
static final String SCOPE_SINGLETON = "singleton";
static final String SCOPE_PROTOTYPE = "prototype";
- static final String SCOPE_BUNDLE = "bundle";
/**
* The name of the class type specified for this component.
@@ -47,7 +46,7 @@
* @return the method name of the specified init method, or null if no init
* method was specified.
*/
- String getInitMethodName();
+ String getInitMethod();
/**
* The name of the destroy method specified for this component, if any.
@@ -57,7 +56,7 @@
* @return the method name of the specified destroy method, or null if no
* destroy method was specified.
*/
- String getDestroyMethodName();
+ String getDestroyMethod();
/**
* The arguments for the factory method or constructor.
@@ -66,7 +65,7 @@
*
* @return The metadata for the factory method or constructor. Can be empty if no
arguments are specified
*/
- List<BeanArgument>getArguments();
+ List<BeanArgument> getArguments();
/**
* The property injection metadata for this component.
@@ -79,29 +78,16 @@
* returned.
*
*/
- List<BeanProperty>getProperties();
+ List<BeanProperty> getProperties();
/**
- * Is this component to be lazily instantiated?
- *
- * ### I assume the default is processed here?
- *
- * This is the <code>lazy-init</code> attribute or the
- * <code>default-lazy-init</code> in the <code>blueprint</code>
element
- * if not set. ### I've renamed this from isLazy
- *
- * @return true, iff this component definition specifies lazy instantiation.
- */
- boolean isLazyInit();
-
- /**
* Provides the name of the optional factory method.
*
* This is the <code>factory-method</code> attribute.
*
* @return The name of the factory method or <code>null</code>.
*/
- String getFactoryMethodName();
+ String getFactoryMethod();
/**
* The component instance on which to invoke the factory method (if
@@ -128,7 +114,6 @@
*
* @see #SCOPE_SINGLETON
* @see #SCOPE_PROTOTYPE
- * @see #SCOPE_BUNDLE
*/
String getScope();
@@ -141,13 +126,4 @@
*/
Class<?> getRuntimeClass();
-
- /**
- * The names of any components listed in a "depends-on" attribute for this
- * component.
- *
- * @return an immutable List of component names for components that we have
explicitly
- * declared a dependency on, or an empty set if none.
- */
- List<String> getExplicitDependencies();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -19,7 +19,7 @@
/**
* Metadata for a collection based value. Members of the array are instances of
Metadata.
- * The Collection metadata can constrain (### convert) to a specific type.
+ * The Collection metadata can constrain to a specific type.
*/
public interface CollectionMetadata extends NonNullMetadata {
@@ -39,9 +39,8 @@
* The value-type specified for the array
*
* The <code>value-type</code> attribute.
- * ### Shouldnt this also support getRuntimeValueType()?
*/
- String getValueTypeName();
+ String getValueType();
/**
* The of Metadata objects that describe the value.
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -15,6 +15,8 @@
*/
package org.osgi.service.blueprint.reflect;
+import java.util.List;
+
/**
* Base class for all components.
*
@@ -22,11 +24,45 @@
* @see ServiceReferenceMetadata
* @see ServiceMetadata
*/
-public interface ComponentMetadata extends NonNullMetadata
-{
- /*
- * The id of the component. ### renamed to getId
- * @return component id. The component id can be <code>null</code> if this
is an anonymously defined inner component.
- */
- String getId();
+public interface ComponentMetadata extends NonNullMetadata {
+
+ /**
+ * The component will be eagerly instanciated
+ */
+ static final int INITIALIZATION_EAGER = 1;
+
+ /**
+ * The component will be lazily instanciated
+ */
+ static final int INITIALIZATION_LAZY = 2;
+
+ /**
+ * The id of the component.
+ *
+ * @return component id. The component id can be <code>null</code> if this
is an anonymously
+ * defined inner component.
+ */
+ String getId();
+
+ /**
+ * Is this component to be lazily instantiated?
+ *
+ * This is the <code>initialization</code> attribute or the
+ * <code>default-initialization</code> in the
<code>blueprint</code> element
+ * if not set.
+ *
+ * @return the initialization method
+ * @see #INITIALIZATION_EAGER
+ * @see #INITIALIZATION_LAZY
+ */
+ int getInitialization();
+
+ /**
+ * The names of any components listed in a "depends-on" attribute for this
+ * component.
+ *
+ * @return an immutable List of component names for components that we have
explicitly
+ * declared a dependency on, or an empty set if none.
+ */
+ List<String> getDependsOn();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -23,7 +23,7 @@
public interface IdRefMetadata extends NonNullMetadata {
/**
* The name of the referenced component.
- * Defined in the <code>component</code> attribute.
+ * Defined in the <code>component-id</code> attribute.
*
*/
String getComponentId();
Deleted:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/Listener.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/Listener.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/Listener.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.osgi.service.blueprint.reflect;
-
-/**
- * Metadata for a listener interested in service bind and unbind events for a service
- * reference.
- */
-public interface Listener {
-
- /**
- * The component instance that will receive bind and unbind
- * events. The returned value must reference a TargetListenerComponent
- * either directly or indirectly. The return type will be either
- * a RefMetadata instance or an TargetListenerComponent instance.
- *
- * Defined in the <code>ref</code> attribute or inlined component.
- *
- * @return the listener component reference.
- */
- Target getListenerComponent();
-
- /**
- * The name of the method to invoke on the listener component when
- * a matching service is bound to the reference
- *
- * @return the bind callback method name.
- */
- String getBindMethodName();
-
- /**
- * The name of the method to invoke on the listener component when
- * a service is unbound from the reference.
- *
- * @return the unbind callback method name.
- */
- String getUnbindMethodName();
-}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -31,7 +31,8 @@
*
* @return the metadata for the key
*/
- NonNullMetadata getKey();
+ // [TDI] NonNullMetadata getKey();
+ String getKey();
/**
* Return the metadata for the value.
@@ -40,6 +41,6 @@
*
* @return the metadata for the value
*/
-
- Metadata getValue();
+ // [TDI] Metadata getValue();
+ String getValue();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -19,28 +19,27 @@
/**
* A map-based value. This represented as a collection of entries (as it is done in the
schema).
- *
+ *
* A map is defined in the <code>map</code> element.
- *
+ *
*/
-public interface MapMetadata extends NonNullMetadata
-{
- /**
- * The key-type specified for map keys, or null if none given
- *
- * Defined in the <code>key-type</code> attribute. ### should we have
getRuntimeKeyType?
- */
- String getKeyTypeName();
+public interface MapMetadata extends NonNullMetadata {
+ /**
+ * The key-type specified for map keys, or null if none given
+ *
+ * Defined in the <code>key-type</code> attribute.
+ */
+ String getKeyType();
- /**
- * The value-type specified for the array
- *
- * ### should we have getRuntimeValueType? The <code>value-type</code>
attribute.
- */
- String getValueTypeName();
+ /**
+ * The value-type specified for the array
+ *
+ * The <code>value-type</code> attribute.
+ */
+ String getValueType();
- /**
- * The of Metadata objects that describe the value.
- */
- List<MapEntry> getEntries();
+ /**
+ * The of Metadata objects that describe the value.
+ */
+ List<MapEntry> getEntries();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -20,5 +20,8 @@
*/
public interface NullMetadata extends Metadata {
+ /**
+ * Singleton instance of the NULL metadata.
+ */
static final NullMetadata NULL = new NullMetadata() {};
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -21,10 +21,6 @@
* A java.util.Properties based value. The properties are defined as string to
* string. This means that the actual value can be returned.
*
- * ### I do not like it that you loose the original order. And potential errors
- * (like duplicate keys). I think this one should just go away. The
- * CollectionMetadata has a collection type so the instantiation can ensure
- *
* Defined in the <code>props</code> element.
*
*/
Deleted:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefCollectionMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefCollectionMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefCollectionMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.osgi.service.blueprint.reflect;
-
-/**
- * Service reference that binds to a collection of matching services from the
- * OSGi service registry. This is the <code>ref-list</code> or
- * <code>ref-set</code> element.
- *
- */
-public interface RefCollectionMetadata extends ServiceReferenceMetadata {
-
- /**
- * Create ordering based on comparison of service objects.
- */
- public static final int ORDERING_BASIS_SERVICE= 1;
-
- /**
- * Create ordering based on comparison of service reference objects.
- */
- public static final int ORDERING_BASIS_SERVICE_REFERENCE = 2;
-
- /**
- * Collection contains service instances
- *
- */
- public static final int MEMBER_TYPE_SERVICE_INSTANCE = 1;
-
- /**
- * Collection contains service references
- */
- public static final int MEMBER_TYPE_SERVICE_REFERENCE = 2;
-
- /**
- * The type of collection to be created.
- *
- * This is implied by the element name: <code>ref-list</code> or
<code>ref-set</code>.
- *
- * @return Class object for the specified collection type (List, Set).
- */
- Class<?> getCollectionType();
-
- /**
- * The comparator specified for ordering the collection, or
<code>null</code> if no
- * comparator was specified.
- *
- * Defined in the <code>comparator</code> child element or
<code>comparator-ref</code>
- * attribute.
- *
- * @return if a comparator was specified then a Value object identifying the
- * comparator (a ComponentValue, ReferenceValue, or
- * ReferenceNameValue) is returned. If no comparator was specified
- * then null will be returned.
- */
- Target getComparator();
-
- /**
- * The basis on which to perform ordering, if specified.
- *
- * Defined in the <code>ordering-basis</code> attribute.
- *
- * @return one of ORDERING_BASIS_SERVICES and ORDERING_BASIS_SERVICE_REFERENCE
- */
- int getOrderingBasis();
-
- /**
- * Whether the collection will contain service instances, or service
- * references
- * Defined in the <code>member-type</code> attribute.
- */
- int getMemberType();
-}
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.reflect;
+
+/**
+ * Service reference that binds to a collection of matching services from the
+ * OSGi service registry. This is the <code>ref-list</code> or
+ * <code>ref-set</code> element.
+ *
+ */
+public interface RefListMetadata extends ServiceReferenceMetadata {
+
+ /**
+ * Use the service objects to compare or include in the collection
+ */
+ public static final int USE_SERVICE_OBJECT = 1;
+
+ /**
+ * Use the service references to compare or include in the collection
+ */
+ public static final int USE_SERVICE_REFERENCE = 2;
+
+ /**
+ * Whether the collection will contain service objects, or service
+ * references
+ * Defined in the <code>member-type</code> attribute.
+ *
+ * @return one of USE_SERVICE_OBJECT and USE_SERVICE_REFERENCE
+ * @see #USE_SERVICE_OBJECT
+ * @see #USE_SERVICE_REFERENCE
+ */
+ int getMemberType();
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -21,7 +21,7 @@
public interface RefMetadata extends Target, NonNullMetadata {
/**
* The name of the referenced component.
- * Defined in the <code>component</code> attribute.
+ * Defined in the <code>component-id</code> attribute.
*
*/
String getComponentId();
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.osgi.service.blueprint.reflect;
+
+/**
+ * Metadata for a listener interested in service bind and unbind events for a service
+ * reference.
+ */
+public interface ReferenceListener {
+
+ /**
+ * The component instance that will receive bind and unbind
+ * events. The returned value must reference a TargetListenerComponent
+ * either directly or indirectly. The return type will be either
+ * a RefMetadata instance or an TargetListenerComponent instance.
+ *
+ * Defined in the <code>ref</code> attribute or inlined component.
+ *
+ * @return the listener component reference.
+ */
+ Target getListenerComponent();
+
+ /**
+ * The name of the method to invoke on the listener component when
+ * a matching service is bound to the reference
+ *
+ * @return the bind callback method name.
+ */
+ String getBindMethod();
+
+ /**
+ * The name of the method to invoke on the listener component when
+ * a service is unbound from the reference.
+ *
+ * @return the unbind callback method name.
+ */
+ String getUnbindMethod();
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -23,8 +23,7 @@
* Defines the <code>reference</code> element.
*
*/
-public interface ReferenceMetadata extends ServiceReferenceMetadata,
- Target {
+public interface ReferenceMetadata extends ServiceReferenceMetadata, Target {
/**
* Timeout for service invocations when a matching backing service is
@@ -34,5 +33,4 @@
* @return service invocation timeout in milliseconds
*/
long getTimeout();
-
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -41,7 +41,7 @@
*
* @return the registration callback method name.
*/
- String getRegistrationMethodName();
+ String getRegistrationMethod();
/**
* The name of the method to invoke on the listener component when
@@ -51,6 +51,6 @@
*
* @return the unregistration callback method name.
*/
- String getUnregistrationMethodName();
+ String getUnregistrationMethod();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -18,9 +18,7 @@
import java.util.Collection;
import java.util.List;
-import org.jboss.osgi.blueprint.reflect.ServicePropertyEntry;
-
/**
* Metadata representing a service to be exported by a module context.
*
@@ -52,7 +50,7 @@
/**
* The component that is to be exported as a service. Value must refer to a component
and
- * therefore be either a RefMetadata or BeanMetadata.
+ * therefore be either a RefMetadata, BeanMetadata, or ReferenceMetadata.
*
* Defined in the <code>registration-method</code> attribute.
*
@@ -68,7 +66,7 @@
*
* @return an immutable set of (String) type names, or an empty set if using
auto-export
*/
- List<String> getInterfaceNames();
+ List<String> getInterfaces();
/**
* Return the auto-export mode specified.
@@ -77,7 +75,7 @@
*
* @return One of AUTO_EXPORT_DISABLED, AUTO_EXPORT_INTERFACES,
AUTO_EXPORT_CLASS_HIERARCHY, AUTO_EXPORT_ALL_CLASSES
*/
- int getAutoExportMode();
+ int getAutoExport();
/**
* The user declared properties to be advertised with the service.
@@ -87,7 +85,7 @@
* @return Map containing the set of user declared service properties (may be
* empty if no properties were specified).
*/
- List<ServicePropertyEntry> getServiceProperties();
+ List<MapEntry> getServiceProperties();
/**
* The ranking value to use when advertising the service
@@ -107,13 +105,4 @@
* @return an immutable collection of RegistrationListenerMetadata
*/
Collection<RegistrationListener> getRegistrationListeners();
-
- /**
- * The names of any components listed in a "depends-on" attribute for this
- * component.
- *
- * @return an immutable List of component names for components that we have
explicitly
- * declared a dependency on, or an empty set if none.
- */
- List<String> getExplicitDependencies();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -16,7 +16,6 @@
package org.osgi.service.blueprint.reflect;
import java.util.Collection;
-import java.util.List;
/**
@@ -46,19 +45,18 @@
int getAvailability();
/**
- * The interface types that the matching service must support
+ * The interface type that the matching service must support
*
- * Defined in the <code>interface</code> attribute or
<code>interfaces</code> element.
- *
- * @return an immutable list of type names
+ * Defined in the <code>interface</code> attribute.
+ * @return the String name of the requested service interface
*/
- List<String> getInterfaceNames();
+ String getInterface();
/**
* The value of the component-name attribute, if specified. This specifies
* the name of a component that is registered in the service registry. This will
* create an automatic filter (appended wit the filter if set) to select this
- * component based on its automatic ###name attribute.
+ * component based on its automatic id attribute.
*
* Defined in the <code>component-name</code> attribute.
*
@@ -81,8 +79,8 @@
*
* Defined in the <code>listener</code> elements.
*
- * @return an immutable collection of registered ListenerMetadata
+ * @return an immutable collection of ReferenceListener objects
*/
- Collection<Listener> getServiceListeners();
+ Collection<ReferenceListener> getReferenceListeners();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -32,8 +32,7 @@
/**
* The name of the type to which this value should be coerced. May be null.
- *
* Defined in the <code>type</code> attribute.
*/
- String getTypeName();
+ String getType();
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/package.html
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/package.html 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/osgi/service/blueprint/reflect/package.html 2009-06-17
13:32:50 UTC (rev 90329)
@@ -13,23 +13,23 @@
<pre>
Configuration Element Corresponding Reflection Type(s)
- component LocalComponentMetadata, ComponentValue
- reference UnaryServiceReferenceComponentMetadata
- ref-set,ref-list CollectionBasedServiceReferenceComponentMetadata
- service ServiceExportComponentMetadata
- constructor-arg ConstructorInjectionMetadata, ParameterSpecification
- property PropertyInjectionMetadata
- listener BindingListenerMetadata
+ bean BeanMetadata
+ reference ReferenceMetadata
+ ref-list RefListMetadata
+ service ServiceMetadata
+ argument BeanArgumentMetadata
+ property BeanPropertyMetadata
+ listener ListenerMetadata
registration-listener RegistrationListenerMetadata
- array< ArrayValue
- ref ReferenceValue
- id-ref ReferenceNameValue
- list ListValue
- map MapValue
- null NullValue
- props PropertiesValue
- set SetValue
- value TypedStringValue
+ array< CollectionMetadata
+ ref RefMetadata
+ id-ref IdrefMetadata
+ list CollectionMetadata
+ map MapMetadata
+ null NullMetadata
+ props PropsMetadata
+ set CollectionMetadata
+ value ValueMetadata
<//pre>
</BODY>
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java 2009-06-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/context/BlueprintContextTestCase.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -54,14 +54,14 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.blueprint.context.BlueprintContext;
+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;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
/**
- * BlueprintContext API tests
+ * BlueprintContainer API tests
*
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
@@ -118,8 +118,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- assertNotNull("BlueprintContext available", bpContext);
+ BlueprintContainer bpContext = getBlueprintContext();
+ assertNotNull("BlueprintContainer available", bpContext);
}
@@ -131,8 +131,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- Collection<BeanMetadata> bcMetadata = bpContext.getBeanComponentsMetadata();
+ BlueprintContainer bpContext = getBlueprintContext();
+ Collection<BeanMetadata> bcMetadata =
bpContext.getMetadata(BeanMetadata.class);
assertNotNull("BeanComponentsMetadata not null", bcMetadata);
assertEquals("BeanComponentsMetadata size", 1, bcMetadata.size());
@@ -150,7 +150,7 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
+ BlueprintContainer bpContext = getBlueprintContext();
BundleContext bndContext = bpContext.getBundleContext();
assertNotNull("BundleContext not null", bndContext);
@@ -167,8 +167,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- bpContext.getComponent("beanA");
+ BlueprintContainer bpContext = getBlueprintContext();
+ bpContext.getComponentInstance("beanA");
}
@Test
@@ -179,7 +179,7 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
+ BlueprintContainer bpContext = getBlueprintContext();
ComponentMetadata compMetadata =
bpContext.getComponentMetadata("beanA");
assertNotNull("ComponentMetadata not null", compMetadata);
@@ -194,8 +194,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- Set<String> compNames = bpContext.getComponentNames();
+ BlueprintContainer bpContext = getBlueprintContext();
+ Set<String> compNames = bpContext.getComponentIds();
assertNotNull("ComponentNames not null", compNames);
assertEquals("ComponentNames size", 4, compNames.size());
@@ -213,8 +213,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- Collection<ServiceMetadata> servicesMetadata =
bpContext.getExportedServicesMetadata();
+ BlueprintContainer bpContext = getBlueprintContext();
+ Collection<ServiceMetadata> servicesMetadata =
bpContext.getMetadata(ServiceMetadata.class);
assertNotNull("ServiceMetadata not null", servicesMetadata);
assertEquals("ServiceMetadata size", 2, servicesMetadata.size());
@@ -223,7 +223,7 @@
ServiceMetadata serviceA = itServices.next();
assertEquals("serviceA", serviceA.getId());
- List<String> interfaceNamesA = serviceA.getInterfaceNames();
+ List<String> interfaceNamesA = serviceA.getInterfaces();
assertNotNull("InterfaceNames not null", interfaceNamesA);
assertEquals("InterfaceNames size", 1, interfaceNamesA.size());
assertEquals("InterfaceName", ServiceA.class.getName(),
interfaceNamesA.get(0));
@@ -231,7 +231,7 @@
ServiceMetadata serviceB = itServices.next();
assertEquals("serviceB", serviceB.getId());
- List<String> interfaceNamesB = serviceB.getInterfaceNames();
+ List<String> interfaceNamesB = serviceB.getInterfaces();
assertNotNull("InterfaceNames not null", interfaceNamesB);
assertEquals("InterfaceNames size", 1, interfaceNamesB.size());
assertEquals("InterfaceName", ServiceB.class.getName(),
interfaceNamesB.get(0));
@@ -245,8 +245,8 @@
assumeNotNull(context);
- BlueprintContext bpContext = getBlueprintContext();
- Collection<ServiceReferenceMetadata> srefsMetadata =
bpContext.getReferencedServicesMetadata();
+ BlueprintContainer bpContext = getBlueprintContext();
+ Collection<ServiceReferenceMetadata> srefsMetadata =
bpContext.getMetadata(ServiceReferenceMetadata.class);
assertNotNull("ServiceReferenceMetadata not null", srefsMetadata);
assertEquals("ServiceReferenceMetadata size", 1, srefsMetadata.size());
@@ -254,16 +254,15 @@
ServiceReferenceMetadata srefMetadata = srefsMetadata.iterator().next();
assertEquals("mbeanService", srefMetadata.getId());
- List<String> interfaceNames = srefMetadata.getInterfaceNames();
- assertNotNull("InterfaceNames not null", interfaceNames);
- assertEquals("InterfaceNames size", 1, interfaceNames.size());
- assertEquals("InterfaceName", MBeanServer.class.getName(),
interfaceNames.get(0));
+ String interfaceName = srefMetadata.getInterface();
+ assertNotNull("InterfaceName not null", interfaceName);
+ assertEquals("InterfaceName", MBeanServer.class.getName(),
interfaceName);
}
- private BlueprintContext getBlueprintContext()
+ private BlueprintContainer getBlueprintContext()
{
- ServiceReference sref =
context.getServiceReference(BlueprintContext.class.getName());
- BlueprintContext bpContext = (BlueprintContext)context.getService(sref);
+ ServiceReference sref =
context.getServiceReference(BlueprintContainer.class.getName());
+ BlueprintContainer bpContext = (BlueprintContainer)context.getService(sref);
return bpContext;
}
}
\ No newline at end of file
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/AllElementsParserTestCase.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -113,7 +113,7 @@
@Test
public void getExportedServicesMetadata() throws Exception
{
- Collection<ServiceMetadata> services =
blueprint.getExportedServicesMetadata();
+ Collection<ServiceMetadata> services =
blueprint.getMetadata(ServiceMetadata.class);
assertNotNull("ServiceMetadata not null", services);
assertEquals("ServiceMetadata size", 2, services.size());
}
@@ -121,7 +121,7 @@
@Test
public void getReferencedServicesMetadata() throws Exception
{
- Collection<ServiceReferenceMetadata> serviceRefs =
blueprint.getReferencedServicesMetadata();
+ Collection<ServiceReferenceMetadata> serviceRefs =
blueprint.getMetadata(ServiceReferenceMetadata.class);
assertNotNull("ServiceReferenceMetadata not null", serviceRefs);
assertEquals("ServiceReferenceMetadata size", 3, serviceRefs.size());
}
@@ -129,7 +129,7 @@
@Test
public void getBeanComponentsMetadata() throws Exception
{
- Collection<BeanMetadata> beans = blueprint.getBeanComponentsMetadata();
+ Collection<BeanMetadata> beans = blueprint.getMetadata(BeanMetadata.class);
assertNotNull("BeanMetadata not null", beans);
assertEquals("BeanMetadata size", 3, beans.size());
}
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-17
13:27:35 UTC (rev 90328)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicServiceParserTestCase.java 2009-06-17
13:32:50 UTC (rev 90329)
@@ -64,14 +64,14 @@
ServiceMetadata serviceA = (ServiceMetadata)compList.get(1);
assertEquals("serviceA", serviceA.getId());
- List<String> intfsA = serviceA.getInterfaceNames();
+ List<String> intfsA = serviceA.getInterfaces();
assertTrue(intfsA.size() > 0);
assertEquals(ServiceA.class.getName(), intfsA.get(0));
ServiceMetadata serviceB = (ServiceMetadata)compList.get(2);
assertEquals("serviceB", serviceB.getId());
- List<String> intfsB = serviceB.getInterfaceNames();
+ List<String> intfsB = serviceB.getInterfaces();
assertTrue(intfsB.size() > 0);
assertEquals(ServiceB.class.getName(), intfsB.get(0));
}