felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r1350613 [4/14] - in /felix/trunk/bundleplugin/src/main/java/aQute: bnd/annotation/ bnd/annotation/component/ bnd/annotation/metatype/ bnd/build/ bnd/compatibility/ bnd/component/ bnd/differ/ bnd/help/ bnd/make/ bnd/make/calltree/ bnd/make/...
Date Fri, 15 Jun 2012 13:28:02 GMT
Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java Fri Jun 15 13:27:53 2012
@@ -22,18 +22,20 @@ public class ComponentAnnotationReader e
 	static Pattern				ACTIVATEDESCRIPTOR		= Pattern
 																.compile("\\(((Lorg/osgi/service/component/ComponentContext;)|(Lorg/osgi/framework/BundleContext;)|(Ljava/util/Map;))*\\)V");
 	static Pattern				OLDACTIVATEDESCRIPTOR	= Pattern
-	.compile("\\(Lorg/osgi/service/component/ComponentContext;\\)V");
-	
-	
+																.compile("\\(Lorg/osgi/service/component/ComponentContext;\\)V");
+
 	static Pattern				OLDBINDDESCRIPTOR		= Pattern.compile("\\(L([^;]*);\\)V");
 	static Pattern				REFERENCEBINDDESCRIPTOR	= Pattern
 																.compile("\\(Lorg/osgi/framework/ServiceReference;\\)V");
 
 	static String[]				ACTIVATE_ARGUMENTS		= {
-		"org.osgi.service.component.ComponentContext", "org.osgi.framework.BundleContext",
-		Map.class.getName(), "org.osgi.framework.BundleContext" };
-	static String[]				OLD_ACTIVATE_ARGUMENTS	= { "org.osgi.service.component.ComponentContext" };
-	
+			"org.osgi.service.component.ComponentContext", "org.osgi.framework.BundleContext", Map.class.getName(),
+			"org.osgi.framework.BundleContext"
+														};
+	static String[]				OLD_ACTIVATE_ARGUMENTS	= {
+															"org.osgi.service.component.ComponentContext"
+														};
+
 	Reporter					reporter				= new Processor();
 	MethodDef					method;
 	TypeRef						className;
@@ -43,7 +45,7 @@ public class ComponentAnnotationReader e
 	Set<String>					optional				= new HashSet<String>();
 	Set<String>					dynamic					= new HashSet<String>();
 
-	Map<String, String>			map						= new TreeMap<String, String>();
+	Map<String,String>			map						= new TreeMap<String,String>();
 	Set<String>					descriptors				= new HashSet<String>();
 	List<String>				properties				= new ArrayList<String>();
 	String						version					= null;
@@ -62,11 +64,11 @@ public class ComponentAnnotationReader e
 		return this.reporter;
 	}
 
