felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r469183 - in /incubator/felix/trunk/ipojo.arch: pom.xml src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java src/main/resources/metadata.xml
Date Mon, 30 Oct 2006 16:36:54 GMT
Author: rickhall
Date: Mon Oct 30 08:36:53 2006
New Revision: 469183

URL: http://svn.apache.org/viewvc?view=rev&rev=469183
Log:
Applied patch (FELIX-167) to bring the iPOJO arch command in line with
the new version of iPOJO.

Modified:
    incubator/felix/trunk/ipojo.arch/pom.xml
    incubator/felix/trunk/ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
    incubator/felix/trunk/ipojo.arch/src/main/resources/metadata.xml

Modified: incubator/felix/trunk/ipojo.arch/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.arch/pom.xml?view=diff&rev=469183&r1=469182&r2=469183
==============================================================================
--- incubator/felix/trunk/ipojo.arch/pom.xml (original)
+++ incubator/felix/trunk/ipojo.arch/pom.xml Mon Oct 30 08:36:53 2006
@@ -7,7 +7,7 @@
   <modelVersion>4.0.0</modelVersion>
   <packaging>ipojo-bundle</packaging>
   <name>Apache Felix iPOJO Arch Command</name>
-  <version>0.6.0-SNAPSHOT</version>
+  <version>0.7.0-incubator-SNAPSHOT</version>
   <artifactId>org.apache.felix.ipojo.arch</artifactId>
   <dependencies>
     <dependency>

Modified: incubator/felix/trunk/ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java?view=diff&rev=469183&r1=469182&r2=469183
==============================================================================
--- incubator/felix/trunk/ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
(original)
+++ incubator/felix/trunk/ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
Mon Oct 30 08:36:53 2006
@@ -1,32 +1,29 @@
-/*
- *   Copyright 2006 The Apache Software Foundation
+/* 
+ * 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
  *
- *   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.
+ *   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.apache.felix.ipojo.arch;
 
 
 import java.io.PrintStream;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
 
 import org.apache.felix.ipojo.architecture.Architecture;
 import org.apache.felix.ipojo.architecture.ComponentDescription;
-import org.apache.felix.ipojo.architecture.DependencyDescription;
-import org.apache.felix.ipojo.architecture.ProvidedServiceDescription;
-import org.apache.felix.ipojo.architecture.State;
+import org.apache.felix.ipojo.architecture.HandlerDescription;
 import org.ungoverned.osgi.service.shell.Command;
 
 
@@ -61,6 +58,25 @@
     public String getShortDescription() {
         return "Architecture command : display the architecture";
     }
+    
+    
+    /**
+     * Return the String corresponding to a component state.
+     * @param state : the state in int
+     * @return : the string of the state (Stopped, Unresolved, Resolved) or "Unknown" if
state is not revelant
+     */
+    private String getComponentState(int state) {
+        switch(state) {
+        case(0) :
+            return "STOPPED";
+        case(1) :
+            return "INVALID";
+        case(2) :
+            return  "VALID";
+        default :
+            return "UNKNOWN";
+        }
+    }
 
     /**
      * @see org.ungoverned.osgi.service.shell.Command#execute(java.lang.String, java.io.PrintStream,
java.io.PrintStream)
@@ -69,34 +85,20 @@
         synchronized(this) { 
         	for(int i=0; i < archiService.length; i++) {
         		ComponentDescription component = archiService[i].getComponentDescription();   
   
-        		out.println("Component : " + component.getClassName() + " - " + State.printComponentState(component.getState()));
-        		for(int j = 0; j < component.getDependencies().length; j++) {
-        			DependencyDescription dd = component.getDependencies()[j];
-        			out.println("\t Dependency : " + dd.getInterface() + " - " + State.printDependencyState(dd.getState())
+ " - Optional : " + dd.isOptional() + " - Multiple : " + dd.isMultiple());
-        			// getUsedServices :
-        			HashMap hm = dd.getUsedServices();
-        			Iterator it = hm.keySet().iterator();
-        			while(it.hasNext()) {
-        				String key = (String) it.next();
-        				out.println("\t\t Used Service : " + key + " - " + hm.get(key));
-        			}
+        		out.println("Component : " + component.getClassName() + " - " + getComponentState(component.getState())
+ " from bundle " + component.getBundleId());
+        		for(int j = 0; j < component.getHandlers().length; j++) {
+        			HandlerDescription hd = component.getHandlers()[j];
+        			String hn = hd.getHandlerName();
+        			String hv = "valid";
+        			if(!hd.isValid()) { hv = "invalid"; }
+        			String hi = hd.getHandlerInfo();
+        			out.println("Handler : " + hn + " : " + hv);
+        			if(!hi.equals("")) { out.println(hi); }
         		}
-        		for(int j=0;  j < component.getProvideServices().length; j++) {
-        			ProvidedServiceDescription ps = component.getProvideServices()[j];
-        			String spec = "";
-        			for(int k = 0; k < ps.getServiceSpecification().length; k++) {
-        				spec = spec + " " + ps.getServiceSpecification()[k];
-        			}
-        			out.println("\t Provides : " + spec + " - " + State.printProvidedServiceState(ps.getState()));
-        			Enumeration e = ps.getProperties().propertyNames();
-        			while(e.hasMoreElements()) {
-        				Object key = e.nextElement();
-        				out.println("\t\t Service Property : " + key.toString() + " = " + ps.getProperties().getProperty(key.toString()));
 
-        			}
-        		}
-        		out.println("\tCreated Instances : ");
+        		
+        		out.println("Created Instances of the POJO : ");
         		for(int j=0;  j < component.getInstances().length; j++) {
-        			out.println("\t\t" + component.getInstances()[j]);
+        			out.println("\t" + component.getInstances()[j]);
         		}
         		
         		out.print("\n");
@@ -104,4 +106,4 @@
         }
         
     }
-}
\ No newline at end of file
+}

Modified: incubator/felix/trunk/ipojo.arch/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo.arch/src/main/resources/metadata.xml?view=diff&rev=469183&r1=469182&r2=469183
==============================================================================
--- incubator/felix/trunk/ipojo.arch/src/main/resources/metadata.xml (original)
+++ incubator/felix/trunk/ipojo.arch/src/main/resources/metadata.xml Mon Oct 30 08:36:53 2006
@@ -4,4 +4,5 @@
 		  <Provides interface="org.ungoverned.osgi.service.shell.Command"/>
 		  <Dependency field="archiService" optional="true"/>
 	</Component>
+	<instance component="org.apache.felix.ipojo.arch.ArchCommandImpl" name="ArchCommand"/>
 </iPOJO>



Mime
View raw message