felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r1159950 - in /felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd: BndJarResourceStore.java BndReporter.java ByteArrayResource.java PojoizationPlugin.java ResourceMetadataProvider.java
Date Sun, 21 Aug 2011 08:22:15 GMT
Author: clement
Date: Sun Aug 21 08:22:14 2011
New Revision: 1159950

URL: http://svn.apache.org/viewvc?rev=1159950&view=rev
Log:
Adapted the code style to match the overall code style of iPOJO

Modified:
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
    felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java?rev=1159950&r1=1159949&r2=1159950&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java
Sun Aug 21 08:22:14 2011
@@ -39,18 +39,18 @@ import java.util.*;
 
 public class BndJarResourceStore implements ResourceStore {
 
-    private Analyzer analyzer;
-    private Reporter reporter;
+    private Analyzer m_analyzer;
+    private Reporter m_reporter;
 
-    private MetadataRenderer renderer = new MetadataRenderer();
+    private MetadataRenderer m_renderer = new MetadataRenderer();
 
     public BndJarResourceStore(Analyzer analyzer, Reporter reporter) {
-        this.analyzer = analyzer;
-        this.reporter = reporter;
+        m_analyzer = analyzer;
+        m_reporter = reporter;
     }
 
     public byte[] read(String path) throws IOException {
-        Resource resource = analyzer.getJar().getResource(path);
+        Resource resource = m_analyzer.getJar().getResource(path);
         InputStream is = null;
         try {
             is = resource.openInputStream();
@@ -66,7 +66,7 @@ public class BndJarResourceStore impleme
             // Only visit classes annotated with @Component or @Handler
             String annotations = Component.class.getName() + "|" + Handler.class.getName();
 
-            Collection<Clazz> classes = analyzer.getClasses("",
+            Collection<Clazz> classes = m_analyzer.getClasses("",
                     Clazz.QUERY.ANNOTATION.name(), annotations,
                     Clazz.QUERY.NAMED.name(), "*");
 
@@ -75,7 +75,7 @@ public class BndJarResourceStore impleme
                 visitor.visit(clazz.getPath());
             }
         } catch (Exception e) {
-            reporter.error("Cannot find iPOJO annotated types: " + e.getMessage());
+            m_reporter.error("Cannot find iPOJO annotated types: " + e.getMessage());
         }
     }
 
@@ -87,30 +87,30 @@ public class BndJarResourceStore impleme
 
         // Find referred packages and add them into Bnd
         for (String referred : Metadatas.findReferredPackages(metadata)) {
-            if (analyzer.getReferred().get(referred) == null) {
+            if (m_analyzer.getReferred().get(referred) == null) {
                 // The given package is not referred ATM
-                analyzer.getReferred().put(referred, new HashMap<String, String>());
+                m_analyzer.getReferred().put(referred, new HashMap<String, String>());
             }
         }
 
         // Write the iPOJO header
-        String components = analyzer.getProperty("IPOJO-Components");
+        String components = m_analyzer.getProperty("IPOJO-Components");
         StringBuilder builder = new StringBuilder();
 
         if (components != null) {
             builder.append(components);
         }
-        builder.append(renderer.render(metadata));
+        builder.append(m_renderer.render(metadata));
 
         if (builder.length() != 0) {
-            analyzer.setProperty("IPOJO-Components", builder.toString());
+            m_analyzer.setProperty("IPOJO-Components", builder.toString());
         }
 
 
     }
 
     public void write(String resourcePath, byte[] resource) throws IOException {
-        Jar jar = analyzer.getJar();
+        Jar jar = m_analyzer.getJar();
         jar.putResource(resourcePath, new ByteArrayResource(resource));
     }
 
@@ -120,21 +120,21 @@ public class BndJarResourceStore impleme
         Map<String, String> version = new TreeMap<String, String>();
         version.put("version", Pojoization.IPOJO_PACKAGE_VERSION);
 
-        if (analyzer.getReferred().get("org.apache.felix.ipojo") == null) {
-            analyzer.getReferred().put("org.apache.felix.ipojo", version);
+        if (m_analyzer.getReferred().get("org.apache.felix.ipojo") == null) {
+            m_analyzer.getReferred().put("org.apache.felix.ipojo", version);
         }
-        if (analyzer.getReferred().get("org.apache.felix.ipojo.architecture") == null) {
-            analyzer.getReferred().put("org.apache.felix.ipojo.architecture", version);
+        if (m_analyzer.getReferred().get("org.apache.felix.ipojo.architecture") == null)
{
+            m_analyzer.getReferred().put("org.apache.felix.ipojo.architecture", version);
         }
-        if (analyzer.getReferred().get("org.osgi.service.cm") == null) {
+        if (m_analyzer.getReferred().get("org.osgi.service.cm") == null) {
             Map<String, String> cm = new TreeMap<String, String>();
             cm.put("version", "1.2");
-            analyzer.getReferred().put("org.osgi.service.cm", cm);
+            m_analyzer.getReferred().put("org.osgi.service.cm", cm);
         }
-        if (analyzer.getReferred().get("org.osgi.service.log") == null) {
+        if (m_analyzer.getReferred().get("org.osgi.service.log") == null) {
             Map<String, String> log = new TreeMap<String, String>();
             log.put("version", "1.3");
-            analyzer.getReferred().put("org.osgi.service.log", log);
+            m_analyzer.getReferred().put("org.osgi.service.log", log);
         }
 
     }

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java?rev=1159950&r1=1159949&r2=1159950&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java
Sun Aug 21 08:22:14 2011
@@ -35,7 +35,7 @@ public class BndReporter extends EmptyRe
     /**
      * Bnd reporter.
      */
-    private Reporter reporter;
+    private Reporter m_reporter;
 
     /**
      * Errors which occur during the manipulation.
@@ -48,7 +48,7 @@ public class BndReporter extends EmptyRe
     private List<String> m_warnings = new ArrayList<String>();
 
     public BndReporter(aQute.libg.reporter.Reporter reporter) {
-        this.reporter = reporter;
+        m_reporter = reporter;
     }
 
     public List<String> getErrors() {
@@ -61,23 +61,23 @@ public class BndReporter extends EmptyRe
 
     @Override
     public void trace(String message, Object... args) {
-        reporter.trace(message, args);
+        m_reporter.trace(message, args);
     }
 
     @Override
     public void info(String message, Object... args) {
-        reporter.progress(message, args);
+        m_reporter.progress(message, args);
     }
 
     @Override
     public void warn(String message, Object... args) {
-        reporter.warning(message, args);
+        m_reporter.warning(message, args);
         m_warnings.add(String.format(message, args));
     }
 
     @Override
     public void error(String message, Object... args) {
-        reporter.error(message, args);
+        m_reporter.error(message, args);
         m_errors.add(String.format(message, args));
     }
 }

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java?rev=1159950&r1=1159949&r2=1159950&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java
Sun Aug 21 08:22:14 2011
@@ -27,15 +27,15 @@ import aQute.lib.osgi.AbstractResource;
  */
 public class ByteArrayResource extends AbstractResource {
 
-    private byte[] content;
+    private byte[] m_content;
 
     public ByteArrayResource(byte[] content) {
         super(System.currentTimeMillis());
-        this.content = content;
+        m_content = content;
     }
 
     @Override
     protected byte[] getBytes() throws Exception {
-        return content;
+        return m_content;
     }
 }

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java?rev=1159950&r1=1159949&r2=1159950&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java
Sun Aug 21 08:22:14 2011
@@ -52,26 +52,26 @@ public class PojoizationPlugin implement
     private static final String DEFAULT_METADATA = "META-INF/metadata.xml";
     private static final boolean DEFAULT_USE_LOCAL_SCHEMAS = false;
 
-    private String metadata = DEFAULT_METADATA;
-    private boolean useLocalSchemas = DEFAULT_USE_LOCAL_SCHEMAS;
+    private String m_metadata = DEFAULT_METADATA;
+    private boolean m_useLocalSchemas = DEFAULT_USE_LOCAL_SCHEMAS;
 
-    private Reporter reporter;
+    private Reporter m_reporter;
 
     public void setProperties(Map<String, String> configuration) {
 
         // Use metadata file if any
         if (configuration.containsKey(PROPERTY_METADATA)) {
-            metadata = configuration.get(PROPERTY_METADATA);
+            m_metadata = configuration.get(PROPERTY_METADATA);
         }
 
         // Use local schemas ?
         if (configuration.containsKey(PROPERTY_USE_LOCAL_SCHEMAS)) {
-            useLocalSchemas = true;
+            m_useLocalSchemas = true;
         }
     }
 
     public void setReporter(Reporter reporter) {
-        this.reporter = reporter;
+        m_reporter = reporter;
     }
 
     public boolean analyzeJar(Analyzer analyzer) throws Exception {
@@ -79,26 +79,26 @@ public class PojoizationPlugin implement
         long start = System.currentTimeMillis();
 
         // Wraps the Bnd Reporter
-        BndReporter reporter = new BndReporter(this.reporter);
+        BndReporter reporter = new BndReporter(this.m_reporter);
 
         // Build ResourceStore
-        BndJarResourceStore store = new BndJarResourceStore(analyzer, this.reporter);
+        BndJarResourceStore store = new BndJarResourceStore(analyzer, this.m_reporter);
 
         // Build MetadataProvider
         CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter);
 
-        File file = new File(metadata);
+        File file = new File(m_metadata);
         if (file.exists()) {
             // Absolute file system resource
             FileMetadataProvider fmp = new FileMetadataProvider(file, reporter);
-            fmp.setValidateUsingLocalSchemas(useLocalSchemas);
+            fmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
             provider.addMetadataProvider(fmp);
         } else {
             // In archive resource
-            Resource resource = analyzer.getJar().getResource(metadata);
+            Resource resource = analyzer.getJar().getResource(m_metadata);
             if (resource != null) {
                 ResourceMetadataProvider rmp = new ResourceMetadataProvider(resource, reporter);
-                rmp.setValidateUsingLocalSchemas(useLocalSchemas);
+                rmp.setValidateUsingLocalSchemas(m_useLocalSchemas);
                 provider.addMetadataProvider(rmp);
             }
         }
@@ -110,7 +110,7 @@ public class PojoizationPlugin implement
         }
 
         Pojoization pojoization = new Pojoization(reporter);
-        if (useLocalSchemas) {
+        if (m_useLocalSchemas) {
             pojoization.setUseLocalXSD();
         }
 
@@ -118,7 +118,7 @@ public class PojoizationPlugin implement
 
         int nbComponents = findElements(cache.getMetadatas(), "component").size();
         int nbHandlers = findElements(cache.getMetadatas(), "handler").size();
-        this.reporter.progress("iPOJO manipulation performed performed in %s ms (%d components,
%d handlers).",
+        this.m_reporter.progress("iPOJO manipulation performed performed in %s ms (%d components,
%d handlers).",
                                (System.currentTimeMillis() - start),
                                nbComponents,
                                nbHandlers);

Modified: felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java?rev=1159950&r1=1159949&r2=1159950&view=diff
==============================================================================
--- felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java
(original)
+++ felix/trunk/ipojo/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java
Sun Aug 21 08:22:14 2011
@@ -36,38 +36,38 @@ import org.apache.felix.ipojo.metadata.E
  */
 public class ResourceMetadataProvider implements MetadataProvider {
 
-    private Resource resource;
+    private Resource m_resource;
 
-    private List<Element> cached;
+    private List<Element> m_cached;
 
-    private boolean validateUsingLocalSchemas = false;
+    private boolean m_validateUsingLocalSchemas = false;
 
-    private Reporter reporter;
+    private Reporter m_reporter;
 
     public ResourceMetadataProvider(Resource resource, Reporter reporter) {
-        this.resource = resource;
-        this.reporter = reporter;
+        m_resource = resource;
+        m_reporter = reporter;
     }
 
     public void setValidateUsingLocalSchemas(boolean validateUsingLocalSchemas) {
-        this.validateUsingLocalSchemas = validateUsingLocalSchemas;
+        this.m_validateUsingLocalSchemas = validateUsingLocalSchemas;
     }
 
     public List<Element> getMetadatas() throws IOException {
-        if (cached == null) {
-            cached = new ArrayList<Element>();
+        if (m_cached == null) {
+            m_cached = new ArrayList<Element>();
             InputStream stream = null;
             try {
-                stream = resource.openInputStream();
+                stream = m_resource.openInputStream();
             } catch (Exception e) {
-                reporter.error(e.getMessage());
+                m_reporter.error(e.getMessage());
                 throw new IOException("Cannot read metadata");
             }
-            StreamMetadataProvider provider = new StreamMetadataProvider(stream, reporter);
-            provider.setValidateUsingLocalSchemas(validateUsingLocalSchemas);
-            cached.addAll(provider.getMetadatas());
+            StreamMetadataProvider provider = new StreamMetadataProvider(stream, m_reporter);
+            provider.setValidateUsingLocalSchemas(m_validateUsingLocalSchemas);
+            m_cached.addAll(provider.getMetadatas());
         }
 
-        return cached;
+        return m_cached;
     }
 }



Mime
View raw message