Cosmetic fixes (update the code to be compliant with the checkstyle)

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@883835 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStrategy.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStrategy.java
index 979f707..5c5ed35 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStrategy.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStrategy.java
@@ -1,18 +1,20 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one or more

- * contributor license agreements. See the NOTICE file distributed with this

- * work for additional information regarding copyright ownership. The ASF

- * licenses this file to you under the Apache License, Version 2.0 (the

- * "License"); you may not use this file except in compliance with the License.

- * You may obtain a copy of the License at

- * 

- * http://www.apache.org/licenses/LICENSE-2.0

- * 

- * Unless required by applicable law or agreed to in writing, software

- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT

- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the

- * License for the specific language governing permissions and limitations under

- * the License.

+/* 

+ * Licensed to the Apache Software Foundation (ASF) under one

+ * or more contributor license agreements.  See the NOTICE file

+ * distributed with this work for additional information

+ * regarding copyright ownership.  The ASF licenses this file

+ * to you under the Apache License, Version 2.0 (the

+ * "License"); you may not use this file except in compliance

+ * with the License.  You may obtain a copy of the License at

+ *

+ *   http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing,

+ * software distributed under the License is distributed on an

+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ * KIND, either express or implied.  See the License for the

+ * specific language governing permissions and limitations

+ * under the License.

  */

 

 package org.apache.felix.ipojo.handlers.providedservice.strategy;

@@ -30,6 +32,7 @@
 /**

  * This {@link CreationStrategy} is here to ease customization of the strategy

  * by hiding all the reflection stuff.

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 public abstract class ConfigurableCreationStrategy extends CreationStrategy {

 

@@ -37,44 +40,72 @@
      * The instance manager passed to the iPOJO ServiceFactory to manage

      * instances.

      */

-    private InstanceManager manager;

+    private InstanceManager m_manager;

 

     /**

      * The lists of interfaces provided by this service.

      */

-    private String[] specs;

+    private String[] m_specs;

 

     /**

-     * The iPOJO ServiceFactory

+     * The iPOJO ServiceFactory.

      */

-    private IPOJOServiceFactory factory;

+    private IPOJOServiceFactory m_factory;

 

+    /**

+     * Method called when the underlying iPOJO Service factory

+     * is published.

+     * @param manager the instance manager

+     * @param specifications the provided specifications

+     * @param props the service properties

+     * @see org.apache.felix.ipojo.handlers.providedservice.CreationStrategy#onPublication(org.apache.felix.ipojo.InstanceManager, java.lang.String[], java.util.Properties)

+     */

     public void onPublication(final InstanceManager manager,

             final String[] specifications, final Properties props) {

         // Store specifications (aka interfaces)

-        this.specs = specifications;

-        this.manager = manager;

+        this.m_specs = specifications;

+        this.m_manager = manager;

     }

 