-	public static Map<String, String> getDefinition(Clazz c) throws Exception {
+	public static Map<String,String> getDefinition(Clazz c) throws Exception {
 		return getDefinition(c, new Processor());
 	}
 
-	public static Map<String, String> getDefinition(Clazz c, Reporter reporter) throws Exception {
+	public static Map<String,String> getDefinition(Clazz c, Reporter reporter) throws Exception {
 		ComponentAnnotationReader r = new ComponentAnnotationReader(c);
 		r.setReporter(reporter);
 		c.parseClassFileWithCollector(r);
@@ -76,7 +78,7 @@ public class ComponentAnnotationReader e
 
 	public void annotation(Annotation annotation) {
 		String fqn = annotation.getName().getFQN();
-		
+
 		if (fqn.equals(Component.class.getName())) {
 			set(COMPONENT_NAME, annotation.get(Component.NAME), "<>");
 			set(COMPONENT_FACTORY, annotation.get(Component.FACTORY), false);
@@ -296,9 +298,8 @@ public class ComponentAnnotationReader e
 	}
 
 	/**
-	 * Skip L and ; and replace / for . in an object descriptor.
-	 * 
-	 * A string like Lcom/acme/Foo; becomes com.acme.Foo
+	 * Skip L and ; and replace / for . in an object descriptor. A string like
+	 * Lcom/acme/Foo; becomes com.acme.Foo
 	 * 
 	 * @param string
 	 * @return
@@ -315,15 +316,18 @@ public class ComponentAnnotationReader e
 		return sb.toString();
 	}
 
-	@Override public void classBegin(int access, TypeRef name) {
+	@Override
+	public void classBegin(int access, TypeRef name) {
 		className = name;
 	}
 
-	@Override public void implementsInterfaces(TypeRef[] interfaces) {
+	@Override
+	public void implementsInterfaces(TypeRef[] interfaces) {
 		this.interfaces = interfaces;
 	}
 
-	@Override public void method(Clazz.MethodDef method) {
+	@Override
+	public void method(Clazz.MethodDef method) {
 		this.method = method;
 		descriptors.add(method.getName());
 	}

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java Fri Jun 15 13:27:53 2012
@@ -26,7 +26,7 @@ public class ServiceComponent implements
 
 		ComponentMaker m = new ComponentMaker(analyzer);
 
-		Map<String, Map<String, String>> l = m.doServiceComponent();
+		Map<String,Map<String,String>> l = m.doServiceComponent();
 
 		analyzer.setProperty(Constants.SERVICE_COMPONENT, Processor.printClauses(l));
 
@@ -50,21 +50,20 @@ public class ServiceComponent implements
 		 * <li>An XML file reference</li>
 		 * <li>A FQN/wildcard with a set of attributes</li>
 		 * </ol>
-		 * 
 		 * An XML reference is immediately expanded, an FQN/wildcard is more
 		 * complicated and is delegated to
 		 * {@link #componentEntry(Map, String, Map)}.
 		 * 
 		 * @throws Exception
 		 */
-		Map<String, Map<String, String>> doServiceComponent() throws Exception {
-			Map<String, Map<String, String>> serviceComponents = newMap();
+		Map<String,Map<String,String>> doServiceComponent() throws Exception {
+			Map<String,Map<String,String>> serviceComponents = newMap();
 			String header = getProperty(SERVICE_COMPONENT);
 			Parameters sc = parseHeader(header);
 
-			for (Entry<String, Attrs> entry : sc.entrySet()) {
+			for (Entry<String,Attrs> entry : sc.entrySet()) {
 				String name = entry.getKey();
-				Map<String, String> info = entry.getValue();
+				Map<String,String> info = entry.getValue();
 
 				try {
 					if (name.indexOf('/') >= 0 || name.endsWith(".xml")) {
@@ -73,7 +72,8 @@ public class ServiceComponent implements
 					} else {
 						componentEntry(serviceComponents, name, info);
 					}
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					e.printStackTrace();
 					error("Invalid Service-Component header: %s %s, throws %s", name, info, e);
 				}
@@ -89,17 +89,16 @@ public class ServiceComponent implements
 		 * <li>A wildcard expression for finding annotated components.</li>
 		 * </ol>
 		 * The problem is the distinction between an FQN and a wildcard because
-		 * an FQN can also be used as a wildcard.
-		 * 
-		 * If the info specifies {@link Constants#NOANNOTATIONS} then wildcards
-		 * are an error and the component must be fully described by the info.
-		 * Otherwise the FQN/wildcard is expanded into a list of classes with
-		 * annotations. If this list is empty, the FQN case is interpreted as a
-		 * complete component definition. For the wildcard case, it is checked
-		 * if any matching classes for the wildcard have been compiled for a
-		 * class file format that does not support annotations, this can be a
-		 * problem with JSR14 who silently ignores annotations. An error is
-		 * reported in such a case.
+		 * an FQN can also be used as a wildcard. If the info specifies
+		 * {@link Constants#NOANNOTATIONS} then wildcards are an error and the
+		 * component must be fully described by the info. Otherwise the
+		 * FQN/wildcard is expanded into a list of classes with annotations. If
+		 * this list is empty, the FQN case is interpreted as a complete
+		 * component definition. For the wildcard case, it is checked if any
+		 * matching classes for the wildcard have been compiled for a class file
+		 * format that does not support annotations, this can be a problem with
+		 * JSR14 who silently ignores annotations. An error is reported in such
+		 * a case.
 		 * 
 		 * @param serviceComponents
 		 * @param name
@@ -107,8 +106,8 @@ public class ServiceComponent implements
 		 * @throws Exception
 		 * @throws IOException
 		 */
-		private void componentEntry(Map<String, Map<String, String>> serviceComponents,
-				String name, Map<String, String> info) throws Exception, IOException {
+		private void componentEntry(Map<String,Map<String,String>> serviceComponents, String name,
+				Map<String,String> info) throws Exception, IOException {
 
 			boolean annotations = !Processor.isTrue(info.get(NOANNOTATIONS));
 			boolean fqn = Verifier.isFQN(name);
@@ -117,8 +116,8 @@ public class ServiceComponent implements
 
 				// Annotations possible!
 
-				Collection<Clazz> annotatedComponents = analyzer.getClasses("",
-						QUERY.ANNOTATED.toString(), Component.class.getName(), //
+				Collection<Clazz> annotatedComponents = analyzer.getClasses("", QUERY.ANNOTATED.toString(),
+						Component.class.getName(), //
 						QUERY.NAMED.toString(), name //
 						);
 
@@ -169,9 +168,9 @@ public class ServiceComponent implements
 		private Collection<Clazz> checkAnnotationsFeasible(String name) throws Exception {
 			Collection<Clazz> not = analyzer.getClasses("", QUERY.NAMED.toString(), name //
 					);
-			
+
 			if (not.isEmpty())
-				if ( "*".equals(name))
+				if ("*".equals(name))
 					return not;
 				else
 					error("Specified %s but could not find any class matching this pattern", name);
@@ -180,18 +179,17 @@ public class ServiceComponent implements
 				if (c.getFormat().hasAnnotations())
 					return not;
 			}
-			
+
 			warning("Wildcards are used (%s) requiring annotations to decide what is a component. Wildcard maps to classes that are compiled with java.target < 1.5. Annotations were introduced in Java 1.5",
 					name);
-			
+
 			return not;
 		}
 
-		void annotated(Map<String, Map<String, String>> components, Clazz c,
-				Map<String, String> info) throws Exception {
+		void annotated(Map<String,Map<String,String>> components, Clazz c, Map<String,String> info) throws Exception {
 			// Get the component definition
 			// from the annotations
-			Map<String, String> map = ComponentAnnotationReader.getDefinition(c, this);
+			Map<String,String> map = ComponentAnnotationReader.getDefinition(c, this);
 
 			// Pick the name, the annotation can override
 			// the name.
@@ -202,16 +200,15 @@ public class ServiceComponent implements
 			// Override the component info without manifest
 			// entries. We merge the properties though.
 
-			String merged = Processor.merge(info.remove(COMPONENT_PROPERTIES),
-					map.remove(COMPONENT_PROPERTIES));
+			String merged = Processor.merge(info.remove(COMPONENT_PROPERTIES), map.remove(COMPONENT_PROPERTIES));
 			if (merged != null && merged.length() > 0)
 				map.put(COMPONENT_PROPERTIES, merged);
 			map.putAll(info);
 			createComponentResource(components, localname, map);
 		}
 
-		private void createComponentResource(Map<String, Map<String, String>> components,
-				String name, Map<String, String> info) throws IOException {
+		private void createComponentResource(Map<String,Map<String,String>> components, String name,
+				Map<String,String> info) throws IOException {
 
 			// We can override the name in the parameters
 			if (info.containsKey(COMPONENT_NAME))
@@ -264,9 +261,7 @@ public class ServiceComponent implements
 
 					analyzer.getJar().putResource(rname, r);
 				} else {
-					analyzer.error(
-							"Cannot find designated configuration class %s for component %s", c,
-							name);
+					analyzer.error("Cannot find designated configuration class %s for component %s", c, name);
 				}
 			}
 			return true;
@@ -280,8 +275,7 @@ public class ServiceComponent implements
 		 * @param info
 		 * @throws UnsupportedEncodingException
 		 */
-		Resource createComponentResource(String name, String impl, Map<String, String> info)
-				throws IOException {
+		Resource createComponentResource(String name, String impl, Map<String,String> info) throws IOException {
 			String namespace = getNamespace(info);
 			ByteArrayOutputStream out = new ByteArrayOutputStream();
 			PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, Constants.DEFAULT_CHARSET));
@@ -295,8 +289,8 @@ public class ServiceComponent implements
 			doAttribute(pw, info.get(COMPONENT_FACTORY), "factory");
 			doAttribute(pw, info.get(COMPONENT_IMMEDIATE), "immediate", "false", "true");
 			doAttribute(pw, info.get(COMPONENT_ENABLED), "enabled", "true", "false");
-			doAttribute(pw, info.get(COMPONENT_CONFIGURATION_POLICY), "configuration-policy",
-					"optional", "require", "ignore");
+			doAttribute(pw, info.get(COMPONENT_CONFIGURATION_POLICY), "configuration-policy", "optional", "require",
+					"ignore");
 			doAttribute(pw, info.get(COMPONENT_ACTIVATE), "activate", JIDENTIFIER);
 			doAttribute(pw, info.get(COMPONENT_DEACTIVATE), "deactivate", JIDENTIFIER);
 			doAttribute(pw, info.get(COMPONENT_MODIFIED), "modified", JIDENTIFIER);
@@ -335,13 +329,12 @@ public class ServiceComponent implements
 				if (matches.length != 0) {
 					if (matches.length == 1 && matches[0].equals(JIDENTIFIER)) {
 						if (!Verifier.isIdentifier(value))
-							error("Component attribute %s has value %s but is not a Java identifier",
-									name, value);
+							error("Component attribute %s has value %s but is not a Java identifier", name, value);
 					} else {
 
 						if (!Verifier.isMember(value, matches))
-							error("Component attribute %s has value %s but is not a member of %s",
-									name, value, Arrays.toString(matches));
+							error("Component attribute %s has value %s but is not a member of %s", name, value,
+									Arrays.toString(matches));
 					}
 				}
 				pw.print(" ");
@@ -358,15 +351,15 @@ public class ServiceComponent implements
 		 * @param info
 		 * @return
 		 */
-		private String getNamespace(Map<String, String> info) {
+		private String getNamespace(Map<String,String> info) {
 			String version = info.get(COMPONENT_VERSION);
 			if (version != null) {
 				try {
 					Version v = new Version(version);
 					return NAMESPACE_STEM + "/v" + v;
-				} catch (Exception e) {
-					error("version: specified on component header but not a valid version: "
-							+ version);
+				}
+				catch (Exception e) {
+					error("version: specified on component header but not a valid version: " + version);
 					return null;
 				}
 			}
@@ -384,7 +377,7 @@ public class ServiceComponent implements
 		 * @param pw
 		 * @param info
 		 */
-		void properties(PrintWriter pw, Map<String, String> info) {
+		void properties(PrintWriter pw, Map<String,String> info) {
 			Collection<String> properties = split(info.get(COMPONENT_PROPERTIES));
 			for (Iterator<String> p = properties.iterator(); p.hasNext();) {
 				String clause = p.next();
@@ -468,21 +461,20 @@ public class ServiceComponent implements
 		 * @param pw
 		 */
 
-		void reference(Map<String, String> info, PrintWriter pw) {
+		void reference(Map<String,String> info, PrintWriter pw) {
 			Collection<String> dynamic = new ArrayList<String>(split(info.get(COMPONENT_DYNAMIC)));
 			Collection<String> optional = new ArrayList<String>(split(info.get(COMPONENT_OPTIONAL)));
 			Collection<String> multiple = new ArrayList<String>(split(info.get(COMPONENT_MULTIPLE)));
 
 			Collection<String> descriptors = split(info.get(COMPONENT_DESCRIPTORS));
 
-			for (Map.Entry<String, String> entry : info.entrySet()) {
+			for (Map.Entry<String,String> entry : info.entrySet()) {
 
 				// Skip directives
 				String referenceName = entry.getKey();
 				if (referenceName.endsWith(":")) {
 					if (!SET_COMPONENT_DIRECTIVES.contains(referenceName))
-						error("Unrecognized directive in Service-Component header: "
-								+ referenceName);
+						error("Unrecognized directive in Service-Component header: " + referenceName);
 					continue;
 				}
 
@@ -508,15 +500,14 @@ public class ServiceComponent implements
 					}
 				} else if (Character.isLowerCase(referenceName.charAt(0))) {
 					unbindCalculated = true;
-					bind = "set" + Character.toUpperCase(referenceName.charAt(0))
-							+ referenceName.substring(1);
+					bind = "set" + Character.toUpperCase(referenceName.charAt(0)) + referenceName.substring(1);
 					unbind = "un" + bind;
 				}
 
 				String interfaceName = entry.getValue();
 				if (interfaceName == null || interfaceName.length() == 0) {
-					error("Invalid Interface Name for references in Service Component: "
-							+ referenceName + "=" + interfaceName);
+					error("Invalid Interface Name for references in Service Component: " + referenceName + "="
+							+ interfaceName);
 					continue;
 				}
 
@@ -603,21 +594,21 @@ public class ServiceComponent implements
 		for (int i = 0; i < s.length(); i++) {
 			char c = s.charAt(i);
 			switch (c) {
-			case '<':
-				sb.append("&lt;");
-				break;
-			case '>':
-				sb.append("&gt;");
-				break;
-			case '&':
-				sb.append("&amp;");
-				break;
-			case '\'':
-				sb.append("&quot;");
-				break;
-			default:
-				sb.append(c);
-				break;
+				case '<' :
+					sb.append("&lt;");
+					break;
+				case '>' :
+					sb.append("&gt;");
+					break;
+				case '&' :
+					sb.append("&amp;");
+					break;
+				case '\'' :
+					sb.append("&quot;");
+					break;
+				default :
+					sb.append(c);
+					break;
 			}
 		}
 		return sb.toString();

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java Fri Jun 15 13:27:53 2012
@@ -11,89 +11,84 @@ import aQute.lib.osgi.Descriptors.TypeRe
  * This class can create a coverage table between two classspaces. The
  * destination class space is used to create a table of methods. All source
  * methods that refer to a specific dest are then filled into the table.
- * 
  */
 public class Coverage {
 
-    /**
-     * Create a cross reference table from source to dest.
-     * 
-     * @param source
-     *            The methods that refer to dest
-     * @param dest
-     *            The methods that are being referred to
-     * @return A mapping of source methods to destination methods.
-     * @throws IOException
-     */
-    public static Map<MethodDef, List<MethodDef>> getCrossRef(
-            Collection<Clazz> source, Collection<Clazz> dest)
-            throws Exception {
-        final Map<MethodDef, List<MethodDef>> catalog = buildCatalog(dest);
-        crossRef(source, catalog);
-        return catalog;
-    }
-
-    private static void crossRef(Collection<Clazz> source,
-            final Map<MethodDef, List<MethodDef>> catalog) throws Exception {
-        for (final Clazz clazz : source) {
-            clazz.parseClassFileWithCollector(new ClassDataCollector() {
-                MethodDef source;
-
-                public void implementsInterfaces(TypeRef names[]) {
-                    MethodDef def = clazz.getMethodDef(0,
-                            "<implements>", "()V");
-                    // TODO
-                    for (TypeRef interfaceName : names) {
-                        for (Map.Entry<MethodDef, List<MethodDef>> entry : catalog
-                                .entrySet()) {
-                            String catalogClass = entry.getKey().getContainingClass().getFQN();
-                            List<MethodDef> references = entry.getValue();
-
-                            if (catalogClass.equals(interfaceName.getFQN())) {
-                                references.add(def);
-                            }
-                        }
-                    }
-                }
-
-                // Method definitions
-                public void method(MethodDef source) {
-                    this.source = source;
-                }
-
-                public void reference(MethodDef reference) {
-                    List<MethodDef> references = catalog.get(reference);
-                    if (references != null) {
-                        references.add(source);
-                    }
-                }
-            });
-        }
-    }
-
-    private static Map<MethodDef, List<MethodDef>> buildCatalog(
-            Collection<Clazz> sources) throws Exception {
-        final Map<MethodDef, List<MethodDef>> catalog = new TreeMap<MethodDef, List<MethodDef>>(new Comparator<MethodDef>() {
-			public int compare(MethodDef a, MethodDef b) {
-				return a.getName().compareTo(b.getName());
-			}
-		});
-        for (final Clazz clazz : sources) {
-            clazz.parseClassFileWithCollector(new ClassDataCollector() {
-
-                public boolean classStart(int access, TypeRef name) {
-                    return clazz.isPublic();
-                }
-
-                public void method(MethodDef source) {
-                    if (source.isPublic()
-                            || source.isProtected())
-                        catalog.put(source, new ArrayList<MethodDef>());
-                }
-
-            });
-        }
-        return catalog;
-    }
+	/**
+	 * Create a cross reference table from source to dest.
+	 * 
+	 * @param source
+	 *            The methods that refer to dest
+	 * @param dest
+	 *            The methods that are being referred to
+	 * @return A mapping of source methods to destination methods.
+	 * @throws IOException
+	 */
+	public static Map<MethodDef,List<MethodDef>> getCrossRef(Collection<Clazz> source, Collection<Clazz> dest)
+			throws Exception {
+		final Map<MethodDef,List<MethodDef>> catalog = buildCatalog(dest);
+		crossRef(source, catalog);
+		return catalog;
+	}
+
+	private static void crossRef(Collection<Clazz> source, final Map<MethodDef,List<MethodDef>> catalog)
+			throws Exception {
+		for (final Clazz clazz : source) {
+			clazz.parseClassFileWithCollector(new ClassDataCollector() {
+				MethodDef	source;
+
+				public void implementsInterfaces(TypeRef names[]) {
+					MethodDef def = clazz.getMethodDef(0, "<implements>", "()V");
+					// TODO
+					for (TypeRef interfaceName : names) {
+						for (Map.Entry<MethodDef,List<MethodDef>> entry : catalog.entrySet()) {
+							String catalogClass = entry.getKey().getContainingClass().getFQN();
+							List<MethodDef> references = entry.getValue();
+
+							if (catalogClass.equals(interfaceName.getFQN())) {
+								references.add(def);
+							}
+						}
+					}
+				}
+
+				// Method definitions
+				public void method(MethodDef source) {
+					this.source = source;
+				}
+
+				public void reference(MethodDef reference) {
+					List<MethodDef> references = catalog.get(reference);
+					if (references != null) {
+						references.add(source);
+					}
+				}
+			});
+		}
+	}
+
+	private static Map<MethodDef,List<MethodDef>> buildCatalog(Collection<Clazz> sources) throws Exception {
+		final Map<MethodDef,List<MethodDef>> catalog = new TreeMap<MethodDef,List<MethodDef>>(
+				new Comparator<MethodDef>() {
+					public int compare(MethodDef a, MethodDef b) {
+						return a.getName().compareTo(b.getName());
+					}
+				});
+		for (final Clazz clazz : sources) {
+			clazz.parseClassFileWithCollector(new ClassDataCollector() {
+
+				public boolean classStart(int access, TypeRef name) {
+					return clazz.isPublic();
+				}
+
+				public void method(MethodDef source) {
+					if (source.isPublic() || source.isProtected())
+						catalog.put(source, new ArrayList<MethodDef>());
+				}
+
+			});
+		}
+		return catalog;
+	}
 
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java Fri Jun 15 13:27:53 2012
@@ -12,80 +12,78 @@ import aQute.lib.tag.*;
 /**
  * Creates an XML Coverage report. This class can be used as a resource so the
  * report is created only when the JAR is written.
- * 
  */
 public class CoverageResource extends WriteResource {
-    Collection<Clazz> testsuite;
-    Collection<Clazz> service;
+	Collection<Clazz>	testsuite;
+	Collection<Clazz>	service;
 
-    public CoverageResource(Collection<Clazz> testsuite,
-            Collection<Clazz> service) {
-        this.testsuite = testsuite;
-        this.service = service;
-    }
-
-    @Override
-    public long lastModified() {
-        return 0;
-    }
-
-    @Override
-    public void write(OutputStream out) throws IOException {
-        try {
-            Map<MethodDef, List<MethodDef>> table = getCrossRef(testsuite,
-                    service);
-            Tag coverage = toTag(table);
-            PrintWriter pw = new PrintWriter(new OutputStreamWriter(out,
-                    Constants.DEFAULT_CHARSET));
-            try {
-                coverage.print(0, pw);
-            } finally {
-                pw.flush();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    public static Tag toTag(Map<MethodDef, List<MethodDef>> catalog) {
-        Tag coverage = new Tag("coverage");
-        String currentClass = null;
-        Tag classTag = null;
-
-        for (Map.Entry<MethodDef, List<MethodDef>> m : catalog.entrySet()) {
-            String className = m.getKey().getContainingClass().getFQN();
-            if (!className.equals(currentClass)) {
-                classTag = new Tag("class");
-                classTag.addAttribute("name", className);
-                classTag.addAttribute("package", Descriptors.getPackage(className));
-                classTag.addAttribute("short", Descriptors.getShortName(className));
-                coverage.addContent(classTag);
-                currentClass = className;
-            }
-            Tag method = doMethod(new Tag("method"), m.getKey());
-            classTag.addContent(method);
-            for (MethodDef r : m.getValue()) {
-                Tag ref = doMethod(new Tag("ref"), r);
-                method.addContent(ref);
-            }
-        }
-        return coverage;
-    }
-
-    private static Tag doMethod(Tag tag, MethodDef method) {
-        tag.addAttribute("pretty", method.toString());
-        if (method.isPublic())
-            tag.addAttribute("public", true);
-        if (method.isStatic())
-            tag.addAttribute("static", true);
-        if (method.isProtected())
-            tag.addAttribute("protected", true);
-        if (method.isInterface())
-            tag.addAttribute("interface", true);
-        tag.addAttribute("constructor", method.isConstructor());
-        if (!method.isConstructor())
-            tag.addAttribute("name", method.getName());
-        tag.addAttribute("descriptor", method.getDescriptor());
-        return tag;
-    }
+	public CoverageResource(Collection<Clazz> testsuite, Collection<Clazz> service) {
+		this.testsuite = testsuite;
+		this.service = service;
+	}
+
+	@Override
+	public long lastModified() {
+		return 0;
+	}
+
+	@Override
+	public void write(OutputStream out) throws IOException {
+		try {
+			Map<MethodDef,List<MethodDef>> table = getCrossRef(testsuite, service);
+			Tag coverage = toTag(table);
+			PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, Constants.DEFAULT_CHARSET));
+			try {
+				coverage.print(0, pw);
+			}
+			finally {
+				pw.flush();
+			}
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static Tag toTag(Map<MethodDef,List<MethodDef>> catalog) {
+		Tag coverage = new Tag("coverage");
+		String currentClass = null;
+		Tag classTag = null;
+
+		for (Map.Entry<MethodDef,List<MethodDef>> m : catalog.entrySet()) {
+			String className = m.getKey().getContainingClass().getFQN();
+			if (!className.equals(currentClass)) {
+				classTag = new Tag("class");
+				classTag.addAttribute("name", className);
+				classTag.addAttribute("package", Descriptors.getPackage(className));
+				classTag.addAttribute("short", Descriptors.getShortName(className));
+				coverage.addContent(classTag);
+				currentClass = className;
+			}
+			Tag method = doMethod(new Tag("method"), m.getKey());
+			classTag.addContent(method);
+			for (MethodDef r : m.getValue()) {
+				Tag ref = doMethod(new Tag("ref"), r);
+				method.addContent(ref);
+			}
+		}
+		return coverage;
+	}
+
+	private static Tag doMethod(Tag tag, MethodDef method) {
+		tag.addAttribute("pretty", method.toString());
+		if (method.isPublic())
+			tag.addAttribute("public", true);
+		if (method.isStatic())
+			tag.addAttribute("static", true);
+		if (method.isProtected())
+			tag.addAttribute("protected", true);
+		if (method.isInterface())
+			tag.addAttribute("interface", true);
+		tag.addAttribute("constructor", method.isConstructor());
+		if (!method.isConstructor())
+			tag.addAttribute("name", method.getName());
+		tag.addAttribute("descriptor", method.getDescriptor());
+		return tag;
+	}
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java Fri Jun 15 13:27:53 2012
@@ -12,33 +12,34 @@ import aQute.lib.tag.*;
 import aQute.libg.generics.*;
 
 public class MetaTypeReader extends WriteResource {
-	final Analyzer				reporter;
-	Clazz						clazz;
-	String						interfaces[];
-	Tag							metadata	= new Tag("metatype:MetaData", new String[] {
-			"xmlns:metatype", "http://www.osgi.org/xmlns/metatype/v1.1.0" });
-	Tag							ocd			= new Tag(metadata, "OCD");
-	Tag							designate	= new Tag(metadata, "Designate");
-	Tag							object		= new Tag(designate, "Object");
+	final Analyzer			reporter;
+	Clazz					clazz;
+	String					interfaces[];
+	Tag						metadata	= new Tag("metatype:MetaData", new String[] {
+			"xmlns:metatype", "http://www.osgi.org/xmlns/metatype/v1.1.0"
+										});
+	Tag						ocd			= new Tag(metadata, "OCD");
+	Tag						designate	= new Tag(metadata, "Designate");
+	Tag						object		= new Tag(designate, "Object");
 
 	// Resource
-	String						extra;
+	String					extra;
 
 	// One time init
-	boolean						finished;
+	boolean					finished;
 
 	// Designate
-	boolean						override;
-	String						designatePid;
-	boolean						factory;
+	boolean					override;
+	String					designatePid;
+	boolean					factory;
 
 	// AD
-	Map<MethodDef, Meta.AD>	methods		= new LinkedHashMap<MethodDef, Meta.AD>();
+	Map<MethodDef,Meta.AD>	methods		= new LinkedHashMap<MethodDef,Meta.AD>();
 
 	// OCD
-	Annotation					ocdAnnotation;
+	Annotation				ocdAnnotation;
 
-	MethodDef					method;
+	MethodDef				method;
 
 	public MetaTypeReader(Clazz clazz, Analyzer reporter) {
 		this.clazz = clazz;
@@ -58,13 +59,12 @@ public class MetaTypeReader extends Writ
 	 * @param optionValues
 	 */
 
-	static Pattern	COLLECTION	= Pattern
-										.compile("(.*(Collection|Set|List|Queue|Stack|Deque))<(L.+;)>");
+	static Pattern	COLLECTION	= Pattern.compile("(.*(Collection|Set|List|Queue|Stack|Deque))<(L.+;)>");
 
 	private void addMethod(MethodDef method, Meta.AD ad) throws Exception {
 
 		// Set all the defaults.
-		
+
 		String rtype = method.getGenericReturnType();
 		String id = Configurable.mangleMethodName(method.getName());
 		String name = Clazz.unCamel(id);
@@ -88,8 +88,8 @@ public class MetaTypeReader extends Writ
 		}
 
 		Meta.Type type = getType(rtype);
-		
-		boolean required = ad ==null || ad.required();
+
+		boolean required = ad == null || ad.required();
 		String deflt = null;
 		String max = null;
 		String min = null;
@@ -114,15 +114,15 @@ public class MetaTypeReader extends Writ
 				cardinality = ad.cardinality();
 			if (ad.type() != null)
 				type = ad.type();
-//			if (ad.required() || ad.deflt() == null)
-//				required = true;
+			// if (ad.required() || ad.deflt() == null)
+			// required = true;
 
 			if (ad.description() != null)
 				description = ad.description();
 
 			if (ad.optionLabels() != null)
 				optionLabels = ad.optionLabels();
-			if (ad.optionValues() != null )
+			if (ad.optionValues() != null)
 				optionValues = ad.optionValues();
 
 			if (ad.min() != null)
@@ -208,13 +208,15 @@ public class MetaTypeReader extends Writ
 	}
 
 	class Find extends ClassDataCollector {
-		
-		@Override public void method(MethodDef mdef) {
+
+		@Override
+		public void method(MethodDef mdef) {
 			method = mdef;
 			methods.put(mdef, null);
 		}
-		
-		@Override public void annotation(Annotation annotation) {
+
+		@Override
+		public void annotation(Annotation annotation) {
 			try {
 				Meta.OCD ocd = annotation.getAnnotation(Meta.OCD.class);
 				Meta.AD ad = annotation.getAnnotation(Meta.AD.class);
@@ -225,20 +227,20 @@ public class MetaTypeReader extends Writ
 					assert method != null;
 					methods.put(method, ad);
 				}
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				reporter.error("Error during annotation parsing %s : %s", clazz, e);
 				e.printStackTrace();
 			}
 		}
 
 	}
-	
-
 
 	public void write(OutputStream out) throws IOException {
 		try {
 			finish();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RuntimeException(e);
 		}
 		PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
@@ -255,8 +257,7 @@ public class MetaTypeReader extends Writ
 			if (this.ocdAnnotation != null)
 				ocd = this.ocdAnnotation.getAnnotation(Meta.OCD.class);
 			else
-				ocd = Configurable.createConfigurable(Meta.OCD.class,
-						new HashMap<String, Object>());
+				ocd = Configurable.createConfigurable(Meta.OCD.class, new HashMap<String,Object>());
 
 			// defaults
 			String id = clazz.getClassName().getFQN();
@@ -268,7 +269,6 @@ public class MetaTypeReader extends Writ
 			if (ocd.id() != null)
 				id = ocd.id();
 
-			
 			if (ocd.name() != null)
 				name = ocd.name();
 
@@ -295,7 +295,7 @@ public class MetaTypeReader extends Writ
 			this.ocd.addAttribute("localization", localization);
 
 			// do ADs
-			for (Map.Entry<MethodDef, Meta.AD> entry : methods.entrySet())
+			for (Map.Entry<MethodDef,Meta.AD> entry : methods.entrySet())
 				addMethod(entry.getKey(), entry.getValue());
 
 			this.designate.addAttribute("pid", pid);
@@ -313,7 +313,8 @@ public class MetaTypeReader extends Writ
 		this.designatePid = pid;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java Fri Jun 15 13:27:53 2012
@@ -9,26 +9,23 @@ import aQute.lib.osgi.Clazz.QUERY;
 import aQute.libg.header.*;
 
 /**
- * This class is responsible for meta type types. It is a plugin that can 
+ * This class is responsible for meta type types. It is a plugin that can
+ * 
  * @author aqute
- *
  */
 public class MetatypePlugin implements AnalyzerPlugin {
 
 	public boolean analyzeJar(Analyzer analyzer) throws Exception {
 
-		Parameters map = analyzer.parseHeader(analyzer
-				.getProperty(Constants.METATYPE));
+		Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));
 
 		Jar jar = analyzer.getJar();
 		for (String name : map.keySet()) {
-			Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(),
-					Meta.OCD.class.getName(), // 
+			Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
 					QUERY.NAMED.toString(), name //
 					);
 			for (Clazz c : metatypes) {
-				jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c,
-						analyzer));
+				jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
 			}
 		}
 		return false;

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java Fri Jun 15 13:27:53 2012
@@ -1,5 +1,5 @@
 package aQute.bnd.maven;
 
 public interface BsnToMavenPath {
-    String[] getGroupAndArtifact(String bsn);
+	String[] getGroupAndArtifact(String bsn);
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java Fri Jun 15 13:27:53 2012
@@ -22,8 +22,7 @@ public class MavenCommand extends Proces
 	final Settings	settings	= new Settings();
 	File			temp;
 
-	public MavenCommand() {
-	}
+	public MavenCommand() {}
 
 	public MavenCommand(Processor p) {
 		super(p);
@@ -167,14 +166,15 @@ public class MavenCommand extends Proces
 			else if (option.equals("-output"))
 				output = args[i++];
 			else if (option.equals("-nodelete"))
-				nodelete=true;
+				nodelete = true;
 			else if (option.startsWith("-properties")) {
 				InputStream in = null;
 				try {
 					in = new FileInputStream(args[i++]);
 					properties.load(in);
-				} catch (Exception e) {
-				} finally {
+				}
+				catch (Exception e) {}
+				finally {
 					if (in != null) {
 						in.close();
 					}
@@ -233,17 +233,16 @@ public class MavenCommand extends Proces
 		for (String d : developers)
 			pom.addDeveloper(d);
 
-		Set<String> exports = OSGiHeader.parseHeader(
-				manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE)).keySet();
+		Set<String> exports = OSGiHeader.parseHeader(manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE))
+				.keySet();
 
 		Jar sourceJar;
 		if (source == null) {
 			trace("Splitting source code");
 			sourceJar = new Jar("source");
-			for (Map.Entry<String, Resource> entry : binaryJar.getResources().entrySet()) {
+			for (Map.Entry<String,Resource> entry : binaryJar.getResources().entrySet()) {
 				if (entry.getKey().startsWith("OSGI-OPT/src")) {
-					sourceJar.putResource(entry.getKey().substring("OSGI-OPT/src/".length()),
-							entry.getValue());
+					sourceJar.putResource(entry.getKey().substring("OSGI-OPT/src/".length()), entry.getValue());
 				}
 			}
 			copyInfo(binaryJar, sourceJar, "source");
@@ -251,7 +250,7 @@ public class MavenCommand extends Proces
 			sourceJar = getJarFromFileOrURL(source);
 		}
 		sourceJar.calcChecksums(null);
-		
+
 		Jar javadocJar;
 		if (javadoc == null) {
 			trace("creating javadoc because -javadoc not used");
@@ -266,7 +265,7 @@ public class MavenCommand extends Proces
 			javadocJar = getJarFromFileOrURL(javadoc);
 		}
 		javadocJar.calcChecksums(null);
-		
+
 		addClose(binaryJar);
 		addClose(sourceJar);
 		addClose(javadocJar);
@@ -280,8 +279,7 @@ public class MavenCommand extends Proces
 		File sourceFile = new File(bundle, prefix + "-sources.jar");
 		File javadocFile = new File(bundle, prefix + "-javadoc.jar");
 		File pomFile = new File(bundle, "pom.xml").getAbsoluteFile();
-		trace("creating output files %s, %s,%s, and %s", binaryFile, sourceFile, javadocFile,
-				pomFile);
+		trace("creating output files %s, %s,%s, and %s", binaryFile, sourceFile, javadocFile, pomFile);
 
 		IO.copy(pom.openInputStream(), pomFile);
 		trace("copied pom");
@@ -318,39 +316,39 @@ public class MavenCommand extends Proces
 	private void copyInfo(Jar source, Jar dest, String type) throws Exception {
 		source.ensureManifest();
 		dest.ensureManifest();
-		copyInfoResource( source, dest, "LICENSE");
-		copyInfoResource( source, dest, "LICENSE.html");
-		copyInfoResource( source, dest, "about.html");
-		
+		copyInfoResource(source, dest, "LICENSE");
+		copyInfoResource(source, dest, "LICENSE.html");
+		copyInfoResource(source, dest, "about.html");
+
 		Manifest sm = source.getManifest();
 		Manifest dm = dest.getManifest();
-		copyInfoHeader( sm, dm, "Bundle-Description","");
-		copyInfoHeader( sm, dm, "Bundle-Vendor","");
-		copyInfoHeader( sm, dm, "Bundle-Copyright","");
-		copyInfoHeader( sm, dm, "Bundle-DocURL","");
-		copyInfoHeader( sm, dm, "Bundle-License","");
-		copyInfoHeader( sm, dm, "Bundle-Name", " " + type);
-		copyInfoHeader( sm, dm, "Bundle-SymbolicName", "." + type);
-		copyInfoHeader( sm, dm, "Bundle-Version", "");
+		copyInfoHeader(sm, dm, "Bundle-Description", "");
+		copyInfoHeader(sm, dm, "Bundle-Vendor", "");
+		copyInfoHeader(sm, dm, "Bundle-Copyright", "");
+		copyInfoHeader(sm, dm, "Bundle-DocURL", "");
+		copyInfoHeader(sm, dm, "Bundle-License", "");
+		copyInfoHeader(sm, dm, "Bundle-Name", " " + type);
+		copyInfoHeader(sm, dm, "Bundle-SymbolicName", "." + type);
+		copyInfoHeader(sm, dm, "Bundle-Version", "");
 	}
 
 	private void copyInfoHeader(Manifest sm, Manifest dm, String key, String value) {
 		String v = sm.getMainAttributes().getValue(key);
-		if ( v == null) {
+		if (v == null) {
 			trace("no source for " + key);
 			return;
 		}
-		
-		if ( dm.getMainAttributes().getValue(key) != null) {
-			trace("already have " + key );
+
+		if (dm.getMainAttributes().getValue(key) != null) {
+			trace("already have " + key);
 			return;
 		}
-		
+
 		dm.getMainAttributes().putValue(key, v + value);
 	}
 
 	private void copyInfoResource(Jar source, Jar dest, String type) {
-		if ( source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
+		if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
 			dest.putResource(type, source.getResource(type));
 	}
 
@@ -369,7 +367,8 @@ public class MavenCommand extends Proces
 			InputStream in = url.openStream();
 			try {
 				jar = new Jar(url.getFile(), in);
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 		}
@@ -399,8 +398,7 @@ public class MavenCommand extends Proces
 		}
 	}
 
-	private Jar javadoc(File source, Set<String> exports, Manifest m, Properties p)
-			throws Exception {
+	private Jar javadoc(File source, Set<String> exports, Manifest m, Properties p) throws Exception {
 		File tmp = new File(temp, "javadoc");
 		tmp.mkdirs();
 
@@ -438,7 +436,7 @@ public class MavenCommand extends Proces
 		command.add("-tag");
 		command.add("noimplement:t:Consumers of this API must not implement this interface");
 
-		for (Enumeration<?> e = pp.propertyNames(); e.hasMoreElements();) {
+		for (Enumeration< ? > e = pp.propertyNames(); e.hasMoreElements();) {
 			String key = (String) e.nextElement();
 			String value = pp.getProperty(key);
 
@@ -460,8 +458,7 @@ public class MavenCommand extends Proces
 
 		int result = command.execute(out, err);
 		if (result != 0) {
-			warning("Error during execution of javadoc command: %s\n******************\n%s", out,
-					err);
+			warning("Error during execution of javadoc command: %s\n******************\n%s", out, err);
 		}
 		Jar jar = new Jar(tmp);
 		addClose(jar);
@@ -475,14 +472,13 @@ public class MavenCommand extends Proces
 	 * @return
 	 */
 	private String license(Attributes attr) {
-		Parameters map = Processor.parseHeader(
-				attr.getValue(Constants.BUNDLE_LICENSE), null);
+		Parameters map = Processor.parseHeader(attr.getValue(Constants.BUNDLE_LICENSE), null);
 		if (map.isEmpty())
 			return null;
 
 		StringBuilder sb = new StringBuilder();
 		String sep = "Licensed under ";
-		for (Entry<String, Attrs> entry : map.entrySet()) {
+		for (Entry<String,Attrs> entry : map.entrySet()) {
 			sb.append(sep);
 			String key = entry.getKey();
 			String link = entry.getValue().get("link");
@@ -541,78 +537,74 @@ public class MavenCommand extends Proces
 		pp.setProperty(key, defaultValue);
 	}
 
-	
 	/**
 	 * View - Show the dependency details of an artifact
 	 */
-	
 
-	static Executor executor = Executors.newCachedThreadPool();
-	static Pattern GROUP_ARTIFACT_VERSION = Pattern.compile("([^+]+)\\+([^+]+)\\+([^+]+)");
-	void view( String args[], int i) throws Exception {
+	static Executor	executor				= Executors.newCachedThreadPool();
+	static Pattern	GROUP_ARTIFACT_VERSION	= Pattern.compile("([^+]+)\\+([^+]+)\\+([^+]+)");
+
+	void view(String args[], int i) throws Exception {
 		Maven maven = new Maven(executor);
 		OutputStream out = System.err;
-		
-		List<URI>	urls = new ArrayList<URI>();
-		
-		while ( i < args.length && args[i].startsWith("-")) {
-			if( "-r".equals(args[i])) {
+
+		List<URI> urls = new ArrayList<URI>();
+
+		while (i < args.length && args[i].startsWith("-")) {
+			if ("-r".equals(args[i])) {
 				URI uri = new URI(args[++i]);
-				urls.add( uri );
+				urls.add(uri);
 				System.err.println("URI for repo " + uri);
-			}
-			else
-				if ( "-o".equals(args[i])) {
-					out = new FileOutputStream(args[++i]);
-				}
-				else
-					throw new IllegalArgumentException("Unknown option: " + args[i]);
-			
+			} else if ("-o".equals(args[i])) {
+				out = new FileOutputStream(args[++i]);
+			} else
+				throw new IllegalArgumentException("Unknown option: " + args[i]);
+
 			i++;
 		}
-		
+
 		URI[] urls2 = urls.toArray(new URI[urls.size()]);
 		PrintWriter pw = IO.writer(out);
-		
-		while ( i < args.length) {
+
+		while (i < args.length) {
 			String ref = args[i++];
 			pw.println("Ref " + ref);
-			
+
 			Matcher matcher = GROUP_ARTIFACT_VERSION.matcher(ref);
 			if (matcher.matches()) {
-				
+
 				String group = matcher.group(1);
 				String artifact = matcher.group(2);
 				String version = matcher.group(3);
 				CachedPom pom = maven.getPom(group, artifact, version, urls2);
-				
+
 				Builder a = new Builder();
 				a.setProperty("Private-Package", "*");
 				Set<Pom> dependencies = pom.getDependencies(Scope.compile, urls2);
-				for ( Pom dep : dependencies ) {
-					System.err.printf( "%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
+				for (Pom dep : dependencies) {
+					System.err.printf("%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
 					a.addClasspath(dep.getArtifact());
 				}
 				pw.println(a.getClasspath());
 				a.build();
 
-				TreeSet<PackageRef> sorted = new TreeSet<PackageRef>( a.getImports().keySet());
-				for ( PackageRef p :sorted) {
-					pw.printf("%-40s\n",p);
+				TreeSet<PackageRef> sorted = new TreeSet<PackageRef>(a.getImports().keySet());
+				for (PackageRef p : sorted) {
+					pw.printf("%-40s\n", p);
 				}
-//				for ( Map.Entry<String, Set<String>> entry : a.getUses().entrySet()) {
-//					String from = entry.getKey();
-//					for ( String uses : entry.getValue()) {
-//						System.err.printf("%40s %s\n", from, uses);
-//						from = "";
-//					}
-//				}
+				// for ( Map.Entry<String, Set<String>> entry :
+				// a.getUses().entrySet()) {
+				// String from = entry.getKey();
+				// for ( String uses : entry.getValue()) {
+				// System.err.printf("%40s %s\n", from, uses);
+				// from = "";
+				// }
+				// }
 				a.close();
 			} else
 				System.err.println("Wrong, must look like group+artifact+version, is " + ref);
-			
+
 		}
 	}
-	
-	
+
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java Fri Jun 15 13:27:53 2012
@@ -14,14 +14,13 @@ public class MavenDependencyGraph {
 	final List<Artifact>				dependencies	= new ArrayList<Artifact>();
 	final List<URL>						repositories	= new ArrayList<URL>();
 	final XPath							xpath			= xpathFactory.newXPath();
-	final Map<URL, Artifact>			cache			= new HashMap<URL, Artifact>();
-	Artifact						root;
+	final Map<URL,Artifact>				cache			= new HashMap<URL,Artifact>();
+	Artifact							root;
 
 	enum Scope {
 		COMPILE, RUNTIME, TEST, PROVIDED, SYSTEM, IMPORT,
 	}
 
-	
 	public class Artifact {
 
 		String			groupId;
@@ -49,33 +48,27 @@ public class MavenDependencyGraph {
 				if (scope != null && scope.length() > 0) {
 					this.scope = Scope.valueOf(scope.toUpperCase());
 				}
-				NodeList evaluate = (NodeList) xpath.evaluate("//dependencies/dependency", doc,
-						XPathConstants.NODESET);
+				NodeList evaluate = (NodeList) xpath.evaluate("//dependencies/dependency", doc, XPathConstants.NODESET);
 
 				for (int i = 0; i < evaluate.getLength(); i++) {
 					Node childNode = evaluate.item(i);
-					Artifact artifact = getArtifact(xpath.evaluate("groupId", childNode), xpath
-							.evaluate("artifactId", childNode), xpath.evaluate("version", childNode));
+					Artifact artifact = getArtifact(xpath.evaluate("groupId", childNode),
+							xpath.evaluate("artifactId", childNode), xpath.evaluate("version", childNode));
 					add(artifact);
 				}
 			}
 		}
-		
-		
 
 		public void add(Artifact artifact) {
 			dependencies.add(artifact);
 		}
 
-
-
 		public String toString() {
 			return groupId + "." + artifactId + "-" + version + "[" + scope + "," + optional + "]";
 		}
 
 		public String getPath() throws URISyntaxException {
-			return groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId
-					+ "-" + version;
+			return groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version;
 		}
 
 	}
@@ -102,7 +95,8 @@ public class MavenDependencyGraph {
 				} else {
 					return new Artifact(url);
 				}
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				System.err.println("Failed to get " + artifactId + " from " + repository);
 			}
 		}
@@ -127,13 +121,10 @@ public class MavenDependencyGraph {
 		return null;
 	}
 
-	
-	
-	public void addArtifact( Artifact artifact ) throws Exception {
-		if ( root == null)
+	public void addArtifact(Artifact artifact) throws Exception {
+		if (root == null)
 			root = new Artifact(null);
 		root.add(artifact);
 	}
-	
-	
+
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java Fri Jun 15 13:27:53 2012
@@ -21,7 +21,7 @@ public class MavenDeploy implements Depl
 	String		passphrase;
 	Reporter	reporter;
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		repository = map.get("repository");
 		url = map.get("url");
 		passphrase = map.get("passphrase");
@@ -41,10 +41,9 @@ public class MavenDeploy implements Depl
 	/**
 	 */
 	public boolean deploy(Project project, Jar original) throws Exception {
-		Parameters deploy = project.parseHeader(project
-				.getProperty(Constants.DEPLOY));
+		Parameters deploy = project.parseHeader(project.getProperty(Constants.DEPLOY));
 
-		Map<String, String> maven = deploy.get(repository);
+		Map<String,String> maven = deploy.get(repository);
 		if (maven == null)
 			return false; // we're not playing for this bundle
 
@@ -66,8 +65,8 @@ public class MavenDeploy implements Depl
 			Jar src = new Jar("src");
 			try {
 				split(original, main, src);
-				Parameters exports = project.parseHeader(manifest
-						.getMainAttributes().getValue(Constants.EXPORT_PACKAGE));
+				Parameters exports = project.parseHeader(manifest.getMainAttributes()
+						.getValue(Constants.EXPORT_PACKAGE));
 				File jdoc = new File(tmp, "jdoc");
 				jdoc.mkdirs();
 				project.progress("Generating Javadoc for: " + exports.keySet());
@@ -86,7 +85,8 @@ public class MavenDeploy implements Depl
 				project.progress("Deploying main javadoc file");
 				maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
 
-			} finally {
+			}
+			finally {
 				main.close();
 				src.close();
 			}
@@ -95,7 +95,7 @@ public class MavenDeploy implements Depl
 	}
 
 	private void split(Jar original, Jar main, Jar src) {
-		for (Map.Entry<String, Resource> e : original.getResources().entrySet()) {
+		for (Map.Entry<String,Resource> e : original.getResources().entrySet()) {
 			String path = e.getKey();
 			if (path.startsWith("OSGI-OPT/src/")) {
 				src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue());
@@ -114,8 +114,7 @@ public class MavenDeploy implements Depl
 	// -Dfile=/Ws/bnd/biz.aQute.bndlib/tmp/biz.aQute.bndlib.jar \
 	// -Dpassphrase=a1k3v3t5x3
 
-	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile)
-			throws Exception {
+	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile) throws Exception {
 		Command command = new Command();
 		command.setTrace();
 		command.add(b.getProperty("mvn", "mvn"));
@@ -134,8 +133,8 @@ public class MavenDeploy implements Depl
 
 		int result = command.execute(stdout, stderr);
 		if (result != 0) {
-			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository,
-					file, "" + stdout + stderr);
+			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository, file, "" + stdout
+					+ stderr);
 		}
 	}
 
@@ -148,12 +147,12 @@ public class MavenDeploy implements Depl
 
 	private Jar javadoc(File tmp, Project b, Set<String> exports) throws Exception {
 		Command command = new Command();
-		
+
 		command.add(b.getProperty("javadoc", "javadoc"));
 		command.add("-d");
 		command.add(tmp.getAbsolutePath());
 		command.add("-sourcepath");
-		command.add( Processor.join(b.getSourcePath(),File.pathSeparator));
+		command.add(Processor.join(b.getSourcePath(), File.pathSeparator));
 
 		for (String packageName : exports) {
 			command.add(packageName);
@@ -178,7 +177,8 @@ public class MavenDeploy implements Depl
 		OutputStream out = new FileOutputStream(f);
 		try {
 			r.write(out);
-		} finally {
+		}
+		finally {
 			out.close();
 		}
 		return f;

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java Fri Jun 15 13:27:53 2012
@@ -30,16 +30,16 @@ public class MavenDeployCmd extends Proc
 	 */
 	void run(String args[], int i) throws Exception {
 		if (i >= args.length) {
+			System.err.println("Usage:%n");
 			System.err
-					.println("Usage:%n");
-			System.err.println("  deploy [-url repo] [-passphrase passphrase] [-homedir homedir] [-keyname keyname] bundle ...");
+					.println("  deploy [-url repo] [-passphrase passphrase] [-homedir homedir] [-keyname keyname] bundle ...");
 			System.err.println("  settings");
 			return;
 		}
 
 		/* skip first argument */
 		i++;
-		
+
 		while (i < args.length && args[i].startsWith("-")) {
 			String option = args[i];
 			if (option.equals("-url"))
@@ -54,10 +54,9 @@ public class MavenDeployCmd extends Proc
 				error("Invalid command ");
 		}
 
-		
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		repository = map.get("repository");
 		url = map.get("url");
 		passphrase = map.get("passphrase");
@@ -77,10 +76,9 @@ public class MavenDeployCmd extends Proc
 	/**
 	 */
 	public boolean deploy(Project project, Jar original) throws Exception {
-		Parameters deploy = project.parseHeader(project
-				.getProperty(Constants.DEPLOY));
+		Parameters deploy = project.parseHeader(project.getProperty(Constants.DEPLOY));
 
-		Map<String, String> maven = deploy.get(repository);
+		Map<String,String> maven = deploy.get(repository);
 		if (maven == null)
 			return false; // we're not playing for this bundle
 
@@ -102,8 +100,8 @@ public class MavenDeployCmd extends Proc
 			Jar src = new Jar("src");
 			try {
 				split(original, main, src);
-				Parameters exports = project.parseHeader(manifest
-						.getMainAttributes().getValue(Constants.EXPORT_PACKAGE));
+				Parameters exports = project.parseHeader(manifest.getMainAttributes()
+						.getValue(Constants.EXPORT_PACKAGE));
 				File jdoc = new File(tmp, "jdoc");
 				jdoc.mkdirs();
 				project.progress("Generating Javadoc for: " + exports.keySet());
@@ -122,7 +120,8 @@ public class MavenDeployCmd extends Proc
 				project.progress("Deploying main javadoc file");
 				maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
 
-			} finally {
+			}
+			finally {
 				main.close();
 				src.close();
 			}
@@ -131,7 +130,7 @@ public class MavenDeployCmd extends Proc
 	}
 
 	private void split(Jar original, Jar main, Jar src) {
-		for (Map.Entry<String, Resource> e : original.getResources().entrySet()) {
+		for (Map.Entry<String,Resource> e : original.getResources().entrySet()) {
 			String path = e.getKey();
 			if (path.startsWith("OSGI-OPT/src/")) {
 				src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue());
@@ -150,8 +149,7 @@ public class MavenDeployCmd extends Proc
 	// -Dfile=/Ws/bnd/biz.aQute.bndlib/tmp/biz.aQute.bndlib.jar \
 	// -Dpassphrase=a1k3v3t5x3
 
-	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile)
-			throws Exception {
+	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile) throws Exception {
 		Command command = new Command();
 		command.setTrace();
 		command.add(b.getProperty("mvn", "mvn"));
@@ -170,8 +168,8 @@ public class MavenDeployCmd extends Proc
 
 		int result = command.execute(stdout, stderr);
 		if (result != 0) {
-			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository,
-					file, "" + stdout + stderr);
+			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository, file, "" + stdout
+					+ stderr);
 		}
 	}
 
@@ -214,7 +212,8 @@ public class MavenDeployCmd extends Proc
 		OutputStream out = new FileOutputStream(f);
 		try {
 			r.write(out);
-		} finally {
+		}
+		finally {
 			out.close();
 		}
 		return f;

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java Fri Jun 15 13:27:53 2012
@@ -6,22 +6,21 @@ import aQute.bnd.service.*;
 import aQute.libg.reporter.*;
 
 public class MavenGroup implements BsnToMavenPath, Plugin {
-    String    groupId = "";
+	String	groupId	= "";
 
-    public String[] getGroupAndArtifact(String bsn) {
-        String[] result = new String[2];
-        result[0] = groupId;
-        result[1] = bsn;
-        return result;
-    }
+	public String[] getGroupAndArtifact(String bsn) {
+		String[] result = new String[2];
+		result[0] = groupId;
+		result[1] = bsn;
+		return result;
+	}
 
-    public void setProperties(Map<String, String> map) {
-        if (map.containsKey("groupId")) {
-            groupId = map.get("groupId");
-        }
-    }
+	public void setProperties(Map<String,String> map) {
+		if (map.containsKey("groupId")) {
+			groupId = map.get("groupId");
+		}
+	}
 
-    public void setReporter(Reporter processor) {
-    }
+	public void setReporter(Reporter processor) {}
 
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java Fri Jun 15 13:27:53 2012
@@ -13,9 +13,9 @@ public class MavenRepository implements 
 
 	public final static String	NAME	= "name";
 
-	File					root;
-	Reporter				reporter;
-	String					name;
+	File						root;
+	Reporter					reporter;
+	String						name;
 
 	public String toString() {
 		return "maven:" + root;
@@ -31,9 +31,9 @@ public class MavenRepository implements 
 			range = new VersionRange(version);
 
 		List<BsnToMavenPath> plugins = ((Processor) reporter).getPlugins(BsnToMavenPath.class);
-		if ( plugins.isEmpty())
+		if (plugins.isEmpty())
 			plugins.add(this);
-		
+
 		for (BsnToMavenPath cvr : plugins) {
 			String[] paths = cvr.getGroupAndArtifact(bsn);
 			if (paths != null) {
@@ -62,18 +62,16 @@ public class MavenRepository implements 
 				if (Verifier.isVersion(vv)) {
 					Version vvv = new Version(vv);
 					if (range.includes(vvv)) {
-						File file = Processor.getFile(vsdir, v + "/" + artifactId + "-" + v
-								+ ".jar");
+						File file = Processor.getFile(vsdir, v + "/" + artifactId + "-" + v + ".jar");
 						if (file.isFile())
 							result.add(file);
 						else
 							reporter.warning("Expected maven entry was not a valid file %s ", file);
 					}
 				} else {
-					reporter
-							.warning(
-									"Expected a version directory in maven: dir=%s raw-version=%s cleaned-up-version=%s",
-									vsdir, vv, v);
+					reporter.warning(
+							"Expected a version directory in maven: dir=%s raw-version=%s cleaned-up-version=%s",
+							vsdir, vv, v);
 				}
 			}
 		} else
@@ -119,27 +117,27 @@ public class MavenRepository implements 
 	}
 
 	public List<Version> versions(String bsn) throws Exception {
-		
-		File files[] = get( bsn, null);
+
+		File files[] = get(bsn, null);
 		List<Version> versions = new ArrayList<Version>();
-		for ( File f : files ) {
+		for (File f : files) {
 			String version = f.getParentFile().getName();
 			version = Builder.cleanupVersion(version);
-			Version v = new Version( version );
+			Version v = new Version(version);
 			versions.add(v);
 		}
 		return versions;
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		File home = new File("");
 		String root = map.get("root");
 		if (root == null) {
-			home = new File( System.getProperty("user.home") );
-			this.root = Processor.getFile(home , ".m2/repository").getAbsoluteFile();
+			home = new File(System.getProperty("user.home"));
+			this.root = Processor.getFile(home, ".m2/repository").getAbsoluteFile();
 		} else
 			this.root = Processor.getFile(home, root).getAbsoluteFile();
-		
+
 		if (!this.root.isDirectory()) {
 			reporter.error("Maven repository did not get a proper URL to the repository %s", root);
 		}
@@ -155,21 +153,23 @@ public class MavenRepository implements 
 		String groupId;
 		String artifactId;
 		int n = bsn.indexOf('.');
-		
-		while ( n > 0 ) {
-			artifactId = bsn.substring(n+1);
-			groupId = bsn.substring(0,n);
-			
-			File gdir = new File(root, groupId.replace('.',File.separatorChar)).getAbsoluteFile();
-			File adir = new File( gdir, artifactId).getAbsoluteFile();
-			if ( adir.isDirectory() )
-				return new String[] {groupId, artifactId};
-			
-			n = bsn.indexOf('.',n+1);
+
+		while (n > 0) {
+			artifactId = bsn.substring(n + 1);
+			groupId = bsn.substring(0, n);
+
+			File gdir = new File(root, groupId.replace('.', File.separatorChar)).getAbsoluteFile();
+			File adir = new File(gdir, artifactId).getAbsoluteFile();
+			if (adir.isDirectory())
+				return new String[] {
+						groupId, artifactId
+				};
+
+			n = bsn.indexOf('.', n + 1);
 		}
 		return null;
 	}
-	
+
 	public String getName() {
 		if (name == null) {
 			return toString();
@@ -181,16 +181,16 @@ public class MavenRepository implements 
 		File[] files = get(bsn, range);
 		if (files.length >= 0) {
 			switch (strategy) {
-			case LOWEST:
-				return files[0];
-			case HIGHEST:
-				return files[files.length - 1];
+				case LOWEST :
+					return files[0];
+				case HIGHEST :
+					return files[files.length - 1];
 			}
 		}
 		return null;
 	}
 
-	public void setRoot( File f  ) {
+	public void setRoot(File f) {
 		root = f;
 	}
 

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java Fri Jun 15 13:27:53 2012
@@ -70,11 +70,13 @@ public class PomFromManifest extends Wri
 		this.manifest = manifest;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 
-	@Override public void write(OutputStream out) throws IOException {
+	@Override
+	public void write(OutputStream out) throws IOException {
 		PrintWriter ps = IO.writer(out);
 
 		String name = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_NAME);
@@ -148,8 +150,7 @@ public class PomFromManifest extends Wri
 				String xname = email;
 				String organization = null;
 
-				Matcher m = Pattern.compile("([^@]+)@([\\d\\w\\-_\\.]+)\\.([\\d\\w\\-_\\.]+)")
-						.matcher(email);
+				Matcher m = Pattern.compile("([^@]+)@([\\d\\w\\-_\\.]+)\\.([\\d\\w\\-_\\.]+)").matcher(email);
 				if (m.matches()) {
 					xname = m.group(1);
 					organization = m.group(2);
@@ -167,8 +168,7 @@ public class PomFromManifest extends Wri
 			Tag ls = new Tag(project, "licenses");
 
 			Parameters map = Processor.parseHeader(licenses, null);
-			for (Iterator<Entry<String, Attrs>> e = map.entrySet().iterator(); e
-					.hasNext();) {
+			for (Iterator<Entry<String,Attrs>> e = map.entrySet().iterator(); e.hasNext();) {
 
 				// Bundle-License:
 				// http://www.opensource.org/licenses/apache2.0.php; \
@@ -182,9 +182,9 @@ public class PomFromManifest extends Wri
 				//    <distribution>repo</distribution>
 				//    </license>
 
-				Entry<String, Attrs> entry = e.next();
+				Entry<String,Attrs> entry = e.next();
 				Tag l = new Tag(ls, "license");
-				Map<String, String> values = entry.getValue();
+				Map<String,String> values = entry.getValue();
 				String url = entry.getKey();
 
 				if (values.containsKey("description"))
@@ -209,8 +209,7 @@ public class PomFromManifest extends Wri
 	 * @param tag
 	 * @param object
 	 */
-	private Tag tagFromMap(Tag parent, Map<String, String> values, String string, String tag,
-			String object) {
+	private Tag tagFromMap(Tag parent, Map<String,String> values, String string, String tag, String object) {
 		String value = values.get(string);
 		if (value == null)
 			value = object;

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java Fri Jun 15 13:27:53 2012
@@ -12,22 +12,21 @@ import aQute.lib.io.*;
 import aQute.lib.osgi.*;
 
 /**
- * Provides a way to parse a maven pom as properties.
- * 
- * This provides most of the maven elements as properties. It also
- * provides pom.scope.[compile|test|runtime|provided|system] properties
- * that can be appended to the build and run path. That is, they are
- * in the correct format for this.
+ * Provides a way to parse a maven pom as properties. This provides most of the
+ * maven elements as properties. It also provides
+ * pom.scope.[compile|test|runtime|provided|system] properties that can be
+ * appended to the build and run path. That is, they are in the correct format
+ * for this.
  */
 public class PomParser extends Processor {
 	static DocumentBuilderFactory	dbf			= DocumentBuilderFactory.newInstance();
 	static XPathFactory				xpathf		= XPathFactory.newInstance();
 	static Set<String>				multiple	= new HashSet<String>();
-	static Set<String>				skip	= new HashSet<String>();
+	static Set<String>				skip		= new HashSet<String>();
 
 	static {
 		dbf.setNamespaceAware(false);
-		
+
 		// Set all elements that need enumeration of their elements
 		// these will not use the name of the subelement but instead
 		// they use an index from 0..n
@@ -46,7 +45,7 @@ public class PomParser extends Processor
 		skip.add("dependencies");
 		skip.add("reporting");
 		skip.add("extensions");
-		
+
 	}
 
 	public Properties getProperties(File pom) throws Exception {
@@ -58,7 +57,7 @@ public class PomParser extends Processor
 
 		// Check if there is a parent pom
 		String relativePath = xpath.evaluate("project/parent/relativePath", doc);
-		if (relativePath != null && relativePath.length()!=0) {
+		if (relativePath != null && relativePath.length() != 0) {
 			File parentPom = IO.getFile(pom.getParentFile(), relativePath);
 			if (parentPom.isFile()) {
 				Properties parentProps = getProperties(parentPom);
@@ -71,15 +70,16 @@ public class PomParser extends Processor
 		Element e = doc.getDocumentElement();
 		traverse("pom", e, p);
 
-		String scopes[] = { "provided", "runtime", "test", "system" };
+		String scopes[] = {
+				"provided", "runtime", "test", "system"
+		};
 		NodeList set = (NodeList) xpath.evaluate("//dependency[not(scope) or scope='compile']", doc,
 				XPathConstants.NODESET);
 		if (set.getLength() != 0)
 			p.put("pom.scope.compile", toBsn(set));
 
 		for (String scope : scopes) {
-			set = (NodeList) xpath.evaluate("//dependency[scope='" + scope + "']", doc,
-					XPathConstants.NODESET);
+			set = (NodeList) xpath.evaluate("//dependency[scope='" + scope + "']", doc, XPathConstants.NODESET);
 			if (set.getLength() != 0)
 				p.put("pom.scope." + scope, toBsn(set));
 		}
@@ -98,9 +98,9 @@ public class PomParser extends Processor
 			sb.append(xpath.evaluate("groupId", child));
 			sb.append(".");
 			sb.append(xpath.evaluate("artifactId", child));
-			if (version != null && version.trim().length()!=0) {
+			if (version != null && version.trim().length() != 0) {
 				sb.append(";version=");
-				sb.append( Analyzer.cleanupVersion(version));
+				sb.append(Analyzer.cleanupVersion(version));
 			}
 			del = ", ";
 		}
@@ -108,15 +108,17 @@ public class PomParser extends Processor
 	}
 
 	/**
-	 * The maven POM is quite straightforward, it is basically a structured property file.
+	 * The maven POM is quite straightforward, it is basically a structured
+	 * property file.
+	 * 
 	 * @param name
 	 * @param parent
 	 * @param p
 	 */
 	static void traverse(String name, Node parent, Properties p) {
-		if ( skip.contains(parent.getNodeName()))
+		if (skip.contains(parent.getNodeName()))
 			return;
-		
+
 		NodeList children = parent.getChildNodes();
 		if (multiple.contains(parent.getNodeName())) {
 			int n = 0;
@@ -132,7 +134,7 @@ public class PomParser extends Processor
 				Node child = children.item(i);
 				if (child instanceof Text) {
 					String value = child.getNodeValue().trim();
-					if (value.length()!=0) {
+					if (value.length() != 0) {
 						p.put(name, value);
 					}
 				} else {

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java Fri Jun 15 13:27:53 2012
@@ -13,18 +13,20 @@ import aQute.libg.header.*;
 
 public class PomResource extends WriteResource {
 	final Manifest				manifest;
-	private Map<String, String>	scm;
+	private Map<String,String>	scm;
 	final static Pattern		NAME_URL	= Pattern.compile("(.*)(http://.*)");
 
 	public PomResource(Manifest manifest) {
 		this.manifest = manifest;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 
-	@Override public void write(OutputStream out) throws IOException {
+	@Override
+	public void write(OutputStream out) throws IOException {
 		PrintWriter ps = IO.writer(out);
 
 		String name = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_NAME);
@@ -80,7 +82,7 @@ public class PomResource extends WriteRe
 
 		if (scm != null) {
 			Tag scm = new Tag(project, "scm");
-			for (Map.Entry<String, String> e : this.scm.entrySet()) {
+			for (Map.Entry<String,String> e : this.scm.entrySet()) {
 				new Tag(scm, e.getKey()).addContent(e.getValue());
 			}
 		}
@@ -103,8 +105,7 @@ public class PomResource extends WriteRe
 			Tag ls = new Tag(project, "licenses");
 
 			Parameters map = Processor.parseHeader(licenses, null);
-			for (Iterator<Entry<String, Attrs>> e = map.entrySet().iterator(); e
-					.hasNext();) {
+			for (Iterator<Entry<String,Attrs>> e = map.entrySet().iterator(); e.hasNext();) {
 
 				// Bundle-License:
 				// http://www.opensource.org/licenses/apache2.0.php; \
@@ -118,9 +119,9 @@ public class PomResource extends WriteRe
 				//    <distribution>repo</distribution>
 				//    </license>
 
-				Entry<String, Attrs> entry = e.next();
+				Entry<String,Attrs> entry = e.next();
 				Tag l = new Tag(ls, "license");
-				Map<String, String> values = entry.getValue();
+				Map<String,String> values = entry.getValue();
 				String url = entry.getKey();
 
 				if (values.containsKey("description"))
@@ -145,8 +146,7 @@ public class PomResource extends WriteRe
 	 * @param tag
 	 * @param object
 	 */
-	private Tag tagFromMap(Tag parent, Map<String, String> values, String string, String tag,
-			String object) {
+	private Tag tagFromMap(Tag parent, Map<String,String> values, String string, String tag, String object) {
 		String value = values.get(string);
 		if (value == null)
 			value = object;
@@ -156,7 +156,7 @@ public class PomResource extends WriteRe
 		return parent;
 	}
 
-	public void setProperties(Map<String, String> scm) {
+	public void setProperties(Map<String,String> scm) {
 		this.scm = scm;
 	}
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java Fri Jun 15 13:27:53 2012
@@ -4,7 +4,7 @@ import java.io.*;
 import java.net.*;
 
 public class CachedPom extends Pom {
-	final MavenEntry				maven;
+	final MavenEntry	maven;
 
 	CachedPom(MavenEntry mavenEntry, URI repo) throws Exception {
 		super(mavenEntry.maven, mavenEntry.getPomFile(), repo);

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java Fri Jun 15 13:27:53 2012
@@ -12,25 +12,27 @@ import java.util.regex.*;
  */
 public class Maven {
 	final File						userHome	= new File(System.getProperty("user.home"));
-	final Map<String, MavenEntry>	entries		= new ConcurrentHashMap<String, MavenEntry>();
-	final static String[]			ALGORITHMS	= { "md5", "sha1" };
+	final Map<String,MavenEntry>	entries		= new ConcurrentHashMap<String,MavenEntry>();
+	final static String[]			ALGORITHMS	= {
+			"md5", "sha1"
+												};
 	boolean							usecache	= false;
 	final Executor					executor;
 	File							m2			= new File(userHome, ".m2");
 	File							repository	= new File(m2, "repository");
 
 	public Maven(Executor executor) {
-		if ( executor == null)
+		if (executor == null)
 			this.executor = Executors.newCachedThreadPool();
 		else
 			this.executor = executor;
 	}
-	
-	//http://repo1.maven.org/maven2/junit/junit/maven-metadata.xml
-	
-	static Pattern MAVEN_RANGE = Pattern.compile("(\\[|\\()(.+)(,(.+))(\\]|\\))");
-	public CachedPom getPom(String groupId, String artifactId, String version, URI... extra)
-			throws Exception {		
+
+	// http://repo1.maven.org/maven2/junit/junit/maven-metadata.xml
+
+	static Pattern	MAVEN_RANGE	= Pattern.compile("(\\[|\\()(.+)(,(.+))(\\]|\\))");
+
+	public CachedPom getPom(String groupId, String artifactId, String version, URI... extra) throws Exception {
 		MavenEntry entry = getEntry(groupId, artifactId, version);
 		return entry.getPom(extra);
 	}
@@ -59,8 +61,7 @@ public class Maven {
 	}
 
 	private String path(String groupId, String artifactId, String version) {
-		return groupId.replace('.', '/') + '/' + artifactId + '/' + version + "/" + artifactId
-				+ "-" + version;
+		return groupId.replace('.', '/') + '/' + artifactId + '/' + version + "/" + artifactId + "-" + version;
 	}
 
 	public void schedule(Runnable runnable) {
@@ -82,7 +83,7 @@ public class Maven {
 
 	public void setM2(File dir) {
 		this.m2 = dir;
-		this.repository = new File(dir,"repository");
+		this.repository = new File(dir, "repository");
 	}
 
 }

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java Fri Jun 15 13:27:53 2012
@@ -13,7 +13,6 @@ import aQute.libg.filelock.*;
 /**
  * An entry (a group/artifact) in the maven cache in the .m2/repository
  * directory. It provides methods to get the pom and the artifact.
- * 
  */
 public class MavenEntry implements Closeable {
 	final Maven					maven;
@@ -21,7 +20,7 @@ public class MavenEntry implements Close
 	final File					dir;
 	final String				path;
 	final DirectoryLock			lock;
-	final Map<URI, CachedPom>	poms	= new HashMap<URI, CachedPom>();
+	final Map<URI,CachedPom>	poms	= new HashMap<URI,CachedPom>();
 	final File					pomFile;
 	final File					artifactFile;
 	final String				pomPath;
@@ -57,7 +56,6 @@ public class MavenEntry implements Close
 	 * @param urls
 	 *            The allowed URLs
 	 * @return a CachedPom for this maven entry
-	 * 
 	 * @throws Exception
 	 *             If something goes haywire
 	 */
@@ -124,7 +122,8 @@ public class MavenEntry implements Close
 				}
 			}
 			return null;
-		} finally {
+		}
+		finally {
 			saveProperties();
 			// lock.release();
 		}
@@ -143,12 +142,13 @@ public class MavenEntry implements Close
 	private boolean download(URI repo, String path) throws MalformedURLException {
 		try {
 			URL url = toURL(repo, path);
-			System.err.println("Downloading "  + repo + " path " + path + " url " + url);
+			System.err.println("Downloading " + repo + " path " + path + " url " + url);
 			File file = new File(root, path);
 			IO.copy(url.openStream(), file);
-			System.err.println("Downloaded "  + url);
+			System.err.println("Downloaded " + url);
 			return true;
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			System.err.println("debug: " + e);
 			return false;
 		}
@@ -162,7 +162,6 @@ public class MavenEntry implements Close
 	 * @param path
 	 *            The path in the directory + url
 	 * @return a URL that points to the file in the repo
-	 * 
 	 * @throws MalformedURLException
 	 */
 	URL toURL(URI base, String path) throws MalformedURLException {
@@ -181,8 +180,7 @@ public class MavenEntry implements Close
 	 * @return true if valid
 	 */
 	private boolean isValid() {
-		return pomFile.isFile() && pomFile.length() > 100 && artifactFile.isFile()
-				&& artifactFile.length() > 100;
+		return pomFile.isFile() && pomFile.length() > 100 && artifactFile.isFile() && artifactFile.length() > 100;
 	}
 
 	/**
@@ -211,9 +209,11 @@ public class MavenEntry implements Close
 				try {
 					in = new FileInputStream(props);
 					properties.load(in);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					// we ignore for now, will handle it on safe
-				} finally {
+				}
+				finally {
 					IO.close(in);
 				}
 			}
@@ -238,7 +238,8 @@ public class MavenEntry implements Close
 			FileOutputStream fout = new FileOutputStream(propertiesFile);
 			try {
 				properties.store(fout, "");
-			} finally {
+			}
+			finally {
 				properties = null;
 				propertiesChanged = false;
 				fout.close();
@@ -298,11 +299,13 @@ public class MavenEntry implements Close
 			File digestFile = new File(root, digestPath);
 			final MessageDigest md = MessageDigest.getInstance(algorithm);
 			IO.copy(actualFile, new OutputStream() {
-				@Override public void write(int c) throws IOException {
+				@Override
+				public void write(int c) throws IOException {
 					md.update((byte) c);
 				}
 
-				@Override public void write(byte[] buffer, int offset, int length) {
+				@Override
+				public void write(byte[] buffer, int offset, int length) {
 					md.update(buffer, offset, length);
 				}
 			});
@@ -319,7 +322,7 @@ public class MavenEntry implements Close
 	}
 
 	public File getArtifact() throws Exception {
-		if (artifact == null )
+		if (artifact == null)
 			return artifactFile;
 		return artifact.get();
 	}

Modified: felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java?rev=1350613&r1=1350612&r2=1350613&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java (original)
+++ felix/trunk/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java Fri Jun 15 13:27:53 2012
@@ -21,23 +21,24 @@ public class MavenRemoteRepository imple
 		if (f == null)
 			return null;
 
-		return new File[] { f };
+		return new File[] {
+			f
+		};
 	}
 
-	public File get(String bsn, String version, Strategy strategy, Map<String, String> properties)
-			throws Exception {
+	public File get(String bsn, String version, Strategy strategy, Map<String,String> properties) throws Exception {
 		String groupId = null;
-		
+
 		if (properties != null)
 			groupId = properties.get("groupId");
-		
+
 		if (groupId == null) {
 			int n = bsn.indexOf('+');
-			if ( n < 0)
+			if (n < 0)
 				return null;
-			
-			groupId = bsn.substring(0,n);
-			bsn = bsn.substring(n+1);
+
+			groupId = bsn.substring(0, n);
+			bsn = bsn.substring(n + 1);
 		}
 
 		String artifactId = bsn;
@@ -59,15 +60,16 @@ public class MavenRemoteRepository imple
 		try {
 			action = Pom.Scope.valueOf(value);
 			return pom.getLibrary(action, repositories);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			return pom.getArtifact();
 		}
 	}
 
 	public Maven getMaven() {
-		if ( maven != null)
+		if (maven != null)
 			return maven;
-		
+
 		maven = registry.getPlugin(Maven.class);
 		return maven;
 	}
@@ -96,7 +98,7 @@ public class MavenRemoteRepository imple
 		repositories = urls;
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		String repoString = map.get("repositories");
 		if (repoString != null) {
 			String[] repos = repoString.split("\\s*,\\s*");
@@ -105,10 +107,11 @@ public class MavenRemoteRepository imple
 			for (String repo : repos) {
 				try {
 					URI uri = new URI(repo);
-					if ( !uri.isAbsolute())
-						uri = IO.getFile( new File(""),repo).toURI();
+					if (!uri.isAbsolute())
+						uri = IO.getFile(new File(""), repo).toURI();
 					repositories[n++] = uri;
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					if (reporter != null)
 						reporter.error("Invalid repository %s for maven plugin, %s", repo, e);
 				}
@@ -129,9 +132,9 @@ public class MavenRemoteRepository imple
 	}
 
 	public String getLocation() {
-		if ( repositories == null || repositories.length==0)
+		if (repositories == null || repositories.length == 0)
 			return "maven central";
-		
-		return Arrays.toString(repositories); 
+
+		return Arrays.toString(repositories);
 	}
 }



Mime
View raw message