You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2010/08/08 18:38:28 UTC

svn commit: r983445 - in /felix/sandbox/fmeschbe/dsadmin: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/component/

Author: fmeschbe
Date: Sun Aug  8 16:38:27 2010
New Revision: 983445

URL: http://svn.apache.org/viewvc?rev=983445&view=rev
Log:
FELIX-2530 Prototype for a new Declarative Services admin API

Added:
    felix/sandbox/fmeschbe/dsadmin/   (with props)
    felix/sandbox/fmeschbe/dsadmin/pom.xml   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/
    felix/sandbox/fmeschbe/dsadmin/src/main/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java   (with props)
    felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java   (with props)

Propchange: felix/sandbox/fmeschbe/dsadmin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Aug  8 16:38:27 2010
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings

Added: felix/sandbox/fmeschbe/dsadmin/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/pom.xml?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/pom.xml (added)
+++ felix/sandbox/fmeschbe/dsadmin/pom.xml Sun Aug  8 16:38:27 2010
@@ -0,0 +1,82 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>felix-parent</artifactId>
+        <version>1.2.0</version>
+        <relativePath>../pom/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.felix.dsadmin</artifactId>
+    <version>0.9.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Felix Declarative Services Administrative API</name>
+    <description>
+        Prototype for a new Administrative API for the OSGi Declaratives
+        Services specification.
+    </description>
+
+    <scm>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/felix/sandbox/fmeschbe/dsadmin</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/sandbox/fmeschbe/dsadmin</developerConnection>
+        <url>scm:svn:https://svn.apache.org/repos/asf/felix/sandbox/fmeschbe/dsadmin</url>
+    </scm>
+    
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.0.1</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>
+                            ${artifactId}
+                        </Bundle-SymbolicName>
+                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-DocURL>
+                            http://felix.apache.org/site/apache-felix-service-component-runtime.html
+                        </Bundle-DocURL>
+                        <Export-Package>
+                            org.apache.felix.component;version=0.9
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: felix/sandbox/fmeschbe/dsadmin/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.apache.felix.component;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The <code>BoundReference</code> interface represents the actual service
+ * binding of a service reference declared in the {@link Reference
+ * reference element} of the component declaration.
+ */
+public interface BoundReference
+{
+
+    /**
+     * Returns the <code>reference</code> element of the component descriptor
+     * defining this bound reference.
+     */
+    Reference getReference();
+
+    /**
+     * Returns whether this reference is satisified. An
+     * {@link Reference#isOptional() optional} component is always satsified.
+     * Otherwise <code>true</code> is only returned if at least one service is
+     * bound.
+     */
+    boolean isSatisfied();
+
+    /**
+     * Returns the value of the actual target value used to select services
+     * to bind to. Initially (without overwriting configuration) this method
+     * provides access to the <code>target</code> attribute of the
+     * <code>reference</code> element. If configuration overwrites the target
+     * property, this method returns the value of the Component property whose
+     * name is derived from the {@link Reference#getName() reference name} plus
+     * the suffix <em>.target</em>. If no target property exists this method
+     * returns <code>null</code>.
+     */
+    String getTarget();
+
+    /**
+     * Returns an array of <code>ServiceReference</code> objects representing
+     * the bound services. If no services are actually bound, this method
+     * returns <code>null</code>.
+     */
+    ServiceReference[] getServiceReference();
+}

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/BoundReference.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,205 @@
+/*
+ * 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.
+ */
+package org.apache.felix.component;
+
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * The <code>Component</code> interface represents the declaration of a
+ * component in a Declarative Services descriptor.
+ */
+public interface Component
+{
+
+    /**
+     * Returns the name of the component, which is also used as the service or
+     * factory PID to configure the component. This method provides access to
+     * the <code>name</code> attribute of the <code>component</code> element.
+     */
+    String getName();
+
+    /**
+     * Returns <code>true</code> if this component is currently enabled.
+     *
+     * @return <code>true</code> if this component is currently enabled.
+     */
+    boolean isEnabled();
+
+    /**
+     * Returns the <code>Bundle</code> declaring this component.
+     */
+    Bundle getBundle();
+
+    /**
+     * Returns the component factory name or <code>null</code> if this component
+     * is not defined as a component factory. This method provides access to
+     * the <code>factory</code> attribute of the <code>component</code> element.
+     */
+    String getFactory();
+
+    /**
+     * Returns <code>true</code> if this component is a service factory. This
+     * method returns the value of the <code>serviceFactory</code> attribute of
+     * the <code>service</code> element. If the component has no service
+     * element, this method returns <code>false</code>.
+     */
+    boolean isServiceFactory();
+
+    /**
+     * Returns the class name of the Component implementation. This method
+     * provides access to the <code>class</code> attribute of the
+     * <code>implementation</code> element.
+     */
+    String getClassName();
+
+    /**
+     * Returns whether the Component is declared to be enabled initially. This
+     * method provides access to the <code>enabled</code> attribute of the
+     * <code>component</code> element.
+     */
+    boolean isDefaultEnabled();
+
+    /**
+     * Returns whether the Component is an Immediate or a Delayed Component.
+     * This method provides access to the <code>immediate</code> attribute of
+     * the <code>component</code> element.
+     */
+    boolean isImmediate();
+
+    /**
+     * Returns an array of service names provided by this Component or
+     * <code>null</code> if the Component is not registered as a service. This
+     * method provides access to the <code>interface</code> attributes of the
+     * <code>provide</code> elements.
+     */
+    String[] getServices();
+
+    /**
+     * Returns the declared properties of the Component. This method provides
+     * access to the all of the <code>property</code> and
+     * <code>properties</code> elements.
+     */
+    Map getProperties();
+
+    /**
+     * Returns an array of {@link Reference} instances representing the service
+     * references (or dependencies) of this Component. If the Component has no
+     * references, <code>null</code> is returned.
+     */
+    Reference[] getReferences();
+
+    /**
+     * Returns the name of the method to be called when the component is being
+     * activated.
+     * <p>
+     * This method never returns <code>null</code>, that is, if this method is
+     * not declared in the component descriptor this method returns the default
+     * value <i>activate</i>.
+     */
+    String getActivate();
+
+    /**
+     * Returns <code>true</code> if the name of the method to be called on
+     * component activation (see {@link #getActivate()} is declared in the
+     * component descriptor or not.
+     * <p>
+     * For a component declared in a Declarative Services 1.0 descriptor, this
+     * method always returns <code>false</code>.
+     */
+    boolean isActivateDeclared();
+
+    /**
+     * Returns the name of the method to be called when the component is being
+     * deactivated.
+     * <p>
+     * This method never returns <code>null</code>, that is, if this method is
+     * not declared in the component descriptor this method returns the default
+     * value <i>deactivate</i>.
+     */
+    String getDeactivate();
+
+    /**
+     * Returns <code>true</code> if the name of the method to be called on
+     * component deactivation (see {@link #getDeactivate()} is declared in the
+     * component descriptor or not.
+     * <p>
+     * For a component declared in a Declarative Services 1.0 descriptor, this
+     * method always returns <code>false</code>.
+     */
+    boolean isDeactivateDeclared();
+
+    /**
+     * Returns the name of the method to be called when the component
+     * configuration has been updated or <code>null</code> if such a method is
+     * not declared in the component descriptor.
+     * <p>
+     * For a component declared in a Declarative Services 1.0 descriptor, this
+     * method always returns <code>null</code>.
+     */
+    String getModified();
+
+    /**
+     * Reuturns the configuration policy declared in the component descriptor.
+     * If the component descriptor is a Declarative Services 1.0 descriptor or
+     * not configuration poliy has been declared, the default value
+     * <i>optional</i> is returned.
+     * <p>
+     * The returned string is one of the three policies defined in the
+     * Declarative Services specification 1.1:
+     * <dl>
+     * <dt>optional</dt>
+     * <dd>Configuration from the Configuration Admin service is supplied to the
+     * component if available. Otherwise the component is activated without
+     * Configuration Admin configuration. This is the default value reflecting
+     * the behaviour of Declarative Services 1.0</dd>
+     * <dt>require</dt>
+     * <dd>Configuration is required. The component remains unsatisfied until
+     * configuartion is available from the Configuration Admin service.</dd>
+     * <dt>ignore</dt>
+     * <dd>Configuration is ignored. No Configuration Admin service
+     * configuration is supplied to the component.</dd>
+     * </dl>
+     */
+    String getConfigurationPolicy();
+
+    /**
+     * Enables this Component if it is disabled. If the Component is not
+     * currently disabled this method has no effect.
+     */
+    void enable();
+
+    /**
+     * Disables this Component if it is enabled. If the Component is already
+     * disabled this method has no effect.
+     */
+    void disable();
+
+    /**
+     * Returns the component configurations created for this declaration or
+     * <code>null</code> if this instance is currently disabled or if this
+     * component is a component factory and no instances have been created.
+     *
+     * @return an array of {@link ComponentConfiguration} objects created from
+     *         this declaration or <code>null</code> if none have been created
+     *         yet.
+     */
+    ComponentConfiguration[] getConfigurations();
+}

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Component.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+package org.apache.felix.component;
+
+import java.util.Dictionary;
+
+/**
+ * The <code>ComponentConfiguration</code> interface represents an actual
+ * instance of a declared {@link Component}. These instances are called
+ * <i>configurations</i> in the Declarative Services specification hence the
+ * name.
+ */
+public interface ComponentConfiguration
+{
+
+    /**
+     * The Component activation failed because any dependency is not satisfied
+     * (value is 1).
+     */
+    static final int STATE_UNSATISFIED = 1;
+
+    /**
+     * The Component is currently being activated either because it has been
+     * enabled or because any dependency which was previously unsatisfied has
+     * become satisfied (value is 2).
+     */
+    static final int STATE_ACTIVATING = 2;
+
+    /**
+     * The Component has successfully been activated and is fully functional
+     * (value is 4). This is the state of immediate components after
+     * successfull activation. Delayed and Service Factory Components enter
+     * this state when the service instance has actually be instantiated because
+     * the service has been acquired.
+     */
+    static final int STATE_ACTIVE = 4;
+
+    /**
+     * The Component has successfully been activated but is a Delayed or Service
+     * Factory Component pending instantiation on first use (value is 8).
+     */
+    static final int STATE_REGISTERED = 8;
+
+    /**
+     * The Component is being deactivated either because it is being disabled
+     * or because a dependency is not satisfied any more (value is 16). After
+     * deactivation the Component enters the {@link #STATE_UNSATISFIED} state.
+     */
+    static final int STATE_DEACTIVATING = 16;
+
+    /**
+     * The Component is being disposed off (value is 32). After the component
+     * has been disposed off it is removed from the system.
+     */
+    static final int STATE_DISPOSING = 32;
+
+    /**
+     * Returns the ID of this component. This ID is managed by the Declarative
+     * Services implementation.
+     */
+    long getId();
+
+    /**
+     * Returns the declaration of this component configuration.
+     *
+     * @return the declaration of this component configuration.
+     */
+    Component getComponent();
+
+    /**
+     * Returns the current state of the Component, which is one of the
+     * <code>STATE_*</code> constants defined in this interface.
+     */
+    int getState();
+
+    /**
+     * Returns the <code>service.pid</code> properties of the configuration
+     * properties provided by the Configuration Admin service for this
+     * component or <code>null</code> if no configuration from the Configuration
+     * Admin is provided to this component.
+     */
+    String getConfigurationPid();
+
+    /**
+     * Returns a read-only map of the actual properties provided to the
+     * component. This method returns is the equivalent to the
+     * <code>ComponentContext.getProperties()</code> method.
+     *
+     * @return the actual properties provided to the component.
+     */
+    Dictionary getProperties();
+
+    /**
+     * Returns an array of {@link BoundReference} instances representing the
+     * service references bound to this component configuration.
+     * <code>null</code> is returned if the Component has no bouind references.
+     */
+    BoundReference[] getBoundReferences();
+
+    /**
+     * Disposes off this component completely. This method is equivalant to
+     * calling the <code>ComponentInstance.dispose()</code> method.
+     * <p>
+     * Care should be taken when calling this method. Disposed components may
+     * only be recreated if as of external events like a configuration update in
+     * the Configuration Admin service, calling the
+     * <code>ComponentFactory.newInstance(Dictionary)</code> method or by
+     * disabling and reenabling the {@link #getComponent() component}.
+     */
+    void dispose();
+}

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ComponentConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+package org.apache.felix.component;
+
+/**
+ * The <code>Reference</code> interface represents a single reference (or
+ * dependency) to a service used by a Component as declared in the
+ * <code>reference</code> elements of a Declarative Services descriptor.
+ */
+public interface Reference
+{
+
+    /**
+     * Returns the name of this Reference. This method provides access to the
+     * <code>name</code> attribute of the <code>reference</code> element.
+     */
+    String getName();
+
+    /**
+     * Returns the name of the service used by this Reference. This method
+     * provides access to the <code>interface</code> attribute of the
+     * <code>reference</code> element.
+     */
+    String getServiceName();
+
+    /**
+     * Returns whether this reference is optional. This method provides access
+     * to the lower bound of the <code>cardinality</code> attribute of the
+     * <code>reference</code> element. In other words, this method returns
+     * <code>true</code> if the cardinality is <em>0..1</em> or <em>0..n</em>.
+     */
+    boolean isOptional();
+
+    /**
+     * Returns whether this reference is multiple. This method provides access
+     * to the upper bound of the <code>cardinality</code> attribute of the
+     * <code>reference</code> element. In other words, this method returns
+     * <code>true</code> if the cardinality is <em>0..n</em> or <em>1..n</em>.
+     */
+    boolean isMultiple();
+
+    /**
+     * Returns <code>true</code> if the reference is defined with static policy.
+     * This method provides access to the <code>policy</code> element of the
+     * <code>reference</code> element. <code>true</code> is returned if the
+     * policy is defined as <em>static</em>.
+     */
+    boolean isStatic();
+
+    /**
+     * Returns the value of the target property of this reference. This method
+     * provides access to the <code>target</code> attribute of the
+     * <code>reference</code> element. If no target property exists this method
+     * returns <code>null</code>.
+     */
+    String getTarget();
+
+    /**
+     * Returns the name of the method called if a service is being bound to
+     * the Component or <code>null</code> if no such method is configued. This
+     * method provides access to the <code>bind</code> attribute of the
+     * <code>reference</code> element.
+     */
+    String getBindMethodName();
+
+    /**
+     * Returns the name of the method called if a service is being unbound from
+     * the Component or <code>null</code> if no such method is configued. This
+     * method provides access to the <code>unbind</code> attribute of the
+     * <code>reference</code> element.
+     */
+    String getUnbindMethodName();
+
+    /**
+     * Returns the name of the method called if a bound service updates its
+     * service registration properties or <code>null</code> if no such method
+     * is configued. This method provides access to the <code>updated</code>
+     * attribute of the <code>reference</code> element.
+     * <p>
+     * For a component declared in a Declarative Services 1.0 and 1.1
+     * descriptor, this method always returns <code>null</code>.
+     * <p>
+     * This method exists in anticipation of the specification of an
+     * <code>updated</code> method as defined in <a
+     * href="https://www.osgi.org/bugzilla/show_bug.cgi?id=63">OSGi Alliance Bug
+     * 63</a>.
+     */
+    String getUpdatedMethodName();
+}

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/Reference.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package org.apache.felix.component;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * The <code>ServiceComponentRuntime</code> service represents the Declarative
+ * Services main controller also known as the Service Component Runtime or SCR
+ * for short. It provides access to the components managed by the SCR.
+ * <p>
+ * This service differentiates between {@link Component} and
+ * {@link ComponentConfiguration}. A {@link Component} is the declaration of the
+ * component in the Declarative Services descriptor. A
+ * {@link ComponentConfiguration} is an actual instance of a declared
+ * {@link Component} and is backed by an object instance of the
+ * {@link Component#getClassName() implementation class name declared in the
+ * component}.
+ */
+public interface ServiceComponentRuntime
+{
+
+    /**
+     * Returns the name of this Declarative Services implementation.
+     *
+     * @return the name of this Declarative Services implementation.
+     */
+    String getName();
+
+    /**
+     * Returns the vendor name of this Declarative Services implementation.
+     *
+     * @return the vendor name of this Declarative Services implementation.
+     */
+    String getVendor();
+
+    /**
+     * Returns the of this Declarative Services implementation.
+     *
+     * @return the of this Declarative Services implementation.
+     */
+    Version getVersion();
+
+    /**
+     * Returns the version of the Declarative Services specification
+     * implemented.
+     *
+     * @return the version of the Declarative Services specification
+     *         implemented.
+     */
+    Version getSpecificationVersion();
+
+    /**
+     * Returns the components declared by the given bundle or the components
+     * declared by all active bundles if bundle is <code>null</code>. If the
+     * bundle has no declared components or the bundle is not active
+     * <code>null</code> is returned.
+     *
+     * @param bundle The bundle whose declared components are to be returned or
+     *            <code>null</code> if the declared components from all active
+     *            bundles are to be returned.
+     * @return The declared bundle the given (active) <code>bundle</code> or the
+     *         declared components from all active bundles if
+     *         <code>bundle</code> is <code>null</code>.
+     */
+    Component[] getComponents(Bundle bundle);
+
+    /**
+     * Return the {@link Component} declared with the given <code>name</code> or
+     * <code>null</code> if no such component is declared by any of the active
+     * bundles in the framework.
+     *
+     * @param name The name of the {@link Component} to return
+     * @return The named component or <code>null</code> if none of the active
+     *         bundles declare a component with that name.
+     * @throws NullPointerException if <code>name</code> is <code>null</code>.
+     */
+    Component getComponent(String name);
+
+    /**
+     * Return the {@link ComponentConfiguration} created with the given
+     * <code>componentId</code> as provided as the <code>component.id</code>
+     * component property.
+     *
+     * @param componentId The of the {@link ComponentConfiguration} to return.
+     * @return The component configuration created with the given component id
+     *         or <code>null</code> if no such component configuration exists.
+     *         <code>null</code> is also returned of the
+     *         <code>componentId</code> is a negative number.
+     */
+    ComponentConfiguration getConfiguration(long componentId);
+}

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/ServiceComponentRuntime.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java
URL: http://svn.apache.org/viewvc/felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java?rev=983445&view=auto
==============================================================================
--- felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java (added)
+++ felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java Sun Aug  8 16:38:27 2010
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+/**
+ * The <code>org.apache.felix.component</code> package defines the
+ * administrative
+ * API for a Declarative Services implementation. The entry point into the API
+ * is the <a href="ServiceComponentRuntime.html">ServiceComponentRuntime</a>
+ * service. This service provides access to information about the Declarative
+ * Services implementation:
+ * <ul>
+ * <li>Version and vendor of the implementation as well as the version of the
+ * implemented API</li>
+ * <li>Component declaration of a single active bundle or of all active bundles
+ * in the framework</li>
+ * <li>A single Component Configuration identified by its component id</li>
+ * </ul>
+ * <p>
+ * <b>Specification</b>
+ * <p>
+ * This administrative API should evolve into a proposal for the OSGi Alliance
+ * CPEG as an extension of the Declarative Services specification. The package
+ * <code>org.apache.felix.component</code> reflects the intended target package
+ * <code>org.osgi.service.component</code>.
+ * <p>
+ * The current administrative API defined in the
+ * <code>org.apache.felix.scr</code> package will be superceded by this new API.
+ * <p>
+ * <b>Declarative Services Events</b>
+ * <p>
+ * A Declarative Service can update interested parties of component events.
+ * Events are distributed through the Event Admin Service using asynchronous
+ * delivery (<code>EventAdmin.postEvent</code>).
+ * <p>
+ * The Event Admin topic for Declarative Services events is <blockquote>
+ * <code>org/osgi/service/component/scr/&lt;EVENT_NAME&gt;</code> </blockquote>
+ * <p>
+ * where <code>&lt;EVENT_NAME&gt;</code> is one of the following events:
+ * <dl>
+ * <dt>STARTING</dt>
+ * <dd>Processing of components for a bundle has started. Only sent for bundles
+ * providing descriptors.</dd>
+ * <dt>STARTED</dt>
+ * <dd>Processing of components for a bundle has completed (this includes any
+ * asynchronous tasks like activation)</dd>
+ * <dt>ACTIVATED</dt>
+ * <dd>A component has been activated</dd>
+ * <dt>FAILED</dt>
+ * <dd>An enabled component has failed to be activated, due to missing
+ * configuration, missing references or failure to execute the activate method</dd>
+ * <dt>DEACTIVATED</dt>
+ * <dd>A component has been deactivated</dd>
+ * </dl>
+ * <p>
+ * The properties of a Declarative Services event are:
+ * <dl>
+ * <dt><code>bundle.id</code></dt>
+ * <dd>The Bundle ID of the bundle providing the component(s) for which the
+ * event is fired. This property is set on all events. The type of this property
+ * is <code>java.lang.Long</code>.</dd>
+ * <dt><code>component.id</code></dt>
+ * <dd>The ID of the component which was activated or deactivated or which
+ * failed to activate. This property is only set on the <code>ACTIVATED</code>,
+ * <code>FAILED</code>, and <code>DEACTIVATED</code> events. The type of this
+ * property is <code>java.lang.Long</code>.</dd>
+ * <dt><code>failure.exception</code></dt>
+ * <dd>The exception causing the bundle to fail activation. This property is
+ * only set on the <code>FAILED</code> event if the activation failure is caused
+ * by an exception. The type of this property is
+ * <code>java.lang.Throwable</code>.</dd>
+ * <dt><code>failure.reference</code></dt>
+ * <dd>The name of the service reference(s) which are unsatisified and cause the
+ * component to not being activated. This property is only set on the
+ * <code>FAILED</code> event if the activation failure is caused by unsatisified
+ * service references. The type of this property is
+ * <code>java.lang.String</code> if it provides a single reference name or
+ * <code>java.lang.String[]</code> if it provides multiple reference names.</dd>
+ * <dt><code>failure.configuration</code></dt>
+ * <dd>The PID (or factory PID) of a <code>Configuration</code> object required
+ * to activate the component. This property is only set on the
+ * <code>FAILED</code> event if the activation failure is caused by unsatisified
+ * configuration requirement. The type of this property is
+ * <code>java.lang.String</code>.</dd>
+ * </dl>
+ */
+package org.apache.felix.component;
+

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/sandbox/fmeschbe/dsadmin/src/main/java/org/apache/felix/component/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url