FELIX-4401 Temporarily add runtime spec packages to source

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1602632 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/osgi/dto/DTO.java b/scr/src/main/java/org/osgi/dto/DTO.java
new file mode 100644
index 0000000..acb9dd3
--- /dev/null
+++ b/scr/src/main/java/org/osgi/dto/DTO.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.dto;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Super type for Data Transfer Objects.
+ * 
+ * All data transfer objects are easily serializable having only public fields
+ * of primitive types and their wrapper classes, Strings, and DTOs. List, Set,
+ * Map and array aggregates may also be used. The aggregates must only hold
+ * objects of the listed types or aggregates.
+ * 
+ * @author $Id: 36dd2d0b9df1b8a6f67c74eeaad1cc9e20e19574 $
+ * @NotThreadSafe
+ */
+public abstract class DTO {
+
+    /**
+     * Return a string representation of this DTO suitable for use when
+     * debugging.
+     * 
+     * <p>
+     * The format of the string representation is not specified and subject to
+     * change.
+     * 
+     * @return A string representation of this DTO suitable for use when
+     *         debugging.
+     */
+    @Override
+    public String toString() {
+        return appendValue(new StringBuilder(), new IdentityHashMap<Object, String>(), "#", this).toString();
+    }
+
+    /**
+     * Append the specified DTO's string representation to the specified
+     * StringBuilder.
+     * 
+     * <p>
+     * This method handles circular DTO references.
+     * 
+     * @param result StringBuilder to which the string representation is
+     *        appended.
+     * @param objectRefs References to "seen" objects.
+     * @param refpath The reference path of the specified DTO.
+     * @param dto The DTO whose string representation is to be appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendDTO(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final DTO dto) {
+        result.append("{");
+        String delim = "";
+        for (Field field : dto.getClass().getFields()) {
+            if (Modifier.isStatic(field.getModifiers())) {
+                continue;
+            }
+            result.append(delim);
+            final String name = field.getName();
+            appendString(result, name);
+            result.append(":");
+            Object value = null;
+            try {
+                value = field.get(dto);
+            } catch (IllegalAccessException e) {
+                // use null value;
+            }
+            appendValue(result, objectRefs, refpath + "/" + name, value);
+            delim = ", ";
+        }
+        result.append("}");
+        return result;
+    }
+
+    /**
+     * Append the specified value's string representation to the specified
+     * StringBuilder.
+     * 
+     * @param result StringBuilder to which the string representation is
+     *        appended.
+     * @param objectRefs References to "seen" objects.
+     * @param refpath The reference path of the specified value.
+     * @param value The object whose string representation is to be appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendValue(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Object value) {
+        if (value == null) {
+            return result.append("null");
+        }
+        // Simple Java types
+        if (value instanceof String || value instanceof Character) {
+            return appendString(result, compress(value.toString()));
+        }
+        if (value instanceof Number || value instanceof Boolean) {
+            return result.append(value.toString());
+        }
+
+        // Complex types
+        final String path = objectRefs.get(value);
+        if (path != null) {
+            result.append("{\"$ref\":");
+            appendString(result, path);
+            result.append("}");
+            return result;
+        }
+        objectRefs.put(value, refpath);
+
+        if (value instanceof DTO) {
+            return appendDTO(result, objectRefs, refpath, (DTO) value);
+        }
+        if (value instanceof Map) {
+            return appendMap(result, objectRefs, refpath, (Map<?, ?>) value);
+        }
+        if (value instanceof List || value instanceof Set) {
+            return appendIterable(result, objectRefs, refpath, (Iterable<?>) value);
+        }
+        if (value.getClass().isArray()) {
+            return appendArray(result, objectRefs, refpath, value);
+        }
+        return appendString(result, compress(value.toString()));
+    }
+
+    /**
+     * Append the specified array's string representation to the specified
+     * StringBuilder.
+     * 
+     * @param result StringBuilder to which the string representation is
+     *        appended.
+     * @param objectRefs References to "seen" objects.
+     * @param refpath The reference path of the specified array.
+     * @param array The array whose string representation is to be appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendArray(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Object array) {
+        result.append("[");
+        final int length = Array.getLength(array);
+        for (int i = 0; i < length; i++) {
+            if (i > 0) {
+                result.append(",");
+            }
+            appendValue(result, objectRefs, refpath + "/" + i, Array.get(array, i));
+        }
+        result.append("]");
+        return result;
+    }
+
+    /**
+     * Append the specified iterable's string representation to the specified
+     * StringBuilder.
+     * 
+     * @param result StringBuilder to which the string representation is
+     *        appended.
+     * @param objectRefs References to "seen" objects.
+     * @param refpath The reference path of the specified list.
+     * @param iterable The iterable whose string representation is to be
+     *        appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendIterable(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Iterable<?> iterable) {
+        result.append("[");
+        int i = 0;
+        for (Object item : iterable) {
+            if (i > 0) {
+                result.append(",");
+            }
+            appendValue(result, objectRefs, refpath + "/" + i, item);
+            i++;
+        }
+        result.append("]");
+        return result;
+    }
+
+    /**
+     * Append the specified map's string representation to the specified
+     * StringBuilder.
+     * 
+     * @param result StringBuilder to which the string representation is
+     *        appended.
+     * @param objectRefs References to "seen" objects.
+     * @param refpath The reference path of the specified map.
+     * @param map The map whose string representation is to be appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendMap(final StringBuilder result, final Map<Object, String> objectRefs, final String refpath, final Map<?, ?> map) {
+        result.append("{");
+        String delim = "";
+        for (Map.Entry<?, ?> entry : map.entrySet()) {
+            result.append(delim);
+            final String name = String.valueOf(entry.getKey());
+            appendString(result, name);
+            result.append(":");
+            final Object value = entry.getValue();
+            appendValue(result, objectRefs, refpath + "/" + name, value);
+            delim = ", ";
+        }
+        result.append("}");
+        return result;
+    }
+
+    /**
+     * Append the specified string to the specified StringBuilder.
+     * 
+     * @param result StringBuilder to which the string is appended.
+     * @param string The string to be appended.
+     * @return The specified StringBuilder.
+     */
+    private static StringBuilder appendString(final StringBuilder result, final CharSequence string) {
+        result.append("\"");
+        int i = result.length();
+        result.append(string);
+        while (i < result.length()) { // escape if necessary
+            char c = result.charAt(i);
+            if ((c == '"') || (c == '\\')) {
+                result.insert(i, '\\');
+                i = i + 2;
+                continue;
+            }
+            if (c < 0x20) {
+                result.insert(i + 1, Integer.toHexString(c | 0x10000));
+                result.replace(i, i + 2, "\\u");
+                i = i + 6;
+                continue;
+            }
+            i++;
+        }
+        result.append("\"");
+        return result;
+    }
+
+    /**
+     * Compress, in length, the specified string.
+     * 
+     * @param in The string to potentially compress.
+     * @return The string compressed, if necessary.
+     */
+    private static CharSequence compress(final CharSequence in) {
+        final int length = in.length();
+        if (length <= 21) {
+            return in;
+        }
+        StringBuilder result = new StringBuilder(21);
+        result.append(in, 0, 9);
+        result.append("...");
+        result.append(in, length - 9, length);
+        return result;
+    }
+}
diff --git a/scr/src/main/java/org/osgi/dto/package-info.java b/scr/src/main/java/org/osgi/dto/package-info.java
new file mode 100644
index 0000000..c3010b3
--- /dev/null
+++ b/scr/src/main/java/org/osgi/dto/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2013). 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.
+ */
+
+/**
+ * OSGi Data Transfer Object Package Version 1.0.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.dto; version="[1.0,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.dto; version="[1.0,1.1)"}
+ *
+ * @author $Id: 1209bb5e60e6b6fc8239119a2dd4a2c15b9a40f2 $
+ */
+
+//@Version("1.0")
+package org.osgi.dto;
+
+//import org.osgi.annotation.versioning.Version;
+
diff --git a/scr/src/main/java/org/osgi/dto/packageinfo b/scr/src/main/java/org/osgi/dto/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/scr/src/main/java/org/osgi/dto/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/scr/src/main/java/org/osgi/framework/dto/BundleDTO.java b/scr/src/main/java/org/osgi/framework/dto/BundleDTO.java
new file mode 100644
index 0000000..6b83401
--- /dev/null
+++ b/scr/src/main/java/org/osgi/framework/dto/BundleDTO.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.Bundle;
+
+/**
+ * Data Transfer Object for a Bundle.
+ * 
+ * <p>
+ * A Bundle can be adapted to provide a {@code BundleDTO} for the Bundle.
+ * 
+ * @author $Id: aa30709351d8fe70b19c9ea99456ebd15ecab7c3 $
+ * @NotThreadSafe
+ */
+public class BundleDTO extends DTO {
+    /**
+	 * The bundle's unique identifier.
+	 * 
+	 * @see Bundle#getBundleId()
+	 */
+    public long   id;
+
+    /**
+	 * The time when the bundle was last modified.
+	 * 
+	 * @see Bundle#getLastModified()
+	 */
+    public long   lastModified;
+
+    /**
+	 * The bundle's state.
+	 * 
+	 * @see Bundle#getState()
+	 */
+    public int    state;
+
+    /**
+	 * The bundle's symbolic name.
+	 * 
+	 * @see Bundle#getSymbolicName()
+	 */
+    public String symbolicName;
+
+    /**
+	 * The bundle's version.
+	 * 
+	 * @see Bundle#getVersion()
+	 */
+    public String version;
+}
diff --git a/scr/src/main/java/org/osgi/framework/dto/FrameworkDTO.java b/scr/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
new file mode 100644
index 0000000..7b32f93
--- /dev/null
+++ b/scr/src/main/java/org/osgi/framework/dto/FrameworkDTO.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.dto;
+
+import java.util.List;
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.BundleContext;
+
+/**
+ * Data Transfer Object for a Framework.
+ * 
+ * <p>
+ * The System Bundle can be adapted to provide a {@code FrameworkDTO} for the
+ * framework of the system bundle. A {@code FrameworkDTO} obtained from a
+ * framework will contain only the launch properties of the framework. These
+ * properties will not include the System properties.
+ * 
+ * @author $Id: 7c525727cbe877e888b460cd14d8f9054f99ee0c $
+ * @NotThreadSafe
+ */
+public class FrameworkDTO extends DTO {
+    /**
+	 * The bundles that are installed in the framework.
+	 * 
+	 * @see BundleContext#getBundles()
+	 */
+    public List<BundleDTO>           bundles;
+
+    /**
+	 * The launch properties of the framework.
+	 * 
+	 * The value type must be a numerical type, Boolean, String, DTO or an array
+	 * of any of the former.
+	 * 
+	 * @see BundleContext#getProperty(String)
+	 */
+    public Map<String, Object>       properties;
+
+    /**
+	 * The services that are registered in the framework.
+	 * 
+	 * @see BundleContext#getServiceReferences(String, String)
+	 */
+    public List<ServiceReferenceDTO> services;
+}
diff --git a/scr/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java b/scr/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
new file mode 100644
index 0000000..d08e2e3
--- /dev/null
+++ b/scr/src/main/java/org/osgi/framework/dto/ServiceReferenceDTO.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Data Transfer Object for a ServiceReference.
+ * 
+ * <p>
+ * {@code ServiceReferenceDTO}s for all registered services can be obtained from
+ * a {@link FrameworkDTO}. An installed Bundle can be adapted to provide a
+ * {@code ServiceReferenceDTO[]} of the services registered by the Bundle. A
+ * {@code ServiceReferenceDTO} obtained from a framework must convert service
+ * property values which are not valid value types for DTOs to type
+ * {@code String} using {@code String.valueOf(Object)}.
+ * 
+ * @author $Id: 2c70b84f28c41fb51c488cb03950a46188ea209f $
+ * @NotThreadSafe
+ */
+public class ServiceReferenceDTO extends DTO {
+    /**
+	 * The id of the service.
+	 * 
+	 * @see Constants#SERVICE_ID
+	 */
+    public long                id;
+
+    /**
+	 * The id of the bundle that registered the service.
+	 * 
+	 * @see ServiceReference#getBundle()
+	 */
+    public long                bundle;
+
+    /**
+	 * The properties for the service.
+	 * 
+	 * The value type must be a numerical type, Boolean, String, DTO or an array
+	 * of any of the former.
+	 * 
+	 * @see ServiceReference#getProperty(String)
+	 */
+    public Map<String, Object> properties;
+
+    /**
+	 * The ids of the bundles that are using the service.
+	 * 
+	 * @see ServiceReference#getUsingBundles()
+	 */
+    public long[]              usingBundles;
+}
diff --git a/scr/src/main/java/org/osgi/framework/dto/package-info.java b/scr/src/main/java/org/osgi/framework/dto/package-info.java
new file mode 100644
index 0000000..5c0bffc
--- /dev/null
+++ b/scr/src/main/java/org/osgi/framework/dto/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2012, 2014). 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.
+ */
+
+/**
+ * OSGi Data Transfer Object Framework Package Version 1.8.
+ * 
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ * 
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.framework.dto; version="[1.8,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.framework.dto; version="[1.8,1.9)"}
+ * 
+ * @author $Id: 2acfb6f1633e18f1ceedd27c04e70131cae4f293 $
+ */
+
+//@Version("1.8")
+package org.osgi.framework.dto;
+
+//import org.osgi.annotation.versioning.Version;
+
diff --git a/scr/src/main/java/org/osgi/framework/dto/packageinfo b/scr/src/main/java/org/osgi/framework/dto/packageinfo
new file mode 100644
index 0000000..ed9885d
--- /dev/null
+++ b/scr/src/main/java/org/osgi/framework/dto/packageinfo
@@ -0,0 +1 @@
+version 1.8
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/ServiceComponentRuntime.java b/scr/src/main/java/org/osgi/service/component/runtime/ServiceComponentRuntime.java
new file mode 100755
index 0000000..45db87df
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/ServiceComponentRuntime.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.component.runtime;
+
+import java.util.Collection;
+//import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.Bundle;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+/**
+ * The {@code ServiceComponentRuntime} 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 Service
+ * Component Runtime.
+ * 
+ * <p>
+ * This service differentiates between a {@link ComponentDescriptionDTO} and a
+ * {@link ComponentConfigurationDTO}. A {@link ComponentDescriptionDTO} is a
+ * representation of a declared component description. A
+ * {@link ComponentConfigurationDTO} is a representation of an actual instance of a
+ * declared component description parameterized by component properties.
+ * <p>
+ * 
+ * Access to this service requires the
+ * {@code ServicePermission[ServiceComponentRuntime, GET]} permission. It is
+ * intended that only administrative bundles should be granted this permission
+ * to limit access to the potentially intrusive methods provided by this
+ * service.
+ * 
+ * @ThreadSafe
+ * @since 1.3
+ * @author $Id: 0b736eb18ed9ae337ef04765d1c006049a246c56 $
+ */
+//@ProviderType
+public interface ServiceComponentRuntime {
+
+	/**
+	 * Returns the component descriptions declared by the specified active
+	 * bundles.
+	 * 
+	 * <p>
+	 * Only component descriptions from active bundles are returned. If the
+	 * specified bundles have no declared components or are not active, an empty
+	 * collection is returned.
+	 * 
+	 * @param bundles The bundles whose declared component descriptions are to
+	 *        be returned. Specifying no bundles, or the equivalent of an empty
+	 *        {@code Bundle} array, will return the declared component
+	 *        descriptions from all active bundles.
+	 * @return The declared component descriptions of the specified active
+	 *         {@code bundles}. An empty collection is returned if there are no
+	 *         component descriptions for the specified active bundles.
+	 */
+	Collection<ComponentDescriptionDTO> getComponentDescriptionDTOs(Bundle... bundles);
+
+	/**
+	 * Returns the {@link ComponentDescriptionDTO} declared with the specified name
+	 * by the specified bundle.
+	 * 
+	 * <p>
+	 * Only component descriptions from active bundles are returned.
+	 * {@code null} if no such component is declared by the given {@code bundle}
+	 * or the bundle is not active.
+	 * 
+	 * @param bundle The bundle declaring the component description. Must not be
+	 *        {@code null}.
+	 * @param name The name of the component description. Must not be
+	 *        {@code null}.
+	 * @return The declared component description or {@code null} if the
+	 *         specified bundle is not active or does not declare a component
+	 *         description with the specified name.
+	 */
+	ComponentDescriptionDTO getComponentDescriptionDTO(Bundle bundle, String name);
+
+	/**
+	 * Returns the component configurations for the specified component
+	 * description.
+	 * 
+	 * @param description The component description. Must not be {@code null}.
+	 * @return A collection containing a snapshot of the current component
+	 *         configurations for the specified component description. An empty
+	 *         collection is returned if there are none.
+	 */
+	Collection<ComponentConfigurationDTO> getComponentConfigurationDTOs(ComponentDescriptionDTO description);
+
+	/**
+	 * Returns whether the specified component description is currently enabled.
+	 * 
+	 * <p>
+	 * The enabled state of a component description is initially set by the
+	 * {@link ComponentDescriptionDTO#defaultEnabled enabled} attribute of the
+	 * component description.
+	 * 
+	 * @param description The component description. Must not be {@code null}.
+	 * @return {@code true} if the specified component description is currently
+	 *         enabled. Otherwise, {@code false}.
+	 * @see #enableComponent(ComponentDescriptionDTO)
+	 * @see #disableComponent(ComponentDescriptionDTO)
+	 * @see ComponentContext#disableComponent(String)
+	 * @see ComponentContext#enableComponent(String)
+	 */
+	boolean isComponentEnabled(ComponentDescriptionDTO description);
+
+	/**
+	 * Enables the specified component description.
+	 * 
+	 * <p>
+	 * If the specified component description is currently enabled, this method
+	 * has no effect.
+	 * 
+	 * @param description The component description to enable. Must not be
+	 *        {@code null}.
+	 * @see #isComponentEnabled(ComponentDescriptionDTO)
+	 */
+	void enableComponent(ComponentDescriptionDTO description);
+
+	/**
+	 * Disables the specified component description.
+	 * 
+	 * <p>
+	 * If the specified component description is currently disabled, this method
+	 * has no effect.
+	 * 
+	 * @param description The component description to disable. Must not be
+	 *        {@code null}.
+	 * @see #isComponentEnabled(ComponentDescriptionDTO)
+	 */
+	void disableComponent(ComponentDescriptionDTO description);
+}
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/BoundReferenceDTO.java b/scr/src/main/java/org/osgi/service/component/runtime/dto/BoundReferenceDTO.java
new file mode 100755
index 0000000..b843280
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/BoundReferenceDTO.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.component.runtime.dto;
+
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+
+/**
+ * A representation of a bound reference to a service.
+ * 
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: 1ba28863312f0c0784e4a5596f991a6a6a68c147 $
+ */
+public class BoundReferenceDTO extends DTO {
+	/**
+	 * The name of the declared reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code name} attribute of the {@code reference}
+	 * element of the component description.
+	 * 
+	 * @see ComponentDescriptionDTO#name
+	 */
+	public String					name;
+
+	/**
+	 * The target property of the bound reference.
+	 * 
+	 * <p>
+	 * This is the value of the {@link ComponentConfigurationDTO#properties
+	 * component property} whose name is the concatenation of the
+	 * {@link ReferenceDTO#name declared reference name} and
+	 * &quot;.target&quot;. This will be {@code null} if no target property is
+	 * set for the reference.
+	 */
+	public String					target;
+
+	/**
+	 * The bound services.
+	 * 
+	 * <p>
+	 * Each {@link ServiceReferenceDTO} in the array represents a service bound
+	 * to the component configuration.
+	 */
+	public ServiceReferenceDTO[]	serviceReferences;
+}
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java b/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java
new file mode 100755
index 0000000..fbed36d
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentConfigurationDTO.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.component.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * A representation of an actual instance of a declared component description
+ * parameterized by component properties.
+ * 
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: b3f49d694f497e55dc7ffed0e7d910fb3bab83da $
+ */
+public class ComponentConfigurationDTO extends DTO {
+	/**
+	 * The component configuration is unsatisfied.
+	 * 
+	 * <p>
+	 * This is the initial state of a component configuration. When the
+	 * component configuration becomes satisfied it enters the
+	 * {@link #SATISFIED} state.
+	 */
+	public static final int		UNSATISFIED		= 1;
+
+	/**
+	 * The component configuration is satisfied.
+	 * 
+	 * <p>
+	 * Any {@link ComponentDescriptionDTO#serviceInterfaces services} declared by
+	 * the component description are registered.
+	 * 
+	 * If the component configuration becomes unsatisfied for any reason, any
+	 * declared services must be unregistered and the component configuration
+	 * returns to the {@link #UNSATISFIED} state.
+	 */
+	public static final int		SATISFIED		= 2;
+
+	/**
+	 * The component configuration is active.
+	 * 
+	 * <p>
+	 * This is the normal operational state of a component configuration. The
+	 * component configuration will move to the {@link #SATISFIED} state when it
+	 * is deactivated.
+	 */
+	public static final int			ACTIVE		= 4;
+
+	/**
+	 * The representation of the component configuration's component
+	 * description.
+	 */
+	public ComponentDescriptionDTO	description;
+
+	/**
+	 * The current state of the component configuration.
+	 * 
+	 * <p>
+	 * This is one of {@link #UNSATISFIED}, {@link #SATISFIED} or
+	 * {@link #ACTIVE}.
+	 */
+	public int					state;
+
+	/**
+	 * The component properties for the component configuration.
+	 * 
+	 * @see ComponentContext#getProperties()
+	 */
+	public Map<String, Object>	properties;
+
+	/**
+	 * The currently bound references.
+	 * 
+	 * <p>
+	 * Each {@link BoundReferenceDTO} in the array represents a service bound to a
+	 * reference of the component configuration. The array will be empty if the
+	 * component configuration has no bound references.
+	 */
+	public BoundReferenceDTO[]		boundReferences;
+	
+	/**
+	 * The id of the component description.
+	 * 
+	 * <p>
+	 * The id is a non-persistent, unique value assigned at runtime. The id is
+	 * also available as the {@code component.id} component property.
+	 */
+	public long					id;
+}
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java b/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java
new file mode 100755
index 0000000..986d463
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/ComponentDescriptionDTO.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.component.runtime.dto;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+import org.osgi.framework.dto.BundleDTO;
+
+/**
+ * A representation of a declared component description.
+ * 
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: f0bf3f3036179db049645595e631489455affe8a $
+ */
+public class ComponentDescriptionDTO extends DTO {
+	/**
+	 * The name of the component.
+	 * 
+	 * <p>
+	 * This is declared in the {@code name} attribute of the {@code component}
+	 * element. This will be the default name if the component description does
+	 * not declare a name.
+	 */
+	public String				name;
+
+	/**
+	 * The bundle declaring the component description.
+	 */
+	public BundleDTO			bundle;
+
+	/**
+	 * The component factory name.
+	 * 
+	 * <p>
+	 * This is declared in the {@code factory} attribute of the
+	 * {@code component} element. This will be {@code null} if the component
+	 * description is not declared as a component factory.
+	 */
+	public String				factory;
+
+	/**
+	 * The service scope.
+	 * 
+	 * <p>
+	 * This is declared in the {@code scope} attribute of the {@code service}
+	 * element.
+	 */
+	public String				scope;
+
+	/**
+	 * The fully qualified name of the implementation class.
+	 * 
+	 * <p>
+	 * This is declared in the {@code class} attribute of the
+	 * {@code implementation} element.
+	 */
+	public String				implementationClass;
+
+	/**
+	 * The initial enabled state.
+	 * 
+	 * <p>
+	 * This is declared in the {@code enabled} attribute of the
+	 * {@code component} element.
+	 */
+	public boolean				defaultEnabled;
+
+	/**
+	 * The immediate state.
+	 * 
+	 * <p>
+	 * This is declared in the {@code immediate} attribute of the
+	 * {@code component} element.
+	 */
+	public boolean				immediate;
+
+	/**
+	 * The fully qualified names of the service interfaces.
+	 * 
+	 * <p>
+	 * These are declared in the {@code interface} attribute of the
+	 * {@code provide} elements. The array will be empty if the component
+	 * description does not declare any service interfaces.
+	 */
+	public String[]				serviceInterfaces;
+
+	/**
+	 * The declared component properties.
+	 * 
+	 * <p>
+	 * These are declared in the {@code property} and {@code properties}
+	 * elements.
+	 */
+	public Map<String, Object>	properties;
+
+	/**
+	 * The referenced services.
+	 * 
+	 * <p>
+	 * These are declared in the {@code reference} elements. The array will be
+	 * empty if the component description does not declare references to any
+	 * services.
+	 */
+	public ReferenceDTO[]			references;
+
+	/**
+	 * The name of the activate method.
+	 * 
+	 * <p>
+	 * This is declared in the {@code activate} attribute of the
+	 * {@code component} element. This will be {@code null} if the component
+	 * description does not declare an activate method name.
+	 */
+	public String				activate;
+
+	/**
+	 * The name of the deactivate method.
+	 * 
+	 * <p>
+	 * This is declared in the {@code deactivate} attribute of the
+	 * {@code component} element. This will be {@code null} if the component
+	 * description does not declare a deactivate method name.
+	 */
+	public String				deactivate;
+
+	/**
+	 * The name of the modified method.
+	 * 
+	 * <p>
+	 * This is declared in the {@code modified} attribute of the
+	 * {@code component} element. This will be {@code null} if the component
+	 * description does not declare a modified method name.
+	 */
+	public String				modified;
+
+	/**
+	 * The configuration policy.
+	 * 
+	 * <p>
+	 * This is declared in the {@code configuration-policy} attribute of the
+	 * {@code component} element. This will be the default configuration policy
+	 * if the component description does not declare a configuration policy.
+	 */
+	public String				configurationPolicy;
+
+	/**
+	 * The configuration pid.
+	 * 
+	 * <p>
+	 * This is declared in the {@code configuration-pid} attribute of the
+	 * {@code component} element. This will be the default configuration pid if
+	 * the component description does not declare a configuration pid.
+	 */
+	public String[]				configurationPid;
+
+}
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/ReferenceDTO.java b/scr/src/main/java/org/osgi/service/component/runtime/dto/ReferenceDTO.java
new file mode 100755
index 0000000..33fec8b
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/ReferenceDTO.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) OSGi Alliance (2013, 2014). 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.component.runtime.dto;
+
+import org.osgi.dto.DTO;
+
+/**
+ * A representation of a declared reference to a service.
+ * 
+ * @since 1.3
+ * @NotThreadSafe
+ * @author $Id: 2fc8a3deac2ece6b9fff4878dbe3f082faadd5f8 $
+ */
+public class ReferenceDTO extends DTO {
+	/**
+	 * The name of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code name} attribute of the {@code reference}
+	 * element. This will be the default name if the component description does
+	 * not declare a name for the reference.
+	 */
+	public String	name;
+
+	/**
+	 * The service interface of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code interface} attribute of the
+	 * {@code reference} element.
+	 */
+	public String	interfaceName;
+
+	/**
+	 * The cardinality of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code cardinality} attribute of the
+	 * {@code reference} element. This will be the default cardinality if the
+	 * component description does not declare a cardinality for the reference.
+	 */
+	public String	cardinality;
+
+	/**
+	 * The policy of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code policy} attribute of the {@code reference}
+	 * element. This will be the default policy if the component description
+	 * does not declare a policy for the reference.
+	 */
+	public String	policy;
+
+	/**
+	 * The policy option of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code policy-option} attribute of the
+	 * {@code reference} element. This will be the default policy option if the
+	 * component description does not declare a policy option for the reference.
+	 */
+	public String	policyOption;
+
+	/**
+	 * The target of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code target} attribute of the {@code reference}
+	 * element. This will be {@code null} if the component description does not
+	 * declare a target for the reference.
+	 */
+	public String	target;
+
+	/**
+	 * The name of the bind method of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code bind} attribute of the {@code reference}
+	 * element. This will be {@code null} if the component description does not
+	 * declare a bind method for the reference.
+	 */
+	public String	bind;
+
+	/**
+	 * The name of the unbind method of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code unbind} attribute of the {@code reference}
+	 * element. This will be {@code null} if the component description does not
+	 * declare an unbind method for the reference.
+	 */
+	public String	unbind;
+
+	/**
+	 * The name of the updated method of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code updated} attribute of the
+	 * {@code reference} element. This will be {@code null} if the component
+	 * description does not declare an updated method for the reference.
+	 */
+	public String	updated;
+
+	/**
+	 * The scope of the reference.
+	 * 
+	 * <p>
+	 * This is declared in the {@code scope} attribute of the {@code reference}
+	 * element. This will be the default scope if the component description does
+	 * not declare a scope for the reference.
+	 */
+	public String	scope;
+}
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/package-info.java b/scr/src/main/java/org/osgi/service/component/runtime/dto/package-info.java
new file mode 100644
index 0000000..bc806dd
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2014). 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.
+ */
+
+/**
+ * Service Component Runtime Data Transfer Objects Package Version 1.3.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.component.runtime.dto; version="[1.3,1.4)"}
+ *
+ * @author $Id: d7d82da09d67a3ce4274ad8554966c1952a2b4de $
+ */
+
+//@Version("1.3")
+package org.osgi.service.component.runtime.dto;
+
+//import org.osgi.annotation.versioning.Version;
+
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/dto/packageinfo b/scr/src/main/java/org/osgi/service/component/runtime/dto/packageinfo
new file mode 100644
index 0000000..0117a56
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/dto/packageinfo
@@ -0,0 +1 @@
+version 1.3
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/package-info.java b/scr/src/main/java/org/osgi/service/component/runtime/package-info.java
new file mode 100644
index 0000000..55a20c1
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) OSGi Alliance (2013). 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.
+ */
+
+/**
+ * Service Component Runtime Package Version 1.3.
+ *
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest. This package has two types of
+ * users: the consumers that use the API in this package and the providers that
+ * implement the API in this package.
+ *
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.component.runtime; version="[1.3,2.0)"}
+ * <p>
+ * Example import for providers implementing the API in this package:
+ * <p>
+ * {@code  Import-Package: org.osgi.service.component.runtime; version="[1.3,1.4)"}
+ *
+ * @author $Id: 3d4fa42ce33a4682cbaeee3f094b558e6ea6080f $
+ */
+
+//@Version("1.3")
+package org.osgi.service.component.runtime;
+
+//import org.osgi.annotation.versioning.Version;
+
diff --git a/scr/src/main/java/org/osgi/service/component/runtime/packageinfo b/scr/src/main/java/org/osgi/service/component/runtime/packageinfo
new file mode 100644
index 0000000..0117a56
--- /dev/null
+++ b/scr/src/main/java/org/osgi/service/component/runtime/packageinfo
@@ -0,0 +1 @@
+version 1.3