[jboss-cvs] JBossAS SVN: r95605 - in projects/jboss-osgi/projects/bundles/jmx/trunk: src/main/java/org and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 27 06:20:23 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-10-27 06:20:22 -0400 (Tue, 27 Oct 2009)
New Revision: 95605
Added:
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/Item.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/JmxConstants.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/packageinfo
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/packageinfo
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/packageinfo
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/packageinfo
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/packageinfo
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/package.html
projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/packageinfo
Modified:
projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
Log:
Add org.osgi JMX API
Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2009-10-27 10:15:28 UTC (rev 95604)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml 2009-10-27 10:20:22 UTC (rev 95605)
@@ -27,14 +27,14 @@
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.2</version>
+ <version>1.0.4-SNAPSHOT</version>
</parent>
<!-- Properties -->
<properties>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.jndi>1.0.1</version.jboss.osgi.jndi>
- <version.osgi>r4v42</version.osgi>
+ <version.osgi>4.2.0</version.osgi>
</properties>
<!-- Dependencies -->
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/Item.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/Item.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/Item.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,164 @@
+package org.osgi.jmx;
+
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.TabularType;
+
+/**
+ * The item class enables the definition of open types in the appropriate
+ * interfaces.
+ *
+ * This class contains a number of methods that make it possible to create open
+ * types for {@link CompositeType}, {@link TabularType}, and {@link ArrayType}.
+ * The normal creation throws a checked exception, making it impossible to use
+ * them in a static initializer. They constructors are also not very suitable
+ * for static construction.
+ *
+ *
+ * An Item instance describes an item in a Composite Type. It groups the triplet
+ * of name, description, and Open Type. These Item instances allows the
+ * definitions of an item to stay together.
+ *
+ * @version $Revision$
+ * @Immutable
+ */
+public class Item {
+
+ /**
+ * The name of this item.
+ */
+ private final String name;
+
+ /**
+ * The description of this item.
+ */
+ private final String description;
+
+ /**
+ * The type of this item.
+ */
+ private final OpenType type;
+
+ /**
+ * Create a triple of name, description, and type. This triplet is used in
+ * the creation of a Composite Type.
+ *
+ * @param name The name of the item.
+ * @param description The description of the item.
+ * @param type The Open Type of this item.
+ * @param restrictions Ignored, contains list of restrictions
+ */
+ public Item(String name, String description, OpenType type,
+ String... restrictions) {
+ this.name = name;
+ this.description = description;
+ this.type = type;
+ }
+
+ /**
+ *
+ */
+
+ /**
+ * Create a Tabular Type.
+ *
+ * @param name The name of the Tabular Type.
+ * @param description The description of the Tabular Type.
+ * @param rowType The Open Type for a row
+ * @param index The names of the items that form the index .
+ * @return A new Tabular Type composed from the parameters.
+ * @throws RuntimeException when the Tabular Type throws an
+ * OpenDataException
+ */
+ static public TabularType tabularType(String name, String description,
+ CompositeType rowType, String... index) {
+ try {
+ return new TabularType(name, description, rowType, index);
+ }
+ catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Create a Composite Type
+ *
+ * @param name The name of the Tabular Type.
+ * @param description The description of the Tabular Type.
+ * @param items The items that describe the composite type.
+ * @return a new Composite Type
+ * @throws RuntimeException when the Tabular Type throws an
+ * OpenDataException
+ */
+ static public CompositeType compositeType(String name, String description,
+ Item... items) {
+ return extend(null, name, description, items);
+ }
+
+ /**
+ * Return a new Array Type.
+ *
+ * @param dim The dimension
+ * @param elementType The element type
+ * @return A new Array Type
+ */
+ public static ArrayType arrayType(int dim, OpenType elementType) {
+ try {
+ return new ArrayType(dim, elementType);
+ }
+ catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Extend a Composite Type by adding new items. Items can override items in
+ * the parent type.
+ *
+ * @param parent The parent type, can be <code>null</code>
+ * @param name The name of the type
+ * @param description The description of the type
+ * @param items The items that should be added/override to the parent type
+ * @return A new Composite Type that extends the parent type
+ * @throws RuntimeException when an OpenDataException is thrown
+ */
+ public static CompositeType extend(CompositeType parent, String name,
+ String description, Item... items) {
+ Set<Item> all = new LinkedHashSet<Item>();
+
+ if (parent != null) {
+ for (Object nm : parent.keySet()) {
+ String key = (String) nm;
+ all.add(new Item((String) nm, parent.getDescription(key),
+ parent.getType(key)));
+ }
+ }
+
+ all.addAll(Arrays.asList(items));
+
+ String names[] = new String[all.size()];
+ String descriptions[] = new String[all.size()];
+ OpenType types[] = new OpenType[all.size()];
+
+ for (int n = 0; n < types.length; n++) {
+ names[n] = items[n].name;
+ descriptions[n] = items[n].description;
+ types[n] = items[n].type;
+ }
+
+ try {
+ return new CompositeType(name, description, names, descriptions,
+ types);
+ }
+ catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/Item.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/JmxConstants.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/JmxConstants.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/JmxConstants.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularType;
+
+/**
+ * Constants for OSGi JMX Specification.
+ *
+ * Additionally, this class contains a number of utility types that are used in
+ * different places in the specification. These are {@link #LONG_ARRAY_TYPE},
+ * {@link #STRING_ARRAY_TYPE}, and {@link #PROPERTIES_TYPE}.
+ *
+ * @version $Revision$
+ * @Immutable
+ */
+public class JmxConstants {
+
+ /*
+ * Empty constructor to make sure this is not used as an object.
+ */
+ private JmxConstants() {
+ // empty
+ }
+
+ /**
+ * The MBean Open type for an array of strings
+ */
+ public static final ArrayType STRING_ARRAY_TYPE = Item
+ .arrayType(
+ 1,
+ SimpleType.STRING);
+ /**
+ * The MBean Open type for an array of longs
+ */
+ public static final ArrayType LONG_ARRAY_TYPE = Item
+ .arrayType(
+ 1,
+ SimpleType.LONG);
+
+ /**
+ * For an encoded array we need to start with ARRAY_OF. This must be
+ * followed by one of the names in {@link #SCALAR}.
+ *
+ */
+ public final static String ARRAY_OF = "Array of ";
+
+ /**
+ * For an encoded vector we need to start with ARRAY_OF. This must be
+ * followed by one of the names in {@link #SCALAR}.
+ */
+ public final static String VECTOR_OF = "Vector of ";
+
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.String}
+ */
+ public static final String STRING = "String";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Integer}
+ */
+ public static final String INTEGER = "Integer";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Long}
+ */
+ public static final String LONG = "Long";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Float}
+ */
+ public static final String FLOAT = "Float";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Double}
+ */
+ public static final String DOUBLE = "Double";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Byte}
+ */
+ public static final String BYTE = "Byte";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Short}
+ */
+ public static final String SHORT = "Short";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Character}
+ */
+ public static final String CHARACTER = "Character";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.lang.Boolean}
+ */
+ public static final String BOOLEAN = "Boolean";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.math.BigDecimal}
+ */
+ public static final String BIGDECIMAL = "BigDecimal";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * {@link java.math.BigInteger}
+ */
+ public static final String BIGINTEGER = "BigInteger";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>double</code> primitive type.
+ */
+ public static final String P_DOUBLE = "double";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>float</code> primitive type.
+ */
+ public static final String P_FLOAT = "float";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>long</code> primitive type.
+ */
+ public static final String P_LONG = "long";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>int</code> primitive type.
+ */
+ public static final String P_INT = "int";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>short</code> primitive type.
+ */
+ public static final String P_SHORT = "short";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>byte</code> primitive type.
+ */
+ public static final String P_BYTE = "byte";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>char</code> primitive type.
+ */
+ public static final String P_CHAR = "char";
+ /**
+ * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+ * the <code>boolean</code> primitive type.
+ */
+ public static final String P_BOOLEAN = "boolean";
+
+ /**
+ * A set of all scalars that can be used in the {@link #TYPE} property of a
+ * {@link #PROPERTIES_TYPE}. This contains the following names:
+ * <ul>
+ * <li>{@link #BIGDECIMAL}</li>
+ * <li>{@link #BIGINTEGER}</li>
+ * <li>{@link #BOOLEAN}</li>
+ * <li>{@link #BYTE}</li>
+ * <li>{@link #CHARACTER}</li>
+ * <li>{@link #DOUBLE}</li>
+ * <li>{@link #FLOAT}</li>
+ * <li>{@link #INTEGER}</li>
+ * <li>{@link #LONG}</li>
+ * <li>{@link #SHORT}</li>
+ * <li>{@link #STRING}</li>
+ * <li>{@link #P_BYTE}</li>
+ * <li>{@link #P_CHAR}</li>
+ * <li>{@link #P_DOUBLE}</li>
+ * <li>{@link #P_FLOAT}</li>
+ * <li>{@link #P_INT}</li>
+ * <li>{@link #P_LONG}</li>
+ * <li>{@link #P_SHORT}</li>
+ */
+ public final static Set<String> SCALAR = new HashSet<String>(
+ Arrays
+ .asList(
+ STRING,
+ INTEGER,
+ LONG,
+ FLOAT,
+ DOUBLE,
+ BYTE,
+ SHORT,
+ CHARACTER,
+ BOOLEAN,
+ BIGDECIMAL,
+ BIGINTEGER,
+ P_BYTE,
+ P_CHAR,
+ P_SHORT,
+ P_INT,
+ P_LONG,
+ P_DOUBLE,
+ P_FLOAT));
+ /**
+ * The key KEY.
+ */
+ public static final String KEY = "Key";
+ /**
+ * The key of a property. The key is {@link #KEY} and the type is
+ * {@link SimpleType#STRING}.
+ */
+ public static final Item KEY_ITEM = new Item(
+ KEY,
+ "The key of the property",
+ SimpleType.STRING);
+
+ /**
+ * The key VALUE.
+ */
+ public static final String VALUE = "Value";
+
+ /**
+ * The value of a property. The key is {@link #VALUE} and the type is
+ * {@link SimpleType#STRING}. A value will be encoded by the string given in
+ * {@link #TYPE}. The syntax for this type is given in {@link #TYPE_ITEM}.
+ */
+ public static final Item VALUE_ITEM = new Item(
+ VALUE,
+ "The value of the property",
+ SimpleType.STRING);
+
+ /**
+ * The key PROPERTY_TYPE.
+ *
+ * ### can we call this value PropertyType and service type ServiceType?
+ */
+ public static final String TYPE = "Type";
+
+ /**
+ * The type of the property. The key is {@link #TYPE} and the type is
+ * {@link SimpleType#STRING}. This string must follow the following syntax:
+ *
+ * TYPE ::= ( 'Array of ' | 'Vector of ' )? {@link #SCALAR}
+ *
+ * ### why can't we just use the class name?
+ *
+ * ### why do we have to distinguish between primitives and wrappers?
+ */
+ public static final Item TYPE_ITEM = new Item(
+ TYPE,
+ "The type of the property",
+ SimpleType.STRING, //
+ STRING,
+ INTEGER,
+ LONG,
+ FLOAT,
+ DOUBLE,
+ BYTE,
+ SHORT,
+ CHARACTER,
+ BOOLEAN,
+ BIGDECIMAL,
+ BIGINTEGER,
+ P_DOUBLE,
+ P_FLOAT,
+ P_LONG,
+ P_INT,
+ P_SHORT,
+ P_CHAR,
+ P_BYTE,
+ P_BOOLEAN);
+
+ /**
+ * A Composite Type describing a a single property. A property consists of
+ * the following items {@link #KEY_ITEM}, {@link #VALUE_ITEM}, and
+ * {@link #TYPE_ITEM}.
+ */
+ public static final CompositeType PROPERTY_TYPE = Item
+ .compositeType(
+ "PROPERTY",
+ "This type encapsulates a key/value pair",
+ KEY_ITEM,
+ VALUE_ITEM,
+ TYPE_ITEM);
+
+ /**
+ * Describes a map with properties. The row type is {@link #PROPERTY_TYPE}.
+ * The index is defined to the {@link #KEY} of the property.
+ */
+ public static final TabularType PROPERTIES_TYPE = Item
+ .tabularType(
+ "PROPERTIES",
+ "A table of PROPERTY",
+ PROPERTY_TYPE,
+ KEY);
+
+ /**
+ * The domain name of the core OSGi MBeans
+ */
+ public static final String OSGI_CORE = "osgi.core";
+
+ /**
+ * The domain name of the selected OSGi compendium MBeans
+ */
+ public static final String OSGI_COMPENDIUM = "osgi.compendium";
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/JmxConstants.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,676 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.framework;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+import org.osgi.jmx.Item;
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean represents the Bundle state of the framework. This MBean also
+ * emits events that clients can use to get notified of the changes in the
+ * bundle state of the framework.
+ *
+ * @version $Revision$
+ */
+public interface BundleStateMBean {
+ /**
+ * The Object Name for a Bundle State MBean.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_CORE
+ + ":type=bundleState,version=1.5";
+
+ /**
+ * The key KEY, used in {@link #KEY_ITEM}.
+ */
+ String KEY = "Key";
+
+ /**
+ * The item describing the key of a bundle header entry. The key is
+ * {@link #KEY} and the type is {@link SimpleType#STRING}.
+ */
+ Item KEY_ITEM = new Item(
+ KEY,
+ "The bundle header key",
+ SimpleType.STRING);
+ /**
+ * The key VALUE, used in {@link #VALUE_ITEM}.
+ */
+ String VALUE = "Value";
+ /**
+ * The item describing the value of a bundle header entry. The key is
+ * {@link #VALUE} and the type is {@link SimpleType#STRING}.
+ */
+ Item VALUE_ITEM = new Item(
+ VALUE,
+ "The bundle header value",
+ SimpleType.STRING);
+
+ /**
+ * The Composite Type describing an entry in bundle headers. It consists of
+ * {@link #KEY_ITEM} and {@link #VALUE_ITEM}.
+ */
+ CompositeType HEADER_TYPE = Item
+ .compositeType(
+ "HEADER",
+ "This type encapsulates OSGi bundle header key/value pairs",
+ KEY_ITEM,
+ VALUE_ITEM);
+
+ /**
+ * The Tabular Type describing the type of the Tabular Data value that is
+ * returned from {@link #getHeaders(long)} method. The primary item is
+ * {@link #KEY_ITEM}.
+ */
+ TabularType HEADERS_TYPE = Item
+ .tabularType(
+ "HEADERS",
+ "The table of bundle headers",
+ HEADER_TYPE,
+ new String[] {KEY});
+
+ /**
+ * The key LOCATION, used in {@link #LOCATION_ITEM}.
+ */
+ String LOCATION = "Location";
+ /**
+ * The item containing the bundle location in {@link #BUNDLE_TYPE}. The key
+ * is {@link #LOCATION} and the the type is {@link SimpleType#STRING}.
+ */
+ Item LOCATION_ITEM = new Item(
+ LOCATION,
+ "The location of the bundle",
+ SimpleType.STRING);
+
+ /**
+ * The key IDENTIFIER, used in {@link #IDENTIFIER_ITEM}.
+ */
+ String IDENTIFIER = "Identifier";
+
+ /**
+ * The item containing the bundle identifier in {@link #BUNDLE_TYPE}. The
+ * key is {@link #IDENTIFIER} and the the type is {@link SimpleType#LONG}.
+ */
+ Item IDENTIFIER_ITEM = new Item(IDENTIFIER,
+ "The id of the bundle",
+ SimpleType.LONG);
+ /**
+ * The key SYMBOLIC_NAME, used in {@link #SYMBOLIC_NAME_ITEM}.
+ */
+ String SYMBOLIC_NAME = "SymbolicName";
+
+ /**
+ * The item containing the symbolic name in {@link #BUNDLE_TYPE}. The key is
+ * {@link #SYMBOLIC_NAME} and the the type is {@link SimpleType#STRING}.
+ */
+ Item SYMBOLIC_NAME_ITEM = new Item(
+ SYMBOLIC_NAME,
+ "The symbolic name of the bundle",
+ SimpleType.STRING);
+ /**
+ * The key VERSION, used in {@link #VERSION_ITEM}.
+ */
+ String VERSION = "Version";
+
+ /**
+ * The item containing the symbolic name in {@link #BUNDLE_TYPE}. The key is
+ * {@link #SYMBOLIC_NAME} and the the type is {@link SimpleType#STRING}.
+ */
+ Item VERSION_ITEM = new Item(
+ VERSION,
+ "The version of the bundle",
+ SimpleType.STRING);
+ /**
+ * The key START_LEVEL, used in {@link #START_LEVEL_ITEM}.
+ */
+ String START_LEVEL = "StartLevel";
+
+ /**
+ * The item containing the start level in {@link #BUNDLE_TYPE}. The key is
+ * {@link #START_LEVEL} and the the type is {@link SimpleType#INTEGER}.
+ */
+ Item START_LEVEL_ITEM = new Item(
+ START_LEVEL,
+ "The start level of the bundle",
+ SimpleType.INTEGER);
+ /**
+ * The key STATE, used in {@link #STATE_ITEM}.
+ */
+ String STATE = "State";
+
+ /**
+ * Constant INSTALLED for the {@link #STATE}
+ */
+ String INSTALLED = "INSTALLED";
+ /**
+ * Constant RESOLVED for the {@link #STATE}
+ */
+ String RESOLVED = "RESOLVED";
+ /**
+ * Constant STARTING for the {@link #STATE}
+ */
+ String STARTING = "STARTING";
+ /**
+ * Constant ACTIVE for the {@link #STATE}
+ */
+ String ACTIVE = "ACTIVE";
+ /**
+ * Constant STOPPING for the {@link #STATE}
+ */
+ String STOPPING = "STOPPING";
+ /**
+ * Constant UNINSTALLED for the {@link #STATE}
+ */
+ String UNINSTALLED = "UNINSTALLED";
+ /**
+ * Constant UNKNOWN for the {@link #STATE}
+ */
+ String UNKNOWN = "UNKNOWN";
+ /**
+ * The item containing the bundle state in {@link #BUNDLE_TYPE}. The key is
+ * {@link #STATE} and the the type is {@link SimpleType#STRING}. The
+ * returned values must be one of the following strings:
+ * <ul>
+ * <li>{@link #INSTALLED}</li>
+ * <li>{@link #RESOLVED}</li>
+ * <li>{@link #STARTING}</li>
+ * <li>{@link #ACTIVE}</li>
+ * <li>{@link #STOPPING}</li>
+ * <li>{@link #UNINSTALLED}</li>
+ * <li>{@link #UNKNOWN}</li>
+ * </ul>
+ */
+ Item STATE_ITEM = new Item(
+ STATE,
+ "The state of the bundle",
+ SimpleType.STRING,
+ INSTALLED, RESOLVED,
+ STARTING, ACTIVE,
+ STOPPING, UNINSTALLED,
+ UNKNOWN);
+ /**
+ * The key LAST_MODIFIED, used in {@link #LAST_MODIFIED_ITEM}.
+ */
+ String LAST_MODIFIED = "LastModified";
+
+ /**
+ * The item containing the last modified time in the {@link #BUNDLE_TYPE}.
+ * The key is {@link #LAST_MODIFIED} and the the type is
+ * {@link SimpleType#LONG}.
+ */
+ Item LAST_MODIFIED_ITEM = new Item(
+ LAST_MODIFIED,
+ "The last modification time of the bundle",
+ SimpleType.LONG);
+ /**
+ * The key PERSISTENTLY_STARTED, used in {@link #PERSISTENTLY_STARTED_ITEM}.
+ */
+ String PERSISTENTLY_STARTED = "PeristentlyStarted";
+
+ /**
+ * The item containing the indication of persistently started in
+ * {@link #BUNDLE_TYPE}. The key is {@link #PERSISTENTLY_STARTED} and the
+ * the type is {@link SimpleType#BOOLEAN}.
+ */
+ Item PERSISTENTLY_STARTED_ITEM = new Item(
+ PERSISTENTLY_STARTED,
+ "Whether the bundle is persistently started",
+ SimpleType.BOOLEAN);
+ /**
+ * The key REMOVAL_PENDING, used in {@link #REMOVAL_PENDING_ITEM}.
+ */
+ String REMOVAL_PENDING = "RemovalPending";
+
+ /**
+ * The item containing the indication of removal pending in
+ * {@link #BUNDLE_TYPE}. The key is {@link #REMOVAL_PENDING} and the type is
+ * {@link SimpleType#BOOLEAN}.
+ */
+ Item REMOVAL_PENDING_ITEM = new Item(
+ REMOVAL_PENDING,
+ "Whether the bundle is pending removal",
+ SimpleType.BOOLEAN);
+ /**
+ * The key REQUIRED, used in {@value #REQUIRED_ITEM}.
+ */
+ String REQUIRED = "Required";
+
+ /**
+ * The item containing the required status in {@link #BUNDLE_TYPE}. The key
+ * is {@link #REQUIRED} and the the type is {@link SimpleType#BOOLEAN}.
+ */
+ Item REQUIRED_ITEM = new Item(
+ REQUIRED,
+ "Whether the bundle is required",
+ SimpleType.BOOLEAN);
+ /**
+ * The key FRAGMENT, used in {@value #FRAGMENT_ITEM}.
+ */
+ String FRAGMENT = "Fragment";
+
+ /**
+ * The item containing the fragment status in {@link #BUNDLE_TYPE}. The key
+ * is {@link #FRAGMENT} and the the type is {@link SimpleType#BOOLEAN}.
+ */
+ Item FRAGMENT_ITEM = new Item(
+ FRAGMENT,
+ "Whether the bundle is a fragment",
+ SimpleType.BOOLEAN);
+ /**
+ * The key REGISTERED_SERVICES, used in {@value #REGISTERED_SERVICES_ITEM}.
+ */
+ String REGISTERED_SERVICES = "RegisteredServices";
+
+ /**
+ * The item containing the registered services of the bundle in
+ * {@link #BUNDLE_TYPE}. The key is {@link #REGISTERED_SERVICES} and the the
+ * type is {@link JmxConstants#LONG_ARRAY_TYPE}.
+ */
+ Item REGISTERED_SERVICES_ITEM = new Item(
+ REGISTERED_SERVICES,
+ "The registered services of the bundle",
+ JmxConstants.LONG_ARRAY_TYPE);
+ /**
+ * The key SERVICES_IN_USE, used in {@value #SERVICES_IN_USE_ITEM}.
+ */
+ String SERVICES_IN_USE = "ServicesInUse";
+
+ /**
+ * The item containing the services in use by this bundle in
+ * {@link #BUNDLE_TYPE}. The key is {@link #SERVICES_IN_USE} and the the
+ * type is {@link JmxConstants#LONG_ARRAY_TYPE}.
+ */
+ Item SERVICES_IN_USE_ITEM = new Item(
+ SERVICES_IN_USE,
+ "The services in use by the bundle",
+ JmxConstants.LONG_ARRAY_TYPE);
+ /**
+ * The key HEADERS, used in {@link #HEADERS_ITEM}.
+ */
+ String HEADERS = "Headers";
+
+ /**
+ * The item containing the bundle headers in {@link #BUNDLE_TYPE}. The key
+ * is {@link #HEADERS} and the the type is {@link #HEADERS_TYPE}.
+ */
+ Item HEADERS_ITEM = new Item(
+ HEADERS,
+ "The headers of the bundle",
+ HEADERS_TYPE);
+
+ /**
+ * The key EXPORTED_PACKAGES, used in {@link #EXPORTED_PACKAGES_ITEM}.
+ */
+ String EXPORTED_PACKAGES = "ExportedPackages";
+
+ /**
+ * The item containing the exported package names in {@link #BUNDLE_TYPE}
+ * .The key is {@link #EXPORTED_PACKAGES} and the the type is
+ * {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ Item EXPORTED_PACKAGES_ITEM = new Item(
+ EXPORTED_PACKAGES,
+ "The exported packages of the bundle",
+ JmxConstants.STRING_ARRAY_TYPE);
+ /**
+ * The key IMPORTED_PACKAGES, used in {@link #EXPORTED_PACKAGES_ITEM}.
+ */
+ String IMPORTED_PACKAGES = "ImportedPackages";
+
+ /**
+ * The item containing the imported package names in {@link #BUNDLE_TYPE}
+ * .The key is {@link #IMPORTED_PACKAGES} and the the type is
+ * {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ Item IMPORTED_PACKAGES_ITEM = new Item(
+ IMPORTED_PACKAGES,
+ "The imported packages of the bundle",
+ JmxConstants.STRING_ARRAY_TYPE);
+ /**
+ * The key FRAGMENTS, used in {@link #FRAGMENTS_ITEM}.
+ */
+ String FRAGMENTS = "Fragments";
+
+ /**
+ * The item containing the list of fragments the bundle is host to in
+ * {@link #BUNDLE_TYPE}. The key is {@link #FRAGMENTS} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}.
+ */
+ Item FRAGMENTS_ITEM = new Item(
+ FRAGMENTS,
+ "The fragments of which the bundle is host",
+ JmxConstants.LONG_ARRAY_TYPE);
+ /**
+ * The key HOSTS, used in {@link #HOSTS_ITEM}.
+ */
+ String HOSTS = "Hosts";
+
+ /**
+ * The item containing the bundle identifiers representing the hosts in
+ * {@link #BUNDLE_TYPE}. The key is {@link #HOSTS} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}
+ */
+ Item HOSTS_ITEM = new Item(
+ HOSTS,
+ "The fragments of which the bundle is host",
+ JmxConstants.LONG_ARRAY_TYPE);
+ /**
+ * The key REQUIRED_BUNDLES, used in {@link #REQUIRED_BUNDLES_ITEM}.
+ */
+ String REQUIRED_BUNDLES = "RequiredBundles";
+
+ /**
+ * The item containing the required bundles in {@link #BUNDLE_TYPE}. The key
+ * is {@link #REQUIRED_BUNDLES} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}
+ */
+ Item REQUIRED_BUNDLES_ITEM = new Item(
+ REQUIRED_BUNDLES,
+ "The required bundles the bundle",
+ JmxConstants.LONG_ARRAY_TYPE);
+ /**
+ * The key REQUIRING_BUNDLES, used in {@link #REQUIRING_BUNDLES_ITEM}.
+ */
+ String REQUIRING_BUNDLES = "RequiringBundles";
+
+ /**
+ * The item containing the bundles requiring this bundle in
+ * {@link #BUNDLE_TYPE}. The key is {@link #REQUIRING_BUNDLES} and the type
+ * is {@link JmxConstants#LONG_ARRAY_TYPE}
+ */
+ Item REQUIRING_BUNDLES_ITEM = new Item(
+ REQUIRING_BUNDLES,
+ "The bundles requiring the bundle",
+ JmxConstants.LONG_ARRAY_TYPE);
+
+ /**
+ * The Composite Type that represents a bundle. This composite consist of:
+ * <ul>
+ * <li>{@link #EXPORTED_PACKAGES}</li>
+ * <li>{@link #FRAGMENT}</li>
+ * <li>{@link #FRAGMENTS}</li>
+ * <li>{@link #HEADERS}</li>
+ * <li>{@link #HOSTS}</li>
+ * <li>{@link #IDENTIFIER}</li>
+ * <li>{@link #IMPORTED_PACKAGES}</li>
+ * <li>{@link #LAST_MODIFIED}</li>
+ * <li>{@link #LOCATION}</li>
+ * <li>{@link #PERSISTENTLY_STARTED}</li>
+ * <li>{@link #REGISTERED_SERVICES}</li>
+ * <li>{@link #REMOVAL_PENDING}</li>
+ * <li>{@link #REQUIRED}</li>
+ * <li>{@link #REQUIRED_BUNDLES}</li>
+ * <li>{@link #REQUIRING_BUNDLES}</li>
+ * <li>{@link #START_LEVEL}</li>
+ * <li>{@link #STATE}</li>
+ * <li>{@link #SERVICES_IN_USE}</li>
+ * <li>{@link #SYMBOLIC_NAME}</li>
+ * <li>{@link #VERSION}</li>
+ * </ul>
+ * It is used by {@link #BUNDLES_TYPE}.
+ */
+ CompositeType BUNDLE_TYPE = Item
+ .compositeType(
+ "BUNDLE",
+ "This type encapsulates OSGi bundles",
+ EXPORTED_PACKAGES_ITEM,
+ FRAGMENT_ITEM,
+ FRAGMENTS_ITEM,
+ HEADERS_ITEM,
+ HOSTS_ITEM,
+ IDENTIFIER_ITEM,
+ IMPORTED_PACKAGES_ITEM,
+ LAST_MODIFIED_ITEM,
+ LOCATION_ITEM,
+ PERSISTENTLY_STARTED_ITEM,
+ REGISTERED_SERVICES_ITEM,
+ REMOVAL_PENDING_ITEM,
+ REQUIRED_ITEM,
+ REQUIRED_BUNDLES_ITEM,
+ REQUIRING_BUNDLES_ITEM,
+ START_LEVEL_ITEM,
+ STATE_ITEM,
+ SERVICES_IN_USE_ITEM,
+ SYMBOLIC_NAME_ITEM,
+ VERSION_ITEM);
+
+ /**
+ * The Tabular Type for a list of bundles. The row type is
+ * {@link #BUNDLE_TYPE}.
+ */
+ TabularType BUNDLES_TYPE = Item
+ .tabularType(
+ "BUNDLES",
+ "A list of bundles",
+ BUNDLE_TYPE,
+ new String[] {IDENTIFIER});
+
+ /**
+ * Answer the list of identifiers of the bundles this bundle depends upon
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @return the list of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getRequiredBundles(long bundleIdentifier) throws IOException;
+
+ /**
+ * Answer the bundle state of the system in tabular form.
+ *
+ * Each row of the returned table represents a single bundle. The Tabular
+ * Data consists of Composite Data that is type by {@link #BUNDLES_TYPE}.
+ *
+ * @return the tabular representation of the bundle state
+ * @throws IOException
+ */
+ TabularData listBundles() throws IOException;
+
+ /**
+ * Answer the list of exported packages for this bundle.
+ *
+ * @param bundleId
+ * @return the array of package names, combined with their version in the
+ * format <packageName;version>
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String[] getExportedPackages(long bundleId) throws IOException;
+
+ /**
+ * Answer the list of the bundle ids of the fragments associated with this
+ * bundle
+ *
+ * @param bundleId
+ * @return the array of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getFragments(long bundleId) throws IOException;
+
+ /**
+ * Answer the headers for the bundle uniquely identified by the bundle id.
+ * The Tabular Data is typed by the {@link #HEADERS_TYPE}.
+ *
+ * @param bundleId the unique identifier of the bundle
+ * @return the table of associated header key and values
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ TabularData getHeaders(long bundleId) throws IOException;
+
+ /**
+ * Answer the list of bundle ids of the bundles which host a fragment
+ *
+ * @param fragment the bundle id of the fragment
+ * @return the array of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getHosts(long fragment) throws IOException;
+
+ /**
+ * Answer the array of the packages imported by this bundle
+ *
+ * @param bundleId the bundle identifier
+ * @return the array of package names, combined with their version in the
+ * format <packageName;version>
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String[] getImportedPackages(long bundleId) throws IOException;
+
+ /**
+ * Answer the last modified time of a bundle
+ *
+ * @param bundleId the unique identifier of a bundle
+ * @return the last modified time
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long getLastModified(long bundleId) throws IOException;
+
+ /**
+ * Answer the list of service identifiers representing the services this
+ * bundle exports
+ *
+ * @param bundleId the bundle identifier
+ * @return the list of service identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getRegisteredServices(long bundleId) throws IOException;
+
+ /**
+ * Answer the list of identifiers of the bundles which require this bundle
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @return the list of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getRequiringBundles(long bundleIdentifier) throws IOException;
+
+ /**
+ * Answer the list of service identifiers which refer to the the services
+ * this bundle is using
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @return the list of service identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ long[] getServicesInUse(long bundleIdentifier) throws IOException;
+
+ /**
+ * Answer the start level of the bundle
+ *
+ * @param bundleId the identifier of the bundle
+ * @return the start level
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ int getStartLevel(long bundleId) throws IOException;
+
+ /**
+ * Answer the symbolic name of the state of the bundle
+ *
+ * @param bundleId the identifier of the bundle
+ * @return the string name of the bundle state
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String getState(long bundleId) throws IOException;
+
+ /**
+ * Answer the symbolic name of the bundle
+ *
+ * @param bundleId the identifier of the bundle
+ * @return the symbolic name
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String getSymbolicName(long bundleId) throws IOException;
+
+ /**
+ * Answer if the bundle is persistently started when its start level is
+ * reached
+ *
+ * @param bundleId the identifier of the bundle
+ * @return true if the bundle is persistently started
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ boolean isPersistentlyStarted(long bundleId) throws IOException;
+
+ /**
+ * Answer whether the bundle is a fragment or not
+ *
+ * @param bundleId the identifier of the bundle
+ * @return true if the bundle is a fragment
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ boolean isFragment(long bundleId) throws IOException;
+
+ /**
+ * Answer true if the bundle is pending removal
+ *
+ * @param bundleId the identifier of the bundle
+ * @return true if the bundle is pending removal
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ boolean isRemovalPending(long bundleId) throws IOException;
+
+ /**
+ * Answer true if the bundle is required by another bundle
+ *
+ * @param bundleId the identifier of the bundle
+ * @return true if the bundle is required by another bundle
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ boolean isRequired(long bundleId) throws IOException;
+
+ /**
+ * Answer the location of the bundle.
+ *
+ * @param bundleId the identifier of the bundle
+ * @return The location string of this bundle
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String getLocation(long bundleId) throws IOException;
+
+ /**
+ * Answer the location of the bundle.
+ *
+ * @param bundleId the identifier of the bundle
+ * @return The location string of this bundle
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ String getVersion(long bundleId) throws IOException;
+
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,495 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.framework;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+
+import org.osgi.jmx.Item;
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * The FrameworkMbean provides mechanisms to exert control over the framework.
+ * For many operations, it provides a batch mechanism to avoid excessive message
+ * passing when interacting remotely.
+ *
+ * ### Need to indicate which fields are mandatory and which fields are
+ * optional?
+ *
+ * @version $Revision$
+ */
+public interface FrameworkMBean {
+ /**
+ * The fully qualified object name of this mbean.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_CORE
+ + ":type=framework,version=1.5";
+
+ /**
+ * The SUCCESS, used in {@link #SUCCESS_ITEM}.
+ */
+ String SUCCESS = "Success";
+
+ /**
+ * The item that indicates if this operation was successful. The key is
+ * {@link #SUCCESS} and the type is {@link SimpleType#BOOLEAN}. It is used
+ * in {@link #BATCH_ACTION_RESULT_TYPE} and
+ * {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ Item SUCCESS_ITEM = new Item(
+ SUCCESS,
+ "Whether the operation was successful",
+ SimpleType.BOOLEAN);
+
+ /**
+ * The key ERROR, used in {@link #ERROR_ITEM}.
+ */
+ String ERROR = "Error";
+
+ /**
+ * The item containing the error message of the batch operation. The key is
+ * {@link #ERROR} and the type is {@link SimpleType#STRING}. It is used in
+ * {@link #BATCH_ACTION_RESULT_TYPE} and {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ Item ERROR_ITEM = new Item(
+ ERROR,
+ "The error message if unsuccessful",
+ SimpleType.STRING);
+
+ /**
+ * The key COMPLETED, used in {@link #COMPLETED_ITEM}.
+ */
+ String COMPLETED = "Completed";
+
+ /**
+ * The item containing the list of bundles completing the batch operation.
+ * The key is {@link #COMPLETED} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}. It is used in
+ * {@link #BATCH_ACTION_RESULT_TYPE} and {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ Item COMPLETED_ITEM = new Item(
+ COMPLETED,
+ "The bundle ids of the successfully completed installs",
+ JmxConstants.LONG_ARRAY_TYPE);
+
+ /**
+ * The key for BUNDLE_IN_ERROR. This key is used with two different items:
+ * {@link #BUNDLE_IN_ERROR_ID_ITEM} and
+ * {@link #BUNDLE_IN_ERROR_LOCATION_ITEM} that each have a different type
+ * for this key. It is used in {@link #BATCH_ACTION_RESULT_TYPE} and
+ * {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ String BUNDLE_IN_ERROR = "BundleInError";
+
+ /**
+ * The item containing the bundle which caused the error during the batch
+ * operation. This item describes the bundle in error as an id. The key is
+ * {@link #BUNDLE_IN_ERROR} and the type is {@link SimpleType#LONG}. It is
+ * used in {@link #BATCH_ACTION_RESULT_TYPE}.
+ *
+ * @see #BUNDLE_IN_ERROR_LOCATION_ITEM for the item that has a location for
+ * the bundle in error.
+ */
+ Item BUNDLE_IN_ERROR_ID_ITEM = new Item(
+ BUNDLE_IN_ERROR,
+ "The id of the bundle causing the error",
+ SimpleType.LONG);
+
+ /**
+ * The key REMAINING, used in {@link #REMAINING_ID_ITEM} and
+ * {@link #REMAINING_LOCATION_ITEM}.
+ */
+ String REMAINING = "Remaining";
+
+ /**
+ * The item containing the list of remaining bundles unprocessed by the
+ * failing batch operation. The key is {@link #REMAINING} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}. It is used in
+ * {@link #BATCH_ACTION_RESULT_TYPE} and {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ Item REMAINING_ID_ITEM = new Item(
+ REMAINING,
+ "The ids of the remaining bundles",
+ JmxConstants.LONG_ARRAY_TYPE);
+
+ /**
+ * The Composite Type for a batch action result.
+ * {@link #refreshPackages(long)} and {@link #refreshPackages(long[])}.
+ * Notice that a batch action result returns uses an id for the
+ * {@link #BUNDLE_IN_ERROR} while the {@link #BATCH_INSTALL_RESULT_TYPE}
+ * uses a location.
+ *
+ * This Composite Type consists of the following items:
+ * <ul>
+ * <li>{@link #BUNDLE_IN_ERROR_ID_ITEM}</li>
+ * <li>{@link #COMPLETED_ITEM}</li>
+ * <li>{@link #ERROR_ITEM}</li>
+ * <li>{@link #REMAINING_ID_ITEM}</li>
+ * <li>{@link #SUCCESS_ITEM}</li>
+ * </ul>
+ */
+ CompositeType BATCH_ACTION_RESULT_TYPE = Item
+ .compositeType(
+ "BUNDLE_ACTION_RESULT",
+ "This type encapsulates a bundle batch install action result",
+ BUNDLE_IN_ERROR_ID_ITEM,
+ COMPLETED_ITEM,
+ ERROR_ITEM,
+ REMAINING_ID_ITEM,
+ SUCCESS_ITEM //
+ );
+
+ /**
+ * The item containing the bundle which caused the error during the batch
+ * operation. This item describes the bundle in error as a location. The key
+ * is {@link #BUNDLE_IN_ERROR} and the type is {@link SimpleType#LONG}. It
+ * is used in {@link #BATCH_INSTALL_RESULT_TYPE}.
+ *
+ * @see #BUNDLE_IN_ERROR_ID_ITEM for the item that has a location for the
+ * bundle in error.
+ */
+ Item BUNDLE_IN_ERROR_LOCATION_ITEM = new Item(
+ BUNDLE_IN_ERROR,
+ "The location of the bundle causing the error",
+ SimpleType.LONG);
+
+ /**
+ * The item containing the list of remaining bundles unprocessed by the
+ * failing batch operation. The key is {@link #REMAINING} and the type is
+ * {@link JmxConstants#STRING_ARRAY_TYPE}. It is used in
+ * {@link #BATCH_ACTION_RESULT_TYPE} and {@link #BATCH_INSTALL_RESULT_TYPE}.
+ */
+ Item REMAINING_LOCATION_ITEM = new Item(
+ REMAINING,
+ "The locations of the remaining bundles",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The Composite Type which represents the result of a batch install
+ * operation. It is used in {@link #installBundles(String[])} and
+ * {@link #installBundles(String[], String[])}.
+ *
+ * This Composite Type consists of the following items:
+ * <ul>
+ * <li>{@link #BUNDLE_IN_ERROR_LOCATION_ITEM}</li>
+ * <li>{@link #COMPLETED_ITEM}</li>
+ * <li>{@link #ERROR_ITEM}</li>
+ * <li>{@link #REMAINING_LOCATION_ITEM P }</li>
+ * <li>{@link #SUCCESS_ITEM}</li>
+ * </ul>
+ */
+ CompositeType BATCH_INSTALL_RESULT_TYPE = Item
+ .compositeType(
+ "BATCH_INSTALL_RESULT",
+ "This type encapsulates a bundle batch install action result",
+ BUNDLE_IN_ERROR_LOCATION_ITEM,
+ COMPLETED_ITEM,
+ ERROR_ITEM,
+ REMAINING_LOCATION_ITEM,
+ SUCCESS_ITEM //
+ );
+
+ /**
+ * Retrieve the framework start level
+ *
+ * @return the framework start level
+ * @throws IOException if the operation failed
+ */
+ int getFrameworkStartLevel() throws IOException;
+
+ /**
+ * Answer the initial start level assigned to a bundle when it is first
+ * started
+ *
+ * @return the start level
+ * @throws IOException if the operation failed
+ */
+ int getInitialBundleStartLevel() throws IOException;
+
+ /**
+ * Install the bundle indicated by the bundleLocations
+ *
+ * @param location the location of the bundle to install
+ * @return the bundle id the installed bundle
+ * @throws IOException if the operation does not succeed
+ */
+ long installBundle(String location) throws IOException;
+
+ /**
+ * Install the bundle indicated by the bundleLocations
+ *
+ * @param location the location to assign to the bundle
+ * @param url the URL which will supply the bytes for the bundle
+ * @return the bundle id the installed bundle
+ * @throws IOException if the operation does not succeed
+ */
+ long installBundle(String location, String url) throws IOException;
+
+ /**
+ * Batch install the bundles indicated by the list of bundleLocationUrls
+ *
+ * @see #BATCH_INSTALL_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param locations the array of locations of the bundles to install
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData installBundles(String[] locations) throws IOException;
+
+ /**
+ * Batch install the bundles indicated by the list of bundleLocationUrls
+ *
+ * @see #BATCH_INSTALL_RESULT_TYPE BatchBundleResult for the precise
+ * specification of the CompositeData type representing the returned
+ * result.
+ *
+ * @param locations the array of locations to assign to the installed
+ * bundles
+ * @param urls the array of urls which supply the bundle bytes
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData installBundles(String[] locations, String[] urls)
+ throws IOException;
+
+ /**
+ * Force the update, replacement or removal of the pacakges identified by
+ * the list of bundles
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * ### there is not result???
+ * @param bundleIdentifier the bundle identifier
+ * @throws IOException if the operation failed
+ */
+ void refreshPackages(long bundleIdentifier) throws IOException;
+
+ /**
+ * Force the update, replacement or removal of the packages identified by
+ * the list of bundles.
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation failed
+ */
+ CompositeData refreshPackages(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Resolve the bundle indicated by the unique symbolic name and version
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @return true if the bundle was resolved, false otherwise
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ boolean resolveBundle(long bundleIdentifier) throws IOException;
+
+ /**
+ * Batch resolve the bundles indicated by the list of bundle identifiers
+ *
+ * @param bundleIdentifiers = the identifiers of the bundles to resolve
+ * @return true if the bundles were resolved, false otherwise
+ * @throws IOException if the operation does not succeed
+ */
+ boolean resolveBundles(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Restart the framework by updating the system bundle
+ *
+ * @throws IOException if the operation failed
+ */
+ void restartFramework() throws IOException;
+
+ /**
+ * Set the start level for the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @param newlevel the new start level for the bundle
+ * @throws IOException if the operation failed
+ */
+ void setBundleStartLevel(long bundleIdentifier, int newlevel)
+ throws IOException;
+
+ /**
+ * Set the start levels for the list of bundles.
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @param newlevels the array of new start level for the bundles
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation failed
+ */
+ CompositeData setBundleStartLevels(long[] bundleIdentifiers, int[] newlevels)
+ throws IOException;
+
+ /**
+ * Set the start level for the framework
+ *
+ * @param newlevel the new start level
+ * @throws IOException if the operation failed
+ */
+ void setFrameworkStartLevel(int newlevel) throws IOException;
+
+ /**
+ * Set the initial start level assigned to a bundle when it is first started
+ *
+ * @param newlevel the new start level
+ * @throws IOException if the operation failed
+ */
+ void setInitialBundleStartLevel(int newlevel) throws IOException;
+
+ /**
+ * Shutdown the framework by stopping the system bundle
+ *
+ * @throws IOException if the operation failed
+ */
+ void shutdownFramework() throws IOException;
+
+ /**
+ * Start the bundle indicated by the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ void startBundle(long bundleIdentifier) throws IOException;
+
+ /**
+ * Batch start the bundles indicated by the list of bundle identifier
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData startBundles(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Stop the bundle indicated by the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ void stopBundle(long bundleIdentifier) throws IOException;
+
+ /**
+ * Batch stop the bundles indicated by the list of bundle identifier
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData stopBundles(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Uninstall the bundle indicated by the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ void uninstallBundle(long bundleIdentifier) throws IOException;
+
+ /**
+ * Batch uninstall the bundles indicated by the list of bundle identifiers
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData uninstallBundles(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Update the bundle indicated by the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ void updateBundle(long bundleIdentifier) throws IOException;
+
+ /**
+ * Update the bundle identified by the bundle identifier
+ *
+ * @param bundleIdentifier the bundle identifier
+ * @param url the URL to use to update the bundle
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ void updateBundle(long bundleIdentifier, String url) throws IOException;
+
+ /**
+ * Batch update the bundles indicated by the list of bundle identifier.
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ */
+ CompositeData updateBundles(long[] bundleIdentifiers) throws IOException;
+
+ /**
+ * Update the bundle uniquely identified by the bundle symbolic name and
+ * version using the contents of the supplied urls.
+ *
+ *
+ * @see #BATCH_ACTION_RESULT_TYPE for the precise specification of the
+ * CompositeData type representing the returned result.
+ *
+ * @param bundleIdentifiers the array of bundle identifiers
+ * @param urls the array of URLs to use to update the bundles
+ * @return the resulting state from executing the operation
+ * @throws IOException if the operation does not succeed
+ * @throws IllegalArgumentException if the bundle indicated does not exist
+ */
+ CompositeData updateBundles(long[] bundleIdentifiers, String[] urls)
+ throws IOException;
+
+ /**
+ * Update the framework by updating the system bundle.
+ *
+ * @throws IOException if the operation failed
+ */
+ void updateFramework() throws IOException;
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.framework;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+import org.osgi.jmx.Item;
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean provides information about the package state of the framework.
+ *
+ * @version $Revision$
+ */
+public interface PackageStateMBean {
+ /**
+ * The fully qualified object name of this MBean.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_CORE
+ + ":type=packageState,version=1.5";
+
+ /**
+ * The key EXPORTING_BUNDLE, used in {@link #EXPORTING_BUNDLE_ITEM}.
+ */
+ String EXPORTING_BUNDLE = "ExportingBundle";
+ /**
+ * The item containing the bundle identifier in {@link #PACKAGE_TYPE}. The
+ * key is {@link #EXPORTING_BUNDLE} and the type is {@link SimpleType#LONG}.
+ *
+ * ### Is ExportingBundle not a better name?
+ */
+ Item EXPORTING_BUNDLE_ITEM = new Item(
+ EXPORTING_BUNDLE,
+ "The bundle the package belongs to",
+ SimpleType.LONG);
+
+ /**
+ * The key IMPORTING_BUNDLES, used in {@link #IMPORTING_BUNDLES_ITEM}.
+ */
+ String IMPORTING_BUNDLES = "ImportingBundles";
+
+ /**
+ * The item containing the bundle identifier in {@link #PACKAGE_TYPE}. The
+ * key is {@link #EXPORTING_BUNDLE} and the type is {@link SimpleType#LONG}.
+ */
+ Item IMPORTING_BUNDLES_ITEM = new Item(
+ IMPORTING_BUNDLES,
+ "The importing bundles of the package",
+ JmxConstants.LONG_ARRAY_TYPE);
+
+ /**
+ * The key NAME, used in {@link #NAME_ITEM}.
+ */
+ String NAME = "Name";
+
+ /**
+ * The item containing the name of the package in {@link #PACKAGE_TYPE}. The
+ * key is {@link #NAME} and the type is {@link SimpleType#LONG}.
+ */
+ Item NAME_ITEM = new Item(NAME,
+ "The package name",
+ SimpleType.STRING);
+
+ /**
+ * The name of the item containing the pending removal status of the package
+ * in the CompositeData. Used
+ */
+ String REMOVAL_PENDING = "RemovalPending";
+ /**
+ *
+ */
+ Item REMOVAL_PENDING_ITEM = new Item(
+ REMOVAL_PENDING,
+ "Whether the package is pending removal",
+ SimpleType.BOOLEAN);
+
+ /**
+ * The name of the item containing the package version in the CompositeData.
+ * Used in {@link #VERSION_ITEM}.
+ */
+ String VERSION = "Version";
+
+ /**
+ * The item containing the version of the package in {@link #PACKAGE_TYPE}.
+ * The key is {@link #VERSION} and the type is {@link SimpleType#STRING}.
+ */
+ Item VERSION_ITEM = new Item(
+ VERSION,
+ "The identifier of the bundle the service belongs to",
+ SimpleType.STRING);
+
+ /**
+ * The item names in the CompositeData representing the package. This type
+ * consists of:
+ * <ul>
+ * <li>{@link #EXPORTING_BUNDLE_ITEM}</li>
+ * <li>{@link #IMPORTING_BUNDLES_ITEM}</li>
+ * <li>{@link #NAME_ITEM}</li>
+ * <li>{@link #REMOVAL_PENDING_ITEM}</li>
+ * <li>{@link #VERSION_ITEM}</li>
+ * </ul>
+ * The key is defined as {@link #NAME} and {@link #EXPORTING_BUNDLE}
+ */
+ CompositeType PACKAGE_TYPE = Item
+ .compositeType(
+ "PACKAGE",
+ "This type encapsulates an OSGi package",
+ EXPORTING_BUNDLE_ITEM,
+ IMPORTING_BUNDLES_ITEM,
+ NAME_ITEM,
+ REMOVAL_PENDING_ITEM,
+ VERSION_ITEM);
+
+ /**
+ * The Tabular Type used in {@link #listPackages()}. They key is
+ * {@link #NAME}, {@link #VERSION}, and {@link #EXPORTING_BUNDLE}.
+ */
+ TabularType PACKAGES_TYPE = Item.tabularType("PACKAGES",
+ "A table of packages",
+ PACKAGE_TYPE, NAME,
+ VERSION, EXPORTING_BUNDLE);
+
+ /**
+ * Answer the identifier of the bundle exporting the package
+ *
+ * @param packageName - the package name
+ * @param version - the version of the package
+ * @return the bundle identifier or -1 if there is no bundle
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the package indicated does not exist
+ */
+ long getExportingBundle(String packageName, String version)
+ throws IOException;
+
+ /**
+ * Answer the list of identifiers of the bundles importing the package
+ *
+ * ### packageName and version is not unique
+ *
+ * @param packageName - the package name
+ * @param version - the version of the package
+ * @return the list of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the package indicated does not exist
+ *
+ */
+ long[] getImportingBundles(String packageName, String version)
+ throws IOException;
+
+ /**
+ * Answer the package state of the system in tabular form
+ *
+ * The Tabular Data is typed by {@link #PACKAGES_TYPE}, which has
+ * {@link #PACKAGE_TYPE} as its Composite Type.
+ *
+ * @return the tabular representation of the package state
+ * @throws IOException When fails
+ */
+ TabularData listPackages() throws IOException;
+
+ /**
+ * Answer if this package is exported by a bundle which has been updated or
+ * uninstalled
+ *
+ * @param packageName - the package name
+ * @param version - the version of the package
+ * @return true if this package is being exported by a bundle that has been
+ * updated or uninstalled.
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the package indicated does not exist
+ */
+ boolean isRemovalPending(String packageName, String version)
+ throws IOException;
+
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.framework;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+import org.osgi.jmx.Item;
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean represents the Service state of the framework. This MBean also
+ * emits events that clients can use to get notified of the changes in the
+ * service state of the framework.
+ *
+ */
+public interface ServiceStateMBean {
+ /**
+ * The fully qualified object name of this mbean.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_CORE
+ + ":type=serviceState,version=1.5";
+ /**
+ * The key BUNDLE_IDENTIFIER, used in {@link #BUNDLE_IDENTIFIER_ITEM}.
+ */
+ String BUNDLE_IDENTIFIER = "BundleIdentifier";
+ /**
+ * The item containing the bundle identifier in {@link #SERVICE_TYPE}. The
+ * key is {@link #BUNDLE_IDENTIFIER} and the type is {@link SimpleType#LONG}
+ * .
+ */
+ Item BUNDLE_IDENTIFIER_ITEM = new Item(
+ BUNDLE_IDENTIFIER,
+ "The identifier of the bundle the service belongs to",
+ SimpleType.LONG);
+
+ /**
+ * The key OBJECT_CLASS, used {@link #OBJECT_CLASS_ITEM}.
+ */
+ String OBJECT_CLASS = "objectClass";
+
+ /**
+ * The item containing the interfaces of the service in
+ * {@link #SERVICE_TYPE}. The key is {@link #OBJECT_CLASS} and the type is
+ * {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ Item OBJECT_CLASS_ITEM = new Item(
+ OBJECT_CLASS,
+ "An string array containing the interfaces under which the service has been registered",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The key IDENTIFIER, used {@link #IDENTIFIER_ITEM}.
+ */
+ String IDENTIFIER = "Identifier";
+
+ /**
+ * The item containing the service identifier in {@link #SERVICE_TYPE}. The
+ * key is {@link #IDENTIFIER} and the type is {@link SimpleType#LONG}.
+ */
+ Item IDENTIFIER_ITEM = new Item(
+ IDENTIFIER,
+ "The identifier of the service",
+ SimpleType.LONG);
+
+ /**
+ * The key USING_BUNDLES, used in {@link #USING_BUNDLES_ITEM}.
+ */
+ String USING_BUNDLES = "UsingBundles";
+
+ /**
+ * The item containing the bundles using the service in
+ * {@link #SERVICE_TYPE}. The key is {@link #USING_BUNDLES} and the type is
+ * {@link JmxConstants#LONG_ARRAY_TYPE}.
+ */
+ Item USING_BUNDLES_ITEM = new Item(
+ USING_BUNDLES,
+ "The bundles using the service",
+ JmxConstants.LONG_ARRAY_TYPE);
+
+ /**
+ * The key PROPERTIES, used in {@link #PROPERTIES_ITEM}.
+ */
+ String PROPERTIES = "Properties";
+
+ /**
+ * The item containing service properties. The key is {@link #PROPERTIES}
+ * and the type is {@link JmxConstants#PROPERTIES_TYPE}.
+ */
+ Item PROPERTIES_ITEM = new Item(
+ PROPERTIES,
+ "The service properties",
+ JmxConstants.PROPERTIES_TYPE);
+
+ /**
+ * The item names in the CompositeData representing the service. This type
+ * consists of:
+ * <ul>
+ * <li>{@link #BUNDLE_IDENTIFIER}</li>
+ * <li>{@link #IDENTIFIER}</li>
+ * <li>{@link #OBJECT_CLASS}</li>
+ * <li>{@link #PROPERTIES}</li>
+ * <li>{@link #USING_BUNDLES}</li>
+ * </ul>
+ */
+ CompositeType SERVICE_TYPE = Item
+ .compositeType(
+ "SERVICE",
+ "This type encapsulates an OSGi service",
+ BUNDLE_IDENTIFIER_ITEM,
+ IDENTIFIER_ITEM,
+ OBJECT_CLASS_ITEM,
+ PROPERTIES_ITEM,
+ USING_BUNDLES_ITEM);
+
+ /**
+ * The Tabular Type for a Service table. The rows consists of
+ * {@link #SERVICE_TYPE} Composite Data and the index is {@link #IDENTIFIER}
+ * .
+ */
+ TabularType SERVICES_TYPE = Item
+ .tabularType(
+ "SERVICES",
+ "The table of all services",
+ SERVICE_TYPE,
+ IDENTIFIER);
+
+ /**
+ * Answer the list of interfaces that this service implements
+ *
+ * @param serviceId the identifier of the service
+ * @return the list of interfaces
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the service indicated does not exist
+ */
+ public String[] getObjectClass(long serviceId) throws IOException;
+
+ /**
+ * Answer the bundle identifier of the bundle which registered the service
+ *
+ * @param serviceId the identifier of the service
+ * @return the identifier for the bundle
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the service indicated does not exist
+ */
+ long getBundleIdentifier(long serviceId) throws IOException;
+
+ /**
+ * Answer the map of properties associated with this service
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
+ *
+ * @param serviceId the identifier of the service
+ * @return the table of properties. These include the standard mandatory
+ * service.id and objectClass properties as defined in the
+ * <code>org.osgi.framework.Constants</code> interface
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the service indicated does not exist
+ */
+ TabularData getProperties(long serviceId) throws IOException;
+
+ /**
+ * Answer the service state of the system in tabular form.
+ *
+ * @see #SERVICES_TYPE for the details of the TabularType
+ *
+ * @return the tabular representation of the service state
+ * @throws IOException If the operation fails
+ * @throws IllegalArgumentException if the service indicated does not exist
+ */
+ TabularData listServices() throws IOException;
+
+ /**
+ * Answer the list of identifiers of the bundles that use the service
+ *
+ * @param serviceId the identifier of the service
+ * @return the list of bundle identifiers
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the service indicated does not exist
+ */
+ long[] getUsingBundles(long serviceId) throws IOException;
+
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX Framework Package Version 1.5.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx.framework; version="[1.5,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/framework/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.5
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX Package Version 1.0.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx; version="[1.0,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.0
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.service.cm;
+
+import java.io.IOException;
+
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean provides the management interface to the OSGi Configuration
+ * Administration Service.
+ *
+ * @version $Revision$
+ */
+public interface ConfigurationAdminMBean {
+ /**
+ * The object name for this mbean.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_COMPENDIUM+":service=cm,version=1.3";
+
+ /**
+ * Create a new configuration instance for the supplied persistent id of the
+ * factory, answering the PID of the created configuration
+ *
+ * @param factoryPid the persistent id of the factory
+ * @return the PID of the created configuration
+ * @throws IOException if the operation failed
+ */
+ String createFactoryConfiguration(String factoryPid) throws IOException;
+
+ /**
+ * Create a factory configuration for the supplied persistent id of the
+ * factory and the bundle location bound to bind the created configuration
+ * to, answering the PID of the created configuration
+ *
+ * @param factoryPid the persistent id of the factory
+ * @param location the bundle location
+ * @return the pid of the created configuation
+ * @throws IOException if the operation failed
+ */
+ String createFactoryConfiguration(String factoryPid, String location)
+ throws IOException;
+
+ /**
+ * Delete the configuration
+ *
+ * @param pid the persistent identifier of the configuration
+ * @throws IOException if the operation fails
+ */
+ void delete(String pid) throws IOException;
+
+ /**
+ * Delete the configuration
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param location the bundle location
+ * @throws IOException if the operation fails
+ */
+ void delete(String pid, String location) throws IOException;
+
+ /**
+ * Delete the configurations matching the filter specification.
+ *
+ * @param filter the string representation of the
+ * <code>org.osgi.framework.Filter</code>
+ * @throws IOException if the operation failed
+ * @throws IllegalArgumentException if the filter is invalid
+ */
+ void deleteConfigurations(String filter) throws IOException;
+
+ /**
+ * Answer the bundle location the configuration is bound to
+ *
+ * @param pid the persistent identifier of the configuration
+ * @return the bundle location
+ * @throws IOException if the operation fails
+ */
+ String getBundleLocation(String pid) throws IOException;
+
+ /**
+ * Answer the factory PID if the configuration is a factory configuration,
+ * null otherwise.
+ *
+ * @param pid the persistent identifier of the configuration
+ * @return the factory PID
+ * @throws IOException if the operation fails
+ */
+ String getFactoryPid(String pid) throws IOException;
+
+ /**
+ * Answer the factory PID if the configuration is a factory configuration,
+ * null otherwise.
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param location the bundle location
+ * @return the factory PID
+ * @throws IOException if the operation fails
+ */
+ String getFactoryPid(String pid, String location) throws IOException;
+
+ /**
+ * Answer the contents of the configuration <p/>
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
+ *
+ * @param pid the persistent identifier of the configuration
+ * @return the table of contents
+ * @throws IOException if the operation fails
+ */
+
+ TabularData getProperties(String pid) throws IOException;
+
+ /**
+ * Answer the contents of the configuration <p/>
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param location the bundle location
+ * @return the table of contents
+ * @throws IOException if the operation fails
+ */
+ TabularData getProperties(String pid, String location) throws IOException;
+
+ /**
+ * Answer the list of PID/Location pairs of the configurations managed by
+ * this service
+ *
+ * @param filter the string representation of the
+ * <code>org.osgi.framework.Filter</code>
+ * @return the list of configuration PID/Location pairs
+ * @throws IOException if the operation failed
+ * @throws IllegalArgumentException if the filter is invalid
+ */
+ String[][] getConfigurations(String filter) throws IOException;
+
+ /**
+ * Set the bundle location the configuration is bound to
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param location the bundle location
+ * @throws IOException if the operation fails
+ */
+ void setBundleLocation(String pid, String location) throws IOException;
+
+ /**
+ * Update the configuration with the supplied properties For each property
+ * entry, the following row is supplied <p/>
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param properties the table of properties
+ * @throws IOException if the operation fails
+ */
+ void update(String pid, TabularData properties) throws IOException;
+
+ /**
+ * Update the configuration with the supplied properties For each property
+ * entry, the following row is supplied <p/>
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
+ *
+ * @param pid the persistent identifier of the configuration
+ * @param location the bundle location
+ * @param properties the table of properties
+ * @throws IOException if the operation fails
+ */
+ void update(String pid, String location, TabularData properties)
+ throws IOException;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX CM Package Version 1.3.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx.service.cm; version="[1.3,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/cm/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.3
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.service.permissionadmin;
+
+import java.io.IOException;
+
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean represents the OSGi Permission Manager Service
+ *
+ * @version $Revision$
+ */
+public interface PermissionAdminMBean {
+ /**
+ * Permission Admin MBean object name.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_CORE
+ + ":service=permissionadmin,version=1.2";
+
+ /**
+ * Answer the bundle locations that have permissions assigned to them
+ *
+ * @return the bundle locations
+ * @throws IOException if the operation fails
+ */
+ String[] listLocations() throws IOException;
+
+ /**
+ * Answer the list of encoded permissions of the bundle specified by the
+ * bundle location
+ *
+ * @param location location identifying the bundle
+ * @return the array of String encoded permissions
+ * @throws IOException if the operation fails
+ */
+ String[] getPermissions(String location) throws IOException;
+
+ /**
+ * Set the default permissions assigned to bundle locations that have no
+ * assigned permissions
+ *
+ * @param encodedPermissions the string encoded permissions
+ * @throws IOException if the operation fails
+ */
+ void setDefaultPermissions(String[] encodedPermissions) throws IOException;
+
+ /**
+ * Answer the list of encoded permissions representing the default
+ * permissions assigned to bundle locations that have no assigned
+ * permissions
+ *
+ * @return the array of String encoded permissions
+ * @throws IOException if the operation fails
+ */
+ String[] listDefaultPermissions() throws IOException;
+
+ /**
+ * Set the permissions on the bundle specified by the bundle location
+ *
+ * @param location the location of the bundle
+ * @param encodedPermissions the string encoded permissions to set
+ * @throws IOException if the operation fails
+ */
+ void setPermissions(String location, String[] encodedPermissions)
+ throws IOException;
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX Permission Admin Package Admin Package Version 1.2.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx.service.permission; version="[1.2,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/permissionadmin/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.2
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.service.provisioning;
+
+import java.io.IOException;
+
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean represents the management interface to the OSGi Initial
+ * Provisioning Service
+ *
+ * @version $Revision$
+ */
+public interface ProvisioningServiceMBean {
+ /**
+ * Provisioning MBean object name.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_COMPENDIUM
+ + ":service=provisioning,version=1.2";
+
+ /**
+ * Processes the <code>ZipInputStream</code> contents of the provided
+ * zipURL and extracts information to add to the Provisioning Information
+ * dictionary, as well as, install/update and start bundles. This method
+ * causes the <code>PROVISIONING_UPDATE_COUNT</code> to be incremented.
+ *
+ * @param zipURL the String form of the URL that will be resolved into a
+ * <code>ZipInputStream</code> which will be used to add key/value
+ * pairs to the Provisioning Information dictionary and install and
+ * start bundles. If a <code>ZipEntry</code> does not have an
+ * <code>Extra</code> field that corresponds to one of the four
+ * defined MIME types (<code>MIME_STRING</code>,
+ * <code>MIME_BYTE_ARRAY</code>,<code>MIME_BUNDLE</code>, and
+ * <code>MIME_BUNDLE_URL</code>) in will be silently ignored.
+ * @throws IOException if an error occurs while processing the
+ * ZipInputStream of the URL. No additions will be made to the
+ * Provisioning Information dictionary and no bundles must be
+ * started or installed.
+ */
+ public void addInformation(String zipURL) throws IOException;
+
+ /**
+ * Adds the key/value pairs contained in <code>info</code> to the
+ * Provisioning Information dictionary. This method causes the
+ * <code>PROVISIONING_UPDATE_COUNT</code> to be incremented.
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for details of the Tabular Data
+ *
+ * @param info the set of Provisioning Information key/value pairs to add to
+ * the Provisioning Information dictionary. Any keys are values that
+ * are of an invalid type will be silently ignored.
+ * @throws IOException if the operation fails
+ */
+ public void addInformation(TabularData info) throws IOException;
+
+ /**
+ * Returns a table representing the Provisioning Information Dictionary.
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for details of the Tabular Data
+ *
+ * @throws IOException if the operation fails
+ * @return The table representing the manager dictionary.
+ */
+ public TabularData listInformation() throws IOException;
+
+ /**
+ * Replaces the Provisioning Information dictionary with the entries of the
+ * supplied table. This method causes the
+ * <code>PROVISIONING_UPDATE_COUNT</code> to be incremented.
+ *
+ * @see JmxConstants#PROPERTIES_TYPE for details of the Tabular Data
+ *
+ * @param info the new set of Provisioning Information key/value pairs. Any
+ * keys are values that are of an invalid type will be silently
+ * ignored.
+ * @throws IOException if the operation fails
+ */
+ public void setInformation(TabularData info) throws IOException;
+
+}
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX Initial Provisioning Package Version 1.2.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx.service.provisioning; version="[1.2,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/provisioning/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.2
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,540 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.jmx.service.useradmin;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.Item;
+import org.osgi.jmx.JmxConstants;
+
+/**
+ * This MBean provides the management interface to the OSGi User Manager
+ * Service.
+ *
+ * @version $Revision$
+ */
+public interface UserAdminMBean {
+ /**
+ * User Admin MBean object name.
+ */
+ String OBJECTNAME = JmxConstants.OSGI_COMPENDIUM
+ + ":service=useradmin,version=1.1";
+
+ /**
+ * The key NAME, used in {@link #NAME_ITEM}.
+ */
+ String NAME = "Name";
+
+ /**
+ * The user name for this authorization object. The key is {@link #NAME} and
+ * the type is {@link SimpleType#STRING}.
+ */
+ Item NAME_ITEM = new Item(
+ NAME,
+ "The user name for this authorization object",
+ SimpleType.STRING);
+
+ /**
+ * The key ROLES, used in {@link #ROLES_ITEM}.
+ */
+ String ROLES = "Roles";
+
+ /**
+ * The item containing the roles for this authorization object. The key is
+ * {@link #ROLES}. and the type is {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ Item ROLES_ITEM = new Item(
+ ROLES,
+ "The names of the roles encapsulated by this auth object",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The Composite Type for an Authorization object. It consists of the
+ * {@link #NAME_ITEM} and {@link #TYPE_ITEM} items.
+ */
+ CompositeType AUTORIZATION_TYPE = Item
+ .compositeType(
+ "AUTHORIZATION",
+ "An authorization object defines which roles has a user got",
+ NAME_ITEM,
+ ROLES_ITEM);
+ /**
+ * The Role TYPE key, used in {@link #TYPE_ITEM}.
+ */
+ String TYPE = "Type";
+
+ /**
+ * The item containing the type of the roles encapsulated by this
+ * authorization object. The key is {@link #TYPE} and the type is
+ * {@link SimpleType#INTEGER}.
+ */
+ Item TYPE_ITEM = new Item(
+ TYPE,
+ "An integer representing type of the role: {0=Role,1=user,2=group}",
+ SimpleType.INTEGER);
+
+ /**
+ * The PROPERTIES key, used in {@link #PROPERTIES_ITEM}.
+ */
+ String PROPERTIES = "Properties";
+
+ /**
+ * The item containing the properties of a Role. The key is
+ * {@link #PROPERTIES} and the type is {@link JmxConstants#PROPERTIES_TYPE}.
+ */
+ Item PROPERTIES_ITEM = new Item(
+ PROPERTIES,
+ "A properties as defined by org.osgi.service.useradmin.Role",
+ JmxConstants.PROPERTIES_TYPE);
+ /**
+ * The item containing the type of Composite Type for a Role. It contains
+ * the following items:
+ * <ul>
+ * <li>{@link #NAME}</li
+ * <li>{@link #TYPE}</li>
+ * <li>{@link #PROPERTIES}</li>
+ * </ul>
+ *
+ */
+ CompositeType ROLE_TYPE = Item
+ .compositeType(
+ "ROLE",
+ "Mapping of org.osgi.service.useradmin.Role for remote management purposes. User and Group extend Role",
+ NAME_ITEM,
+ TYPE_ITEM,
+ PROPERTIES_ITEM);
+
+ /**
+ * The CREDENTIALS key, used in {@link #CREDENTIALS_ITEM}.
+ */
+ String CREDENTIALS = "Credentials";
+
+ /**
+ * The item containing the credentials of a user. The key is
+ * {@link #CREDENTIALS} and the type is {@link JmxConstants#PROPERTIES_TYPE}.
+ */
+ Item CREDENTIALS_ITEM = new Item(
+ CREDENTIALS,
+ "The credentials for this user",
+ JmxConstants.PROPERTIES_TYPE);
+
+ /**
+ * A Composite Type for a User. A User contains its Role description and
+ * adds the credentials. It extends {@link #ROLE_TYPE} and adds
+ * {@link #CREDENTIALS_ITEM}.
+ *
+ * This type extends the {@link #ROLE_TYPE}. It adds:
+ * <ul>
+ * <li>{@link #CREDENTIALS}</li
+ * </ul>
+ */
+ CompositeType USER_TYPE = Item
+ .extend(
+ ROLE_TYPE,
+ "USER",
+ "Mapping of org.osgi.service.useradmin.User for remote management purposes. User extends Role",
+ CREDENTIALS_ITEM);
+
+ /**
+ * The MEMBERS key, used in {@link #MEMBERS_ITEM}.
+ */
+ String MEMBERS = "Members";
+
+ /**
+ * The item containing the members of a group. The key is {@link #MEMBERS}
+ * and the type is {@link JmxConstants#STRING_ARRAY_TYPE}. It is used in
+ * {@link #GROUP_TYPE}.
+ */
+ Item MEMBERS_ITEM = new Item(
+ MEMBERS,
+ "The members of this group",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The REQUIRED_MEMBERS key, used in {@link #REQUIRED_MEMBERS_ITEM}.
+ */
+ String REQUIRED_MEMBERS = "RequiredMembers";
+
+ /**
+ * The item containing the required members of a group. The key is
+ * {@link #REQUIRED_MEMBERS} and the type is
+ * {@link JmxConstants#STRING_ARRAY_TYPE}. It is used in
+ * {@link #GROUP_TYPE}.
+ */
+ Item REQUIRED_MEMBERS_ITEM = new Item(
+ REQUIRED_MEMBERS,
+ "The required members of this group",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The Composite Type for a Group. It extends {@link #USER_TYPE} and adds
+ * {@link #MEMBERS_ITEM}, and {@link #REQUIRED_MEMBERS_ITEM}.
+ *
+ * This type extends the {@link #USER_TYPE}. It adds:
+ * <ul>
+ * <li>{@link #MEMBERS}</li
+ * <li>{@link #REQUIRED_MEMBERS}</li
+ * </ul>
+ */
+ CompositeType GROUP_TYPE = Item
+ .extend(
+ USER_TYPE,
+ "GROUP",
+ "Mapping of org.osgi.service.useradmin.Group for remote management purposes. Group extends User which in turn extends Role",
+ MEMBERS_ITEM,
+ REQUIRED_MEMBERS_ITEM);
+
+ /**
+ * Add credentials to a user, associated with the supplied key
+ *
+ * @param key The key of the credential to add
+ * @param value The value of the credential to add
+ * @param username The name of the user that gets the credential.
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the user name is not a User
+ */
+ void addCredential(String key, byte[] value, String username)
+ throws IOException;
+
+ /**
+ * Add credentials to a user, associated with the supplied key
+ *
+ * @param key The key of the credential to add
+ * @param value The value of the credential to add
+ * @param username The name of the user that gets the credential.
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the username is not a User
+ */
+ void addCredential(String key, String value, String username)
+ throws IOException;
+
+ /**
+ * Add a member to the group.
+ *
+ * ### Hal, please check, I am not clear who is the receiver and who is the
+ * parameter. The ordering seems very confusing, because here the rolename
+ * seems the parameter but in all other calls it is the dest?
+ *
+ * @param groupname The group name that receives the <code>rolename</code>
+ * as member.
+ * @param rolename The <code>rolename</code> (User or Group) that must be
+ * added.
+ * @return <code>true</code> if the role was added to the group
+ * @throws IOException if the operation fails
+ *
+ */
+ boolean addMember(String groupname, String rolename) throws IOException;
+
+ /**
+ * Add or update a property on a role
+ *
+ * @param key The key of the property to add
+ * @param value The value of the property to add (<code>String</code>)
+ * @param rolename The role name
+ * @throws IOException if the operation fails
+ */
+ void addProperty(String key, String value, String rolename)
+ throws IOException;
+
+ /**
+ * Add or update a property on a role.
+ *
+ * @param key The added property key
+ * @param value The added byte[] property value
+ * @param rolename The role name that receives the property
+ * @throws IOException if the operation fails
+ */
+ void addProperty(String key, byte[] value, String rolename)
+ throws IOException;
+
+ /**
+ * Add a required member to the group
+ *
+ * @param groupname The group name that is addded
+ * @param rolename The role that
+ * @return true if the role was added to the group
+ * @throws IOException if the operation fails
+ */
+ boolean addRequiredMember(String groupname, String rolename)
+ throws IOException;
+
+ /**
+ * Create a User
+ *
+ * @param name Name of the user to create
+ * @throws IOException if the operation fails
+ */
+ void createUser(String name) throws IOException;
+
+ /**
+ * Create a Group
+ *
+ * @param name Name of the group to create
+ * @throws IOException if the operation fails
+ */
+ void createGroup(String name) throws IOException;
+
+ /**
+ * Create a Role
+ *
+ * @param name of the role to create
+ * @throws IOException if the operation fails
+ */
+ void createRole(String name) throws IOException;
+
+ /**
+ * Answer the authorization for the user name.
+ *
+ * The Composite Data is typed by {@link #AUTORIZATION_TYPE}.
+ *
+ * @param user The user name
+ * @return the Authorization typed by {@link #AUTORIZATION_TYPE}.
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the user name is not a User
+ */
+ CompositeData getAuthorization(String user) throws IOException;
+
+ /**
+ * Answer the credentials associated with a user.
+ *
+ * The returned Tabular Data is typed by
+ * {@link JmxConstants#PROPERTIES_TYPE}.
+ *
+ * @param username The user name
+ * @return the credentials associated with the user, see
+ * {@link JmxConstants#PROPERTIES_TYPE}
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the user name is not a User
+ */
+ TabularData getCredentials(String username) throws IOException;
+
+ /**
+ * Answer the Group associated with the group name.
+ *
+ * The returned Composite Data is typed by {@link #GROUP_TYPE}
+ *
+ * @param groupname The group name
+ * @return the Group, see {@link #GROUP_TYPE}
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the group name is not a Group
+ */
+ CompositeData getGroup(String groupname) throws IOException;
+
+ /**
+ * Answer the list of group names
+ *
+ * @return The list of group names
+ * @throws IOException if the operation fails
+ */
+ String[] listGroups() throws IOException;
+
+ /**
+ * Answer the list of group names
+ *
+ * @param filter The filter to apply
+ * @return The list of group names
+ * @throws IOException if the operation fails
+ */
+ String[] getGroups(String filter) throws IOException;
+
+ /**
+ * Answer the list of implied roles for a user
+ *
+ * ### I do not know how this maps to User Admin?
+ *
+ * @param username The name of the user that has the implied roles
+ * @return The list of role names
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the username is not a User
+ */
+ String[] getImpliedRoles(String username) throws IOException;
+
+ /**
+ * Answer the the user names which are members of the group
+ *
+ * @param groupname The name of the group to get the members from
+ * @return The list of user names
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the <code>groupname</code> is not a
+ * group
+ */
+ String[] getMembers(String groupname) throws IOException;
+
+ /**
+ * Answer the properties associated with a role.
+ *
+ * The returned Tabular Data is typed by
+ * {@link JmxConstants#PROPERTIES_TYPE}.
+ *
+ * @param rolename The name of the role to get properties from
+ * @return the properties associated with the role, see
+ * {@link JmxConstants#PROPERTIES_TYPE}
+ * @throws IOException if the operation fails
+ */
+ TabularData getProperties(String rolename) throws IOException;
+
+ /**
+ * Answer the list of user names which are required members of this group
+ *
+ * @param groupname The name of the group to get the required members from
+ * @return The list of user names
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the group name is not a group
+ */
+ String[] getRequiredMembers(String groupname) throws IOException;
+
+ /**
+ * Answer the role associated with a name.
+ *
+ * The returned Composite Data is typed by {@link #ROLE_TYPE}.
+ *
+ * ### Is this also all users and groups?
+ *
+ * @param name The name of the role to get the data from
+ * @return the Role, see {@link #ROLE_TYPE}
+ * @throws IOException if the operation fails
+ */
+ CompositeData getRole(String name) throws IOException;
+
+ /**
+ * Answer the list of role names in the User Admin database
+ *
+ * ### Is this also all users and groups?
+ *
+ * @return The list of role names
+ * @throws IOException if the operation fails
+ */
+ String[] listRoles() throws IOException;
+
+ /**
+ * Answer the list of role names which match the supplied filter
+ *
+ * @param filter The string representation of the
+ * <code>org.osgi.framework.Filter</code> that is used to filter
+ * the roles by applying to the properties, if <code>null</code>
+ * all roles are returned.
+ *
+ * @return The list the role names
+ * @throws IOException if the operation fails
+ */
+ String[] getRoles(String filter) throws IOException;
+
+ /**
+ * Answer the User associated with the user name.
+ *
+ * The returned Composite Data is typed by {@link #USER_TYPE}.
+ *
+ * @param username The name of the requested user
+ * @return The User, see {@link #USER_TYPE}
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the <code>username</code> is not a
+ * User
+ */
+ CompositeData getUser(String username) throws IOException;
+
+ /**
+ * Answer the user name with the given property key-value pair from the User
+ * Admin service database.
+ *
+ * @param key The key to compare
+ * @param value The value to compare
+ * @return The User
+ * @throws IOException if the operation fails
+ */
+ String getUser(String key, String value) throws IOException;
+
+ /**
+ * Answer the list of user names in the User Admin database
+ *
+ * @return The list of user names
+ * @throws IOException if the operation fails
+ */
+ String[] listUsers() throws IOException;
+
+ /**
+ * Answer the list of user names in the User Admin database
+ *
+ * @param filter The filter to apply
+ * @return The list of user names
+ * @throws IOException if the operation fails
+ */
+ String[] getUsers(String filter) throws IOException;
+
+ /**
+ * Remove the credential associated with the given user
+ *
+ * @param key The key of the credential to remove
+ * @param username The name of the user for which the credential must be
+ * removed
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the username is not a User
+ */
+ void removeCredential(String key, String username) throws IOException;
+
+ /**
+ * Remove a role from the group
+ *
+ * @param groupname The group name
+ * @param rolename
+ * @return true if the role was removed from the group
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the groupname is not a Group
+ */
+ boolean removeMember(String groupname, String rolename) throws IOException;
+
+ /**
+ * Remove a property from a role
+ *
+ * @param key
+ * @param rolename
+ * @throws IOException if the operation fails
+ */
+ void removeProperty(String key, String rolename) throws IOException;
+
+ /**
+ * Remove the Role associated with the name
+ *
+ * @param name
+ * @return true if the remove succeeded
+ * @throws IOException if the operation fails
+ */
+ boolean removeRole(String name) throws IOException;
+
+ /**
+ * Remove the Group associated with the name
+ *
+ * @param name
+ * @return true if the remove succeeded
+ * @throws IOException if the operation fails
+ */
+ boolean removeGroup(String name) throws IOException;
+
+ /**
+ * Remove the User associated with the name
+ *
+ * @param name
+ * @return true if the remove succeeded
+ * @throws IOException if the operation fails
+ */
+ boolean removeUser(String name) throws IOException;
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/package.html
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/package.html (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/package.html 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1,11 @@
+<!-- $Revision: 8212 $ -->
+<BODY>
+<p>OSGi JMX User Admin Package Version 1.1.</p>
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:</p>
+<pre>
+Import-Package: org.osgi.jmx.service.useradmin; version="[1.1,2.0)"
+</pre>
+</BODY>
+
Added: projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/packageinfo
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/packageinfo (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/src/main/java/org/osgi/jmx/service/useradmin/packageinfo 2009-10-27 10:20:22 UTC (rev 95605)
@@ -0,0 +1 @@
+version 1.1
More information about the jboss-cvs-commits
mailing list