You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by at...@apache.org on 2009/11/19 12:43:46 UTC
svn commit: r882116 [1/2] - in /incubator/aries/trunk: ./ jmx/ jmx/jmx-api/
jmx/jmx-api/src/ jmx/jmx-api/src/main/
jmx/jmx-api/src/main/appended-resources/
jmx/jmx-api/src/main/appended-resources/META-INF/
jmx/jmx-api/src/main/java/ jmx/jmx-api/src/mai...
Author: atk
Date: Thu Nov 19 11:43:42 2009
New Revision: 882116
URL: http://svn.apache.org/viewvc?rev=882116&view=rev
Log:
ARIES-38 Setting up modules for JMX API & Core
Added:
incubator/aries/trunk/jmx/
incubator/aries/trunk/jmx/LICENSE (with props)
incubator/aries/trunk/jmx/NOTICE (with props)
incubator/aries/trunk/jmx/jmx-api/
incubator/aries/trunk/jmx/jmx-api/pom.xml (with props)
incubator/aries/trunk/jmx/jmx-api/src/
incubator/aries/trunk/jmx/jmx-api/src/main/
incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/
incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/
incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/packageinfo
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/packageinfo
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/cm/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/cm/ConfigurationAdminMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/cm/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/cm/packageinfo
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/permissionadmin/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/permissionadmin/PermissionAdminMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/permissionadmin/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/permissionadmin/packageinfo
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/provisioning/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/provisioning/ProvisioningServiceMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/provisioning/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/provisioning/packageinfo
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/useradmin/
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/useradmin/UserAdminMBean.java (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/useradmin/package.html (with props)
incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/service/useradmin/packageinfo
incubator/aries/trunk/jmx/jmx-bundle/
incubator/aries/trunk/jmx/jmx-bundle/pom.xml (with props)
incubator/aries/trunk/jmx/jmx-bundle/src/
incubator/aries/trunk/jmx/jmx-bundle/src/main/
incubator/aries/trunk/jmx/jmx-bundle/src/main/appended-resources/
incubator/aries/trunk/jmx/jmx-bundle/src/main/appended-resources/META-INF/
incubator/aries/trunk/jmx/jmx-bundle/src/main/appended-resources/META-INF/NOTICE.vm (with props)
incubator/aries/trunk/jmx/jmx-core/
incubator/aries/trunk/jmx/jmx-core/pom.xml (with props)
incubator/aries/trunk/jmx/jmx-core/src/
incubator/aries/trunk/jmx/jmx-core/src/main/
incubator/aries/trunk/jmx/jmx-core/src/main/appended-resources/
incubator/aries/trunk/jmx/jmx-core/src/main/appended-resources/META-INF/
incubator/aries/trunk/jmx/jmx-core/src/main/appended-resources/META-INF/NOTICE.vm (with props)
incubator/aries/trunk/jmx/jmx-core/src/main/java/
incubator/aries/trunk/jmx/jmx-core/src/main/java/org/
incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/
incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/
incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/
incubator/aries/trunk/jmx/jmx-core/src/main/java/org/apache/aries/jmx/Activator.java (with props)
incubator/aries/trunk/jmx/jmx-core/src/test/
incubator/aries/trunk/jmx/jmx-core/src/test/java/
incubator/aries/trunk/jmx/pom.xml (with props)
Modified:
incubator/aries/trunk/pom.xml
Added: incubator/aries/trunk/jmx/LICENSE
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/LICENSE?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/LICENSE (added)
+++ incubator/aries/trunk/jmx/LICENSE Thu Nov 19 11:43:42 2009
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
Propchange: incubator/aries/trunk/jmx/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/NOTICE
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/NOTICE?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/NOTICE (added)
+++ incubator/aries/trunk/jmx/NOTICE Thu Nov 19 11:43:42 2009
@@ -0,0 +1,9 @@
+Aries JMX Specification Implementation
+Copyright 2009 The Apache Aries development community
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+This product includes software developed at
+the OSGi Alliance (http://www.osgi.org/).
+
Propchange: incubator/aries/trunk/jmx/NOTICE
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/pom.xml?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/pom.xml (added)
+++ incubator/aries/trunk/jmx/jmx-api/pom.xml Thu Nov 19 11:43:42 2009
@@ -0,0 +1,57 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>jmx</artifactId>
+ <version>1.0.0-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>aries-jmx-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries JMX API</name>
+ <description>
+ This bundle contains the JMX 1.0.0 API
+ </description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${pom.groupId}.api</Bundle-SymbolicName>
+ <Export-Package>
+ org.osgi.jmx;version="1.0.0";uses:="javax.management.openmbean",
+ org.osgi.jmx.framework;version="1.5.0";uses:="org.osgi.jmx,javax.management.openmbean",
+ org.osgi.jmx.service.cm;version="1.3.0";uses:="javax.management.openmbean",
+ org.osgi.jmx.service.permissionadmin;version="1.2.0";uses:="org.osgi.jmx",
+ org.osgi.jmx.service.provisioning;version="1.2.0";uses:="javax.management.openmbean",
+ org.osgi.jmx.service.useradmin;version="1.1.0";uses:="org.osgi.jmx,javax.management.openmbean"
+ </Export-Package>
+ <Import-Package>!org.osgi.jmx*,*</Import-Package>
+ <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+ <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL</_removeheaders>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: incubator/aries/trunk/jmx/jmx-api/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm Thu Nov 19 11:43:42 2009
@@ -0,0 +1,2 @@
+This product includes software developed at
+the OSGi Alliance (http://www.osgi.org/).
\ No newline at end of file
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/appended-resources/META-INF/NOTICE.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java Thu Nov 19 11:43:42 2009
@@ -0,0 +1,198 @@
+/*
+ * 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.Collections;
+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 $Rev$
+ * @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(key, parent.getDescription(key),
+ parent.getType(key)));
+ }
+ }
+
+ Collections.addAll(all, items);
+
+ int size = all.size();
+ String names[] = new String[size];
+ String descriptions[] = new String[size];
+ OpenType types[] = new OpenType[size];
+
+ int m = 0;
+ for (Item item : all) {
+ names[m] = item.name;
+ descriptions[m] = item.description;
+ types[m] = item.type;
+ m++;
+ }
+
+ try {
+ return new CompositeType(name, description, names, descriptions,
+ types);
+ } catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/Item.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java Thu Nov 19 11:43:42 2009
@@ -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.Collections;
+import java.util.List;
+
+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 $Rev$
+ * @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 List<String> SCALAR = Collections
+ .unmodifiableList(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";
+}
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java Thu Nov 19 11:43:42 2009
@@ -0,0 +1,688 @@
+/*
+ * 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 $Rev$
+ */
+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 key EVENT, used in {@link #EVENT_ITEM}.
+ */
+ String EVENT = "BundleEvent";
+
+ /**
+ * The item containing the event type. The key is {@link #EVENT} and the type is {@link SimpleType#INTEGER}
+ */
+ Item EVENT_ITEM = new Item(
+ EVENT,
+ "The type of the event: {INSTALLED=1, STARTED=2, STOPPED=4, UPDATED=8, UNINSTALLED=16}",
+ SimpleType.INTEGER);
+
+ /**
+ * The Composite Type that represents a bundle event. This composite consists of:
+ * <ul>
+ * <li>{@link #IDENTIFIER}</li>
+ * <li>{@link #LOCATION}</li>
+ * <li>{@link #SYMBOLIC_NAME}</li>
+ * <li>{@link #EVENT}</li>
+ * </ul>
+ */
+ CompositeType BUNDLE_EVENT_TYPE = Item.compositeType("BUNDLE_EVENT",
+ "This type encapsulates OSGi bundle events", IDENTIFIER_ITEM,
+ LOCATION_ITEM, SYMBOLIC_NAME_ITEM, EVENT_ITEM);
+
+ /**
+ * 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;
+
+}
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java Thu Nov 19 11:43:42 2009
@@ -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 $Rev$
+ */
+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
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/FrameworkMBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java?rev=882116&view=auto
==============================================================================
--- incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java (added)
+++ incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java Thu Nov 19 11:43:42 2009
@@ -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 $Rev$
+ */
+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;
+
+}
Propchange: incubator/aries/trunk/jmx/jmx-api/src/main/java/org/osgi/jmx/framework/PackageStateMBean.java
------------------------------------------------------------------------------
svn:eol-style = native