You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2009/06/15 13:36:33 UTC
svn commit: r784735 [1/2] - in /geronimo/sandbox/blueprint: ./
blueprint-api/src/main/java/org/osgi/service/blueprint/container/
blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/
blueprint-bundle/ blueprint-itests/src/test/java/org/apache...
Author: gnodet
Date: Mon Jun 15 11:36:32 2009
New Revision: 784735
URL: http://svn.apache.org/viewvc?rev=784735&view=rev
Log:
Update to latest blueprint api (including the ServiceException which require OSGi 4.2)
Modified:
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Listener.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java
geronimo/sandbox/blueprint/blueprint-bundle/pom.xml
geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/BlueprintContainerTest.java
geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestConfigAdmin.java
geronimo/sandbox/blueprint/blueprint-itests/src/test/java/org/apache/geronimo/blueprint/itests/TestReferences.java
geronimo/sandbox/blueprint/pom.xml
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java Mon Jun 15 11:36:32 2009
@@ -1,18 +1,17 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
+/*
+ * 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;
@@ -22,16 +21,97 @@
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 {
-
- Set<String> getComponentIds();
-
- Object getComponentInstance(String id) throws NoSuchComponentException;
-
- ComponentMetadata getComponentMetadata(String id) throws NoSuchComponentException;
-
- <T extends ComponentMetadata> Collection<T> getMetadata(Class<T> type);
-
- BundleContext getBundleContext();
+ /**
+ * 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 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();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java Mon Jun 15 11:36:32 2009
@@ -27,7 +27,7 @@
*
* <p>
* In addition, when a listener is registered, the blueprint extender
- * will send to this listener the last event for each blueprint bundle managed
+ * 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
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java Mon Jun 15 11:36:32 2009
@@ -1,35 +1,66 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 {
- public ComponentDefinitionException() {
- }
- public ComponentDefinitionException(String explanation) {
- super(explanation);
- }
-
- public ComponentDefinitionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ComponentDefinitionException(Throwable cause) {
- super(cause);
- }
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with no message or
+ * exception cause.
+ */
+ public ComponentDefinitionException() {
+ super();
+ }
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with the specified message
+ *
+ * @param explanation The associated message.
+ */
+ public ComponentDefinitionException(String explanation) {
+ super(explanation);
+ }
+
+
+ /**
+ * Creates a <code>ComponentDefinitionException</code> with the specified message and
+ * exception cause.
+ *
+ * @param explanation 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);
+ }
+
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java Mon Jun 15 11:36:32 2009
@@ -1,25 +1,44 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 {
- boolean canConvert(Object fromValue, Class toType);
+ /**
+ * 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);
- Object convert(Object fromValue, Class toType) throws Exception;
-
-}
+ /**
+ * 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
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java Mon Jun 15 11:36:32 2009
@@ -46,13 +46,13 @@
* </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}.
@@ -64,7 +64,7 @@
* 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}.
@@ -73,11 +73,11 @@
*/
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 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
@@ -86,11 +86,11 @@
*/
public static final String BUNDLE_SYMBOLICNAME = "bundle.symbolicName";
- /**
- * The bundle version property defining the version of the blueprint bundle for which an event has been issued.
- * This property is of type {@link Version}.
- */
- public static final String BUNDLE_VERSION = "bundle.version";
+ /**
+ * 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
@@ -101,12 +101,12 @@
*/
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 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
@@ -116,12 +116,12 @@
*/
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 Version}.
- */
- public static final String EXTENDER_BUNDLE_VERSION = "extender.bundle.version";
+ /**
+ * 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
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/NoSuchComponentException.java Mon Jun 15 11:36:32 2009
@@ -1,37 +1,39 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 String componentName;
-
- public NoSuchComponentException(String componentName) {
- this.componentName = componentName;
- }
-
- public String getComponentName() {
- return this.componentName;
- }
-
- public String getMessage() {
- return "No component named '" +
- (this.componentName == null ? "<null>" : this.componentName) +
- "' could be found";
- }
+ private final String componentName;
+
+ public NoSuchComponentException(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public String getComponentName() {
+ return this.componentName;
+ }
+
+ public String getMessage() {
+ return "No component named '" +
+ (this.componentName == null ? "<null>" : this.componentName) +
+ "' could be found";
+ }
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ServiceUnavailableException.java Mon Jun 15 11:36:32 2009
@@ -1,35 +1,69 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
+
/**
- * TODO: need to update this one wrt the official API, but it brings a dependency on osgi 1.5
+ * Thrown when an invocation is made on an OSGi service reference component, and
+ * a backing service is not available.
*/
-public class ServiceUnavailableException extends RuntimeException {
-
- private String filter;
-
- public ServiceUnavailableException(String message, String filter) {
- super(message);
- this.filter = filter;
- }
-
- public String getFilter() {
- return this.filter;
- }
+public class ServiceUnavailableException extends ServiceException {
+
+ 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;
+ }
+
+ /**
+ * The filter expression that a service would have needed to satisfy in order
+ * for the invocation to proceed.
+ */
+ public String getFilter() {
+ return this.filter;
+ }
}
+
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java Mon Jun 15 11:36:32 2009
@@ -1,27 +1,58 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 used in a Bean Component to inject arguments in a method or
+ * constructor. This metadata class describes the <code>argument</element>
+ */
public interface BeanArgument {
-
- Metadata getValue();
- String getValueType();
+ /**
+ * The metadata for the value to inject into the parameter.
+ *
+ * This is the <code>value</code> attribute.
+ *
+ * @return the metadata for the value
+ */
+ Metadata getValue();
- int getIndex();
+ /**
+ * The type to convert the value into when invoking the constructor or
+ * factory method. If no explicit type was specified on the component
+ * definition then this method returns null.
+ *
+ * This is the <code>type</code> attribute.
+ *
+ * @return the explicitly specified type to convert the value into, or null
+ * if no type was specified in the component definition.
+ */
+ String getValueType();
+ /**
+ * The (zero-based) index into the parameter list of the method or
+ * constructor to be invoked for this parameter. This is determined either
+ * by explicitly specifying the index attribute in the component
+ * declaration, or by declaration order of constructor-arg elements if the
+ * index was not explicitly set.
+ *
+ * This is the <code>index</code> attribute.
+ *
+ *
+ * @return the zero-based parameter index
+ */
+ int getIndex();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,47 +1,129 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
import java.util.List;
+/**
+ * Metadata for a Bean Component.
+ *
+ * This class describes a <code>bean</code> element.
+ */
public interface BeanMetadata extends Target, ComponentMetadata {
- static final String SCOPE_SINGLETON = "singleton";
-
- static final String SCOPE_PROTOTYPE = "prototype";
-
- static final String SCOPE_BUNDLE = "bundle";
-
- String getClassName();
-
- String getInitMethodName();
-
- String getDestroyMethodName();
-
- List<BeanArgument> getArguments();
-
- List<BeanProperty> getProperties();
-
- String getFactoryMethodName();
-
- Target getFactoryComponent();
-
- String getScope();
+ static final String SCOPE_SINGLETON = "singleton";
+ static final String SCOPE_PROTOTYPE = "prototype";
- Class getRuntimeClass();
+ /**
+ * The name of the class type specified for this component.
+ *
+ * This is the <code>class</code> attribute.
+ *
+ * @return the name of the component class. If no class was specified in the
+ * component definition (because the a factory component is used
+ * instead) then this method will return null.
+ */
+ String getClassName();
+
+ /**
+ * The name of the init method specified for this component, if any.
+ *
+ * This is the <code>init-method</code> attribute.
+ *
+ * @return the method name of the specified init method, or null if no init
+ * method was specified.
+ */
+ String getInitMethodName();
+
+ /**
+ * The name of the destroy method specified for this component, if any.
+ *
+ * This is the <code>destroy-method</code> attribute.
+ *
+ * @return the method name of the specified destroy method, or null if no
+ * destroy method was specified.
+ */
+ String getDestroyMethodName();
+
+ /**
+ * The arguments for the factory method or constructor.
+ *
+ * Specified in all the child <code>argument<code> elements.
+ *
+ * @return The metadata for the factory method or constructor. Can be empty if no arguments are specified
+ */
+ List<BeanArgument> getArguments();
+
+ /**
+ * The property injection metadata for this component.
+ *
+ * Specified in all the child <code>property</code> elements.
+ *
+ * @return an immutable collection of BeanProperty, with one
+ * entry for each property to be injected. If no property injection
+ * was specified for this component then an empty collection will be
+ * returned.
+ *
+ */
+ List<BeanProperty> getProperties();
+
+ /**
+ * 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();
+
+ /**
+ * The component instance on which to invoke the factory method (if
+ * specified).
+ *
+ * The component is defined in the <code>factory-component</code>.
+ *
+ * @return when a factory method and factory component has been specified
+ * for this component, this operation returns the metadata
+ * specifying the component on which the factory method is to be
+ * invoked. When no factory component has been specified this
+ * operation will return null. A return value of null with a
+ * non-null factory method indicates that the factory method should
+ * be invoked as a static method on the component class itself. For
+ * a non-null return value, the Metadata object returned will be a
+ * RefMetadata or a TargetComponentMetadata instance.
+ */
+ Target getFactoryComponent();
+
+ /**
+ * The specified scope for the component lifecycle.
+ *
+ * @return a String indicating the scope specified for the component.
+ *
+ * @see #SCOPE_SINGLETON
+ * @see #SCOPE_PROTOTYPE
+ */
+ String getScope();
+
+ /**
+ * Provide an actual class, this overrides the class name if set. This is
+ * useful for Namespace Handler services that do not want to force the
+ * Blueprint bundle to import implementation classes.
+ *
+ * @return Return the class to use in runtime or <code>null</code>.
+ */
+ Class<?> getRuntimeClass();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java Mon Jun 15 11:36:32 2009
@@ -1,25 +1,41 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 describing a property to be injected. Properties are defined
+ * following JavaBeans conventions.
+ */
public interface BeanProperty {
- String getName();
-
- Metadata getValue();
+ /**
+ * The name of the property to be injected, following JavaBeans conventions.
+ *
+ * Defined in the <code>name</code> attribute.
+ *
+ * @return the property name.
+ */
+ String getName();
-}
\ No newline at end of file
+ /**
+ * The metadata for the value to inject the property with.
+ *
+ * Defined in the <code>value</code> attribute or inlined component.
+ *
+ * @return the metadata for the property value.
+ */
+ Metadata getValue();
+}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,28 +1,50 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
import java.util.List;
+/**
+ * Metadata for a collection based value. Members of the array are instances of Metadata.
+ * The Collection metadata can constrain (### convert) to a specific type.
+ */
+
public interface CollectionMetadata extends NonNullMetadata {
- Class getCollectionClass();
+ /**
+ * Provide the interface that this collection must implement.
+ *
+ * This is used for Arrays (Object[]), Set, and List. This information
+ * is encoded in the element name.
+ *
+ *
+ * @return The interface class that the collection must implement.
+ */
+ Class<?> getCollectionClass();
- String getValueTypeName();
+ /**
+ * The value-type specified for the array
+ *
+ * The <code>value-type</code> attribute.
+ * ### Shouldnt this also support getRuntimeValueType()?
+ */
+ String getValueTypeName();
- List<Metadata> getValues();
+ /**
+ * The of Metadata objects that describe the value.
+ */
+ List<Metadata> getValues();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,33 +1,69 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
import java.util.List;
+/**
+ * Base class for all components.
+ *
+ * @see BeanMetadata
+ * @see ServiceReferenceMetadata
+ * @see ServiceMetadata
+ */
public interface ComponentMetadata extends NonNullMetadata {
- static final int INITIALIZATION_EAGER = 1;
-
- static final int INITIALIZATION_LAZY = 2;
-
- String getId();
-
- int getInitialization();
-
+ /**
+ * 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.
+ *
+ * ### renamed to getId
+ * @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: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,23 +1,30 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
+/**
+ * A value which represents the name of another component in the module context.
+ * The name itself will be injected, not the component that the name refers to.
+ *
+ */
public interface IdRefMetadata extends NonNullMetadata {
-
- String getComponentId();
-
+ /**
+ * The name of the referenced component.
+ * Defined in the <code>component</code> attribute.
+ *
+ */
+ String getComponentId();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Listener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Listener.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Listener.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Listener.java Mon Jun 15 11:36:32 2009
@@ -1,27 +1,51 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 {
-
- Target getListenerComponent();
- String getBindMethodName();
-
- String getUnbindMethodName();
-
+ /**
+ * 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: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java Mon Jun 15 11:36:32 2009
@@ -1,24 +1,45 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 an entry. An entry is the member of a MapMetadata so that it
+ * can be treated as a CollectionMetadata with entries.
+ *
+ * Defined in the <code>entry</code> element.
+ *
+ */
public interface MapEntry {
+ /**
+ * Keys must be non-null.
+ *
+ * Defined in the <code>key</code> attribute or element.
+ *
+ * @return the metadata for the key
+ */
+ NonNullMetadata getKey();
- NonNullMetadata getKey();
+ /**
+ * Return the metadata for the value.
+ *
+ * Defined in the <code>value</code> attribute or element<.
+ *
+ * @return the metadata for the value
+ */
- Metadata getValue();
+ Metadata getValue();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,29 +1,47 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
import java.util.List;
+/**
+ * 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 {
-
- String getKeyTypeName();
-
- String getValueTypeName();
+ /**
+ * 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();
- List<MapEntry> getEntries();
+ /**
+ * The value-type specified for the array
+ *
+ * ### should we have getRuntimeValueType?
+ * The <code>value-type</code> attribute.
+ */
+ String getValueTypeName();
+ /**
+ * The of Metadata objects that describe the value.
+ */
+ List<MapEntry> getEntries();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java Mon Jun 15 11:36:32 2009
@@ -1,21 +1,24 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
+/*
+ * Copyright (c) OSGi Alliance (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;
+/**
+ * Top level metadata. This represents any possible value.
+ *
+ */
public interface Metadata {
-
+
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,20 +1,24 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
+/**
+ * Base interfaces for metadata that cannot be null. The NullMetadata is the
+ * only element not implementing this. Mainly used for keys in maps because they
+ * cannot be null.
+ */
public interface NonNullMetadata extends Metadata {
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,23 +1,24 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
+/**
+ * A value specified to be null via the <null/> element.
+ */
public interface NullMetadata extends Metadata {
-
- static final NullMetadata NULL = new NullMetadata() { } ;
-
+
+ static final NullMetadata NULL = new NullMetadata() {};
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,25 +1,41 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
+/*
+ * 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;
import java.util.List;
+/**
+ * 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.
+ *
+ */
public interface PropsMetadata extends NonNullMetadata {
-
- List<MapEntry> getEntries();
+ /**
+ * This is the same as getValuesMetadata but more type safe.
+ *
+ * Defined in <code>prop</code> sub elements.
+ *
+ * @return
+ */
+ List<MapEntry> getEntries();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefListMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,27 +1,46 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 {
- static final int USE_SERVICE_OBJECT = 1;
-
- static final int USE_SERVICE_REFERENCE = 2;
+ /**
+ * Use the service objects to compare or include in the collection
+ */
+ public static final int USE_SERVICE_OBJECT = 1;
- int getMemberType();
+ /**
+ * 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();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,23 +1,28 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
+/**
+ * A value which refers to another component in the module context by name.
+ */
public interface RefMetadata extends Target, NonNullMetadata {
-
- String getComponentId();
-
+ /**
+ * The name of the referenced component.
+ * Defined in the <code>component</code> attribute.
+ *
+ */
+ String getComponentId();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,23 +1,36 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
+/*
+ * 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 will bind to a single matching service in the service
+ * registry.
+ *
+ * Defines the <code>reference</code> element.
+ *
+ */
public interface ReferenceMetadata extends ServiceReferenceMetadata, Target {
-
- long getTimeout();
-
+
+ /**
+ * Timeout for service invocations when a matching backing service is
+ * unavailable.
+ * Defined in the <code>timeout</code> attribute.
+ *
+ * @return service invocation timeout in milliseconds
+ */
+ long getTimeout();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java Mon Jun 15 11:36:32 2009
@@ -1,27 +1,56 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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 registration and unregistration
+ * events for an exported service.
+ */
public interface RegistrationListener {
- Target getListenerComponent();
-
- String getRegistrationMethodName();
-
- String getUnregistrationMethodName();
-
+ /**
+ * The component instance that will receive registration and unregistration
+ * 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>listener</code> child element.
+ *
+ * @return the listener component reference.
+ */
+ Target getListenerComponent();
+
+ /**
+ * The name of the method to invoke on the listener component when
+ * the exported service is registered with the service registry.
+ *
+ * Defined in the <code>registration-method</code> attribute.
+ *
+ * @return the registration callback method name.
+ */
+ String getRegistrationMethodName();
+
+ /**
+ * The name of the method to invoke on the listener component when
+ * the exported service is unregistered from the service registry.
+ *
+ * Defined in the <code>unregistration-method</code> attribute.
+ *
+ * @return the unregistration callback method name.
+ */
+ String getUnregistrationMethodName();
+
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java?rev=784735&r1=784734&r2=784735&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java Mon Jun 15 11:36:32 2009
@@ -1,44 +1,108 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+/*
+ * 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
+ * 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.
+ * 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;
import java.util.Collection;
import java.util.List;
-public interface ServiceMetadata extends ComponentMetadata, Target {
-
- static final int AUTO_EXPORT_DISABLED = 1;
-
- static final int AUTO_EXPORT_INTERFACES = 2;
-
- static final int AUTO_EXPORT_CLASS_HIERARCHY = 3;
-
- static final int AUTO_EXPORT_ALL_CLASSES = 4;
-
- Target getServiceComponent();
- List<String> getInterfaceNames();
-
- int getAutoExportMode();
-
- List<MapEntry> getServiceProperties();
-
- int getRanking();
-
- Collection<RegistrationListener> getRegistrationListeners();
+/**
+ * Metadata representing a service to be exported by a module context.
+ *
+ */
+public interface ServiceMetadata extends ComponentMetadata, Target {
+ /**
+ * Do not auto-detect types for advertised service intefaces
+ */
+ public static final int AUTO_EXPORT_DISABLED = 1;
+
+ /**
+ * Advertise all Java interfaces implemented by the exported component as
+ * service interfaces.
+ */
+ public static final int AUTO_EXPORT_INTERFACES= 2;
+
+ /**
+ * Advertise all Java classes in the hierarchy of the exported component's type
+ * as service interfaces.
+ */
+ public static final int AUTO_EXPORT_CLASS_HIERARCHY = 3;
+
+ /**
+ * Advertise all Java classes and interfaces in the exported component's type as
+ * service interfaces.
+ */
+ public static final int AUTO_EXPORT_ALL_CLASSES = 4;
+
+ /**
+ * The component that is to be exported as a service. Value must refer to a component and
+ * therefore be either a RefMetadata, BeanMetadata, or ReferenceMetadata.
+ *
+ * Defined in the <code>registration-method</code> attribute.
+ *
+ * @return the component to be exported as a service.
+ */
+ Target getServiceComponent();
+
+ /**
+ * The type names of the set of interface types that the service should be advertised
+ * as supporting, as specified in the component declaration.
+ *
+ * Defined in the <code>interface</code> attribute or <code>interfaces</code> element.
+ *
+ * @return an immutable set of (String) type names, or an empty set if using auto-export
+ */
+ List/*<String>*/ getInterfaceNames();
+
+ /**
+ * Return the auto-export mode specified.
+ *
+ * Defined in the <code>auto-export</code> attribute.
+ *
+ * @return One of AUTO_EXPORT_DISABLED, AUTO_EXPORT_INTERFACES, AUTO_EXPORT_CLASS_HIERARCHY, AUTO_EXPORT_ALL_CLASSES
+ */
+ int getAutoExportMode();
+
+ /**
+ * The user declared properties to be advertised with the service.
+ *
+ * Defined in the <code>service-properties</code> element.
+ *
+ * @return Map containing the set of user declared service properties (may be
+ * empty if no properties were specified).
+ */
+ List<MapEntry> getServiceProperties();
+
+ /**
+ * The ranking value to use when advertising the service
+ *
+ * Defined in the <code>ranking</code> attribute.
+ *
+ * @return service ranking
+ */
+ int getRanking();
+
+ /**
+ * The listeners that have registered to be notified when the exported service
+ * is registered and unregistered with the framework.
+ *
+ * Defined in the <code>registration-listener</code> elements.
+ *
+ * @return an immutable collection of RegistrationListenerMetadata
+ */
+ Collection<RegistrationListener> getRegistrationListeners();
}