Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBJ Hargrave2012-12-06 15:14:19 +0000
committerBJ Hargrave2012-12-12 20:39:52 +0000
commitcea583eef269022ea7a4397798aa6eb5f48981f6 (patch)
tree36a05e145c07c46d063a3d97f055bd688368f7bc /bundles/org.eclipse.osgi/osgi
parent7ed1cd7fe49fbc5f0805954035e6b3243f9ffe9c (diff)
downloadrt.equinox.framework-cea583eef269022ea7a4397798aa6eb5f48981f6.tar.gz
rt.equinox.framework-cea583eef269022ea7a4397798aa6eb5f48981f6.tar.xz
rt.equinox.framework-cea583eef269022ea7a4397798aa6eb5f48981f6.zip
dto: Add draft of OSGi DTO classes
Add DTO classes from OSGi to implement DTO support in the framework. The manifest is also changed to export these packages.
Diffstat (limited to 'bundles/org.eclipse.osgi/osgi')
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java266
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/BundleDTO.java55
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/FrameworkDTO.java53
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/ServiceReferenceDTO.java54
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/BundleStartLevelDTO.java47
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/FrameworkStartLevelDTO.java42
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionDTO.java54
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionsDTO.java37
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWireDTO.java44
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringDTO.java53
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringsDTO.java37
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/CapabilityDTO.java51
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/RequirementDTO.java51
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/ResourceDTO.java38
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WireDTO.java47
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WiringDTO.java53
16 files changed, 982 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/DTO.java
new file mode 100644
index 000000000..36dd2d0b9
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/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$
+ * @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/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/BundleDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/BundleDTO.java
new file mode 100644
index 000000000..6471333eb
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/BundleDTO.java
@@ -0,0 +1,55 @@
+/*
+ * 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.framework;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Bundle.
+ *
+ * <p>
+ * A Bundle can be adapted to provide a {@code BundleDTO} for the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleDTO extends DTO {
+ /**
+ * The bundle's unique identifier.
+ */
+ public long id;
+
+ /**
+ * The time when the bundle was last modified.
+ */
+ public long lastModified;
+
+ /**
+ * The bundle's state.
+ */
+ public int state;
+
+ /**
+ * The bundle's symbolic name.
+ */
+ public String symbolicName;
+
+ /**
+ * The bundle's version.
+ */
+ public String version;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/FrameworkDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/FrameworkDTO.java
new file mode 100644
index 000000000..bb0524ca0
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/FrameworkDTO.java
@@ -0,0 +1,53 @@
+/*
+ * 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.framework;
+
+import java.util.List;
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * 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$
+ * @NotThreadSafe
+ */
+public class FrameworkDTO extends DTO {
+ /**
+ * The bundles that are installed in the framework.
+ */
+ 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.
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The services that are registered in the framework.
+ */
+ public List<ServiceReferenceDTO> services;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/ServiceReferenceDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/ServiceReferenceDTO.java
new file mode 100644
index 000000000..e6b81ae56
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/ServiceReferenceDTO.java
@@ -0,0 +1,54 @@
+/*
+ * 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.framework;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * 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$
+ * @NotThreadSafe
+ */
+public class ServiceReferenceDTO extends DTO {
+ /**
+ * The id of the bundle that registered the service.
+ */
+ 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.
+ */
+ public Map<String, Object> properties;
+
+ /**
+ * The ids of the bundles that are using the service.
+ */
+ public long[] usingBundles;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/BundleStartLevelDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/BundleStartLevelDTO.java
new file mode 100644
index 000000000..7617fe966
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/BundleStartLevelDTO.java
@@ -0,0 +1,47 @@
+/*
+ * 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.framework.startlevel;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a BundleStartLevel.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleStartLevelDTO}
+ * for the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleStartLevelDTO extends DTO {
+ /**
+ * The assigned start level value for the bundle.
+ */
+ public int startLevel;
+
+ /**
+ * The bundle's autostart setting indicates that the activation policy
+ * declared in the bundle manifest must be used.
+ */
+ public boolean activationPolicyUsed;
+
+ /**
+ * The bundle's autostart setting indicates it must be started.
+ */
+ public boolean persistentlyStarted;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/FrameworkStartLevelDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/FrameworkStartLevelDTO.java
new file mode 100644
index 000000000..a59fb0cee
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/startlevel/FrameworkStartLevelDTO.java
@@ -0,0 +1,42 @@
+/*
+ * 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.framework.startlevel;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a FrameworkStartLevel.
+ *
+ * <p>
+ * The System Bundle can be adapted to provide a {@code FrameworkStartLevelDTO}
+ * for the framework of the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class FrameworkStartLevelDTO extends DTO {
+ /**
+ * The active start level value for the framework.
+ */
+ public int startLevel;
+
+ /**
+ * The initial start level value that is assigned to a bundle when it is
+ * first installed.
+ */
+ public int initialBundleStartLevel;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionDTO.java
new file mode 100644
index 000000000..f179f27f6
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionDTO.java
@@ -0,0 +1,54 @@
+/*
+ * 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.framework.wiring;
+
+import org.osgi.dto.framework.BundleDTO;
+import org.osgi.dto.resource.ResourceDTO;
+
+/**
+ * Data Transfer Object for a BundleWiring.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleRevisionDTO} for
+ * the current revision of the Bundle. {@code BundleRevisionDTO} objects for all
+ * in use revisions of the Bundle can be obtained from a
+ * {@link BundleRevisionsDTO} of the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleRevisionDTO extends ResourceDTO {
+ /**
+ * The symbolic name of the bundle revision.
+ */
+ public String symbolicName;
+
+ /**
+ * The type of the bundle revision.
+ */
+ public int type;
+
+ /**
+ * The version of the bundle revision.
+ */
+ public String version;
+
+ /**
+ * The bundle associated with this bundle revision.
+ */
+ public BundleDTO bundle;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionsDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionsDTO.java
new file mode 100644
index 000000000..369f761b5
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleRevisionsDTO.java
@@ -0,0 +1,37 @@
+/*
+ * 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.framework.wiring;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a BundleRevisions.
+ *
+ * <p>
+ * A Bundle can be adapted to provide a {@code BundleRevisionsDTO} for the in
+ * use revisions of the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleRevisionsDTO extends DTO {
+ /**
+ * Revisions for the bundle. The first revision is the current revision.
+ */
+ public List<BundleRevisionDTO> revisions;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWireDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWireDTO.java
new file mode 100644
index 000000000..039e517c3
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWireDTO.java
@@ -0,0 +1,44 @@
+/*
+ * 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.framework.wiring;
+
+import org.osgi.dto.resource.WireDTO;
+
+/**
+ * Data Transfer Object for a BundleWire.
+ *
+ * <p>
+ * {@code BundleWireDTO}s can be obtained from a {@link BundleWiringDTO}.
+ *
+ * <p>
+ * The {@link WireDTO#requirer requirer} and {@link WireDTO#provider provider}
+ * fields must contain {@link BundleRevisionDTO}s.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleWireDTO extends WireDTO {
+ /**
+ * Provider wiring for the bundle wire.
+ */
+ public BundleWiringDTO providerWiring;
+
+ /**
+ * Requirer wiring for the bundle wire.
+ */
+ public BundleWiringDTO requirerWiring;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringDTO.java
new file mode 100644
index 000000000..89865337a
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringDTO.java
@@ -0,0 +1,53 @@
+/*
+ * 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.framework.wiring;
+
+import org.osgi.dto.resource.WiringDTO;
+
+/**
+ * Data Transfer Object for a BundleWiring.
+ *
+ * <p>
+ * An installed Bundle can be adapted to provide a {@code BundleWiringDTO} for
+ * the current wiring Bundle. {@code BundleWiringDTO} objects for all in use
+ * wirings of the Bundle can be obtained from a {@link BundleWiringsDTO} of the
+ * Bundle.
+ *
+ * <p>
+ * The {@link WiringDTO#providedWires providedWires} field must contain an array
+ * of {@link BundleWireDTO}s. The {@link WiringDTO#requiredWires requiredWires}
+ * field must contain an array of {@link BundleWireDTO}s. The
+ * {@link WiringDTO#resource resource} field must contain a
+ * {@link BundleRevisionDTO}.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleWiringDTO extends WiringDTO {
+ /**
+ * The bundle wiring's in use setting indicates that the bundle wiring is in
+ * use.
+ */
+ public boolean inUse;
+
+ /**
+ * The current state of the bundle wiring. The bundle wiring's current
+ * setting indicates that the bundle wiring is the current bundle wiring for
+ * the bundle.
+ */
+ public boolean current;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringsDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringsDTO.java
new file mode 100644
index 000000000..6c7b55776
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/framework/wiring/BundleWiringsDTO.java
@@ -0,0 +1,37 @@
+/*
+ * 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.framework.wiring;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for the BundleWirings of a bundle.
+ *
+ * <p>
+ * A Bundle can be adapted to provide a {@code BundleWiringsDTO} for the in use
+ * wirings of the Bundle.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class BundleWiringsDTO extends DTO {
+ /**
+ * Wirings for the bundle. The first wiring is the current wiring.
+ */
+ public List<BundleWiringDTO> wirings;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/CapabilityDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/CapabilityDTO.java
new file mode 100644
index 000000000..9fc982a5b
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/CapabilityDTO.java
@@ -0,0 +1,51 @@
+/*
+ * 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.resource;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Capability.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class CapabilityDTO extends DTO {
+ /**
+ * The namespace for the capability.
+ */
+ public String namespace;
+
+ /**
+ * The directives for the capability.
+ */
+ public Map<String, String> directives;
+
+ /**
+ * The attributes for the capability.
+ *
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * The resource declaring this capability.
+ */
+ public ResourceDTO resource;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/RequirementDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/RequirementDTO.java
new file mode 100644
index 000000000..0cbd58c89
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/RequirementDTO.java
@@ -0,0 +1,51 @@
+/*
+ * 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.resource;
+
+import java.util.Map;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Requirement.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class RequirementDTO extends DTO {
+ /**
+ * The namespace for the requirement.
+ */
+ public String namespace;
+
+ /**
+ * The directives for the requirement.
+ */
+ public Map<String, String> directives;
+
+ /**
+ * The attributes for the requirement.
+ *
+ * The value type must be a numerical type, Boolean, String, DTO or an array
+ * of any of the former.
+ */
+ public Map<String, Object> attributes;
+
+ /**
+ * The resource declaring this requirement.
+ */
+ public ResourceDTO resource;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/ResourceDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/ResourceDTO.java
new file mode 100644
index 000000000..fdc4a5c7c
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/ResourceDTO.java
@@ -0,0 +1,38 @@
+/*
+ * 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.resource;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Resource.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class ResourceDTO extends DTO {
+ /**
+ * The capabilities for the resource.
+ */
+ public List<CapabilityDTO> capabilities;
+
+ /**
+ * The requirements for the resource.
+ */
+ public List<RequirementDTO> requirements;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WireDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WireDTO.java
new file mode 100644
index 000000000..31ddb9fa4
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WireDTO.java
@@ -0,0 +1,47 @@
+/*
+ * 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.resource;
+
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Wire.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class WireDTO extends DTO {
+ /**
+ * Capability for the wire.
+ */
+ public CapabilityDTO capability;
+
+ /**
+ * Requirement for the wire.
+ */
+ public RequirementDTO requirement;
+
+ /**
+ * Provider resource for the wire.
+ */
+ public ResourceDTO provider;
+
+ /**
+ * Requiring resource for the wire.
+ */
+ public ResourceDTO requirer;
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WiringDTO.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WiringDTO.java
new file mode 100644
index 000000000..a92b905ff
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/dto/resource/WiringDTO.java
@@ -0,0 +1,53 @@
+/*
+ * 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.resource;
+
+import java.util.List;
+import org.osgi.dto.DTO;
+
+/**
+ * Data Transfer Object for a Wiring.
+ *
+ * @author $Id$
+ * @NotThreadSafe
+ */
+public class WiringDTO extends DTO {
+ /**
+ * The capabilities for the wiring.
+ */
+ public List<CapabilityDTO> capabilities;
+
+ /**
+ * The requirements for the wiring.
+ */
+ public List<RequirementDTO> requirements;
+
+ /**
+ * The provided wires for the wiring.
+ */
+ public List<WireDTO> providedWires;
+
+ /**
+ * The required wires for the wiring.
+ */
+ public List<WireDTO> requiredWires;
+
+ /**
+ * Resource for the wiring.
+ */
+ public ResourceDTO resource;
+}

Back to the top