You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/03/05 16:35:12 UTC

svn commit: r1574527 - in /felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin: ./ ComponentAdmin.java ComponentDeclaration.java ComponentDependencyDeclaration.java packageinfo

Author: pderop
Date: Wed Mar  5 15:35:12 2014
New Revision: 1574527

URL: http://svn.apache.org/r1574527
Log:
Introduced new singleton "ComponentAdmin" service, which provides access to all dependency manager components.

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentAdmin.java
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDeclaration.java
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDependencyDeclaration.java
    felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/packageinfo

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentAdmin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentAdmin.java?rev=1574527&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentAdmin.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentAdmin.java Wed Mar  5 15:35:12 2014
@@ -0,0 +1,30 @@
+package dm.admin;
+
+import java.util.List;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Service for administering Dependency Manager components.
+ * The main purpose of this interface is to provides access to the components declared by all 
+ * dependency manager instances at runtime.
+ */
+public interface ComponentAdmin {
+	/**
+	 * Returns components declared by all dependency managers instances. 
+	 * @return the list of components declared by all dependency managers instances.
+	 */
+	List<ComponentDeclaration> getComponents();
+
+	/**
+	 * Returns the component matching a given id. 
+	 * @return the component matching a given id or null.
+	 */
+	ComponentDeclaration getComponent(long componentId);
+
+	/**
+	 * Returns the components declared by dependency managers being part of a given bundle.
+	 * @return the components declared by dependency managers being part of a given bundle.
+	 */
+	List<ComponentDeclaration> getComponents(Bundle bundle);
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDeclaration.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDeclaration.java?rev=1574527&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDeclaration.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDeclaration.java Wed Mar  5 15:35:12 2014
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package dm.admin;
+
+import java.util.Dictionary;
+
+import org.osgi.framework.BundleContext;
+
+import dm.DependencyManager;
+
+/**
+ * Describes a component. Component declarations form descriptions of components
+ * that are managed by the dependency manager. They can be used to query their state
+ * for monitoring tools. The dependency manager shell command is an example of
+ * such a tool.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface ComponentDeclaration {
+    /** Names for the states of this component. */
+    public static final String[] STATE_NAMES = { "unregistered", "registered" };
+    /** State constant for an unregistered component. */
+    public static final int STATE_UNREGISTERED = 0;
+    /** State constant for a registered component. */
+    public static final int STATE_REGISTERED = 1;
+    /** Returns a list of dependencies associated with this component. */
+    public ComponentDependencyDeclaration[] getComponentDependencies();
+    /** Returns the description of this component (the classname or the provided service(s)) */
+    public String getName();
+    /** Returns the class name of the Component implementation. */
+    public String getClassName();
+    /** Returns the service optionally provided by this component, or null */
+    public String[] getServices();
+    /** Returns the service properties, or null */
+    public Dictionary getServiceProperties();     
+    /** Returns the state of this component. */
+    public int getState();
+    /** Returns the instance id of this component. */
+    public long getId();
+    /** Returns the bundle context associated with this component. */
+    public BundleContext getBundleContext();
+    /** Returns the dependency manager for this component */
+    public DependencyManager getDependencyManager();    
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDependencyDeclaration.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDependencyDeclaration.java?rev=1574527&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDependencyDeclaration.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/ComponentDependencyDeclaration.java Wed Mar  5 15:35:12 2014
@@ -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.
+ */
+package dm.admin;
+
+/**
+ * Describes a component dependency. They form descriptions of dependencies
+ * that are managed by the dependency manager. They can be used to query their state
+ * for monitoring tools. The dependency manager shell command is an example of
+ * such a tool.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public interface ComponentDependencyDeclaration {
+    /** Names for the states of this dependency. */
+    public static final String[] STATE_NAMES = { 
+        "optional unavailable", 
+        "optional available", 
+        "required unavailable", 
+        "required available",
+        "optional (not tracking)",
+        "required (not tracking)"
+        };
+    /** State constant for an unavailable, optional dependency. */
+    public static final int STATE_UNAVAILABLE_OPTIONAL = 0;
+    /** State constant for an available, optional dependency. */
+    public static final int STATE_AVAILABLE_OPTIONAL = 1;
+    /** State constant for an unavailable, required dependency. */
+    public static final int STATE_UNAVAILABLE_REQUIRED = 2;
+    /** State constant for an available, required dependency. */
+    public static final int STATE_AVAILABLE_REQUIRED = 3;
+    /** State constant for an optional dependency that has not been started yet. */
+    public static final int STATE_OPTIONAL = 4;
+    /** State constant for a required dependency that has not been started yet. */
+    public static final int STATE_REQUIRED = 5;
+    /** Returns the name of this dependency. */
+    public String getName();
+    /** Returns the name of the type of this dependency. */
+    public String getType();
+    /** Returns the state of this dependency. */
+    public int getState();
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/packageinfo
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/packageinfo?rev=1574527&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/packageinfo (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm/src/dm/admin/packageinfo Wed Mar  5 15:35:12 2014
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file