+    /**

+     * Method called when the underlying iPOJO Service factory is

+     * un-published.

+     * @see org.apache.felix.ipojo.handlers.providedservice.CreationStrategy#onUnpublication()

+     */

     public void onUnpublication() {

         // Try to close the factory

-        if (factory instanceof ServiceObjectFactory) {

-            ((ServiceObjectFactory) factory).close();

+        if (m_factory instanceof ServiceObjectFactory) {

+            ((ServiceObjectFactory) m_factory).close();

         }

     }

 

+    /**

+     * Method called when a bundle want to access a service. This method is called once per

+     * asking bundle. To turn around this limitation, a proxy is registered.

+     * @param bundle the asking bundle

+     * @param registration the service registration

+     * @return the service object

+     * @see org.osgi.framework.ServiceFactory#getService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration)

+     */

     public Object getService(final Bundle bundle,

             final ServiceRegistration registration) {

         // Init the factory if needed

-        if (factory == null) {

-            factory = getServiceFactory(manager);

+        if (m_factory == null) {

+            m_factory = getServiceFactory(m_manager);

         }

         // Return a proxy wrapping the real iPOJO ServiceFactory

-        return Proxy.newProxyInstance(manager.getClazz().getClassLoader(),

-                getModifiedSpecifications(manager.getContext()),

-                new ErrorPrintingServiceFactoryProxy(factory));

+        return Proxy.newProxyInstance(m_manager.getClazz().getClassLoader(),

+                getModifiedSpecifications(m_manager.getContext()),

+                new ErrorPrintingServiceFactoryProxy(m_factory));

     }

 

+    /**

+     * Method called when a bundle release a service.

+     * @param bundle the bundle

+     * @param registration the service registration

+     * @param service the service object

+     * @see org.osgi.framework.ServiceFactory#ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)

+     */

     public void ungetService(final Bundle bundle,

             final ServiceRegistration registration, final Object service) {

         // Nothing to do

@@ -87,11 +118,11 @@
      * @return a array of Class

      */

     private Class[] getModifiedSpecifications(final BundleContext context) {

-        Class[] classes = new Class[specs.length + 1];

+        Class[] classes = new Class[m_specs.length + 1];

         int i = 0;

-        for (i = 0; i < specs.length; i++) {

+        for (i = 0; i < m_specs.length; i++) {

             try {

-                classes[i] = context.getBundle().loadClass(specs[i]);

+                classes[i] = context.getBundle().loadClass(m_specs[i]);

             } catch (ClassNotFoundException e) {

                 // Should not happen.

             }

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFactoryProxy.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFactoryProxy.java
index d85467e..ec51005 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFactoryProxy.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFactoryProxy.java
@@ -30,14 +30,10 @@
  * If the consumer of this service do not call the getService or ungetService

  * methods, it will get an Exception with an explicit error message telling

  * him that this service is only usable through iPOJO.

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 public class ErrorPrintingServiceFactoryProxy implements InvocationHandler {

 

-	/**

-	 * Wrapped factory.

-	 */

-    private final IPOJOServiceFactory factory;

-

     /**

      * getService(ComponentInstance) method.

      */

@@ -48,8 +44,13 @@
      */

     private static Method UNGET_METHOD;

 

+    /**

+     * Wrapped factory.

+     */

+    private final IPOJOServiceFactory m_factory;

+

     static {

-    	// Static initialization of theses constants.

+        // Static initialization of theses constants.

         try {

             GET_METHOD = IPOJOServiceFactory.class.getMethod("getService",

                                                              new Class[]{ComponentInstance.class});

@@ -68,19 +69,28 @@
      * @param factory delegating iPOJO ServiceFactory

      */

     public ErrorPrintingServiceFactoryProxy(final IPOJOServiceFactory factory) {

-        this.factory = factory;

+        this.m_factory = factory;

     }

 

+    /**

+     * 'Invoke' methods called when a method is called on the proxy.

+     * @param proxy the proxy

+     * @param method the method

+     * @param args the arguments

+     * @return the result

+     * @throws Exception if something wrong happens

+     * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

+     */

     public Object invoke(final Object proxy,

                          final Method method,

-                         final Object[] args) throws Throwable {

+                         final Object[] args) throws Exception {

 

         // Handle get/unget operations

         if (GET_METHOD.equals(method)) {

-            return factory.getService((ComponentInstance) args[0]);

+            return m_factory.getService((ComponentInstance) args[0]);

         }

         if (UNGET_METHOD.equals(method)) {

-            factory.ungetService((ComponentInstance) args[0], args[1]);

+            m_factory.ungetService((ComponentInstance) args[0], args[1]);

             return null;

         }

 

diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.java
index 89ac4a2..26c4fc7 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.java
@@ -1,4 +1,4 @@
-/*

+/* 

  * Licensed to the Apache Software Foundation (ASF) under one

  * or more contributor license agreements.  See the NOTICE file

  * distributed with this work for additional information

@@ -23,12 +23,14 @@
 

 /**

  * Extended iPOJOServiceFactory that supports a close() operation.

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 public interface ServiceObjectFactory extends IPOJOServiceFactory {

 

     /**

      * Called when the supporting CreationStrategy is unpublished

-     * from the service registry.

+     * from the service registry. This allows to do an explicit 

+     * cleanup.

      */

     void close();

 }