You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/12/30 22:59:41 UTC

svn commit: r491330 - in /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core: implementation/system/component/ services/deployment/ services/management/jmx/

Author: jmarino
Date: Sat Dec 30 13:59:40 2006
New Revision: 491330

URL: http://svn.apache.org/viewvc?view=rev&rev=491330
Log:
checkstyle formatting fixes

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/AnnotationDrivenDynamicMBean.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/JmxManagementService.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/ReflectedDynamicMBean.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java?view=diff&rev=491330&r1=491329&r2=491330
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemSingletonAtomicComponent.java Sat Dec 30 13:59:40 2006
@@ -18,11 +18,11 @@
  */
 package org.apache.tuscany.core.implementation.system.component;
 
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Collection;
 
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.component.AtomicComponent;
@@ -47,7 +47,8 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public class SystemSingletonAtomicComponent<S, T extends S> extends AbstractComponentExtension implements AtomicComponent {
+public class SystemSingletonAtomicComponent<S, T extends S> extends AbstractComponentExtension
+    implements AtomicComponent {
 
     private T instance;
     private Map<String, InboundWire> inboundWires;

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java?view=diff&rev=491330&r1=491329&r2=491330
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/deployment/XMLChangeSetHandler.java Sat Dec 30 13:59:40 2006
@@ -28,9 +28,6 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.tuscany.core.deployer.RootDeploymentContext;
-import org.apache.tuscany.host.deployment.ContentTypes;
-import org.apache.tuscany.host.deployment.DeploymentException;
 import org.apache.tuscany.spi.bootstrap.RuntimeComponent;
 import org.apache.tuscany.spi.builder.Builder;
 import org.apache.tuscany.spi.builder.BuilderException;
@@ -44,6 +41,10 @@
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.model.ComponentDefinition;
 
+import org.apache.tuscany.core.deployer.RootDeploymentContext;
+import org.apache.tuscany.host.deployment.ContentTypes;
+import org.apache.tuscany.host.deployment.DeploymentException;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -73,34 +74,34 @@
             XMLStreamReader xmlReader = xmlFactory.createXMLStreamReader(changeSet);
             while (true) {
                 switch (xmlReader.next()) {
-                case START_ELEMENT:
-                    if (!CHANGESET.equals(xmlReader.getName())) {
-                        throw new InvalidDocumentException(xmlReader.getName().toString());
-                    }
-                    processChanges(xmlReader);
-                    break;
-                case END_DOCUMENT:
-                    return;
+                    case START_ELEMENT:
+                        if (!CHANGESET.equals(xmlReader.getName())) {
+                            throw new InvalidDocumentException(xmlReader.getName().toString());
+                        }
+                        processChanges(xmlReader);
+                        break;
+                    case END_DOCUMENT:
+                        return;
                 }
             }
         } catch (XMLStreamException e) {
-            throw(IOException) new IOException(e.getMessage()).initCause(e);
+            throw (IOException) new IOException(e.getMessage()).initCause(e);
         }
     }
 
     public void processChanges(XMLStreamReader xmlReader) throws XMLStreamException, DeploymentException {
         while (true) {
             switch (xmlReader.next()) {
-            case START_ELEMENT:
-                if (CREATECOMPONENT.equals(xmlReader.getName())) {
-                    createComponent(xmlReader);
-                } else {
-                    // reject unrecognized commands
-                    throw new InvalidDocumentException(xmlReader.getName().toString());
-                }
-                break;
-            case END_ELEMENT:
-                return;
+                case START_ELEMENT:
+                    if (CREATECOMPONENT.equals(xmlReader.getName())) {
+                        createComponent(xmlReader);
+                    } else {
+                        // reject unrecognized commands
+                        throw new InvalidDocumentException(xmlReader.getName().toString());
+                    }
+                    break;
+                case END_ELEMENT:
+                    return;
             }
         }
     }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/AnnotationDrivenDynamicMBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/AnnotationDrivenDynamicMBean.java?view=diff&rev=491330&r1=491329&r2=491330
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/AnnotationDrivenDynamicMBean.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/AnnotationDrivenDynamicMBean.java Sat Dec 30 13:59:40 2006
@@ -29,16 +29,16 @@
 
 /**
  * Dynamic MBean based on management annotations.
- * 
- * @version $Revision$ $Date$
  *
+ * @version $Revision$ $Date$
  */
 public class AnnotationDrivenDynamicMBean implements DynamicMBean {
 
     /**
      * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
      */
-    public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
+    public Object getAttribute(String attribute)
+        throws AttributeNotFoundException, MBeanException, ReflectionException {
         throw new UnsupportedOperationException();
     }
 
@@ -57,10 +57,10 @@
     }
 
     /**
-     * @see javax.management.DynamicMBean#invoke(java.lang.String, java.lang.Object[], java.lang.String[])
+     * @see javax.management.DynamicMBean#invoke(java.lang.String,java.lang.Object[],java.lang.String[])
      */
     public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException,
-        ReflectionException {
+                                                                                        ReflectionException {
         throw new UnsupportedOperationException();
     }
 
@@ -68,7 +68,7 @@
      * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
      */
     public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
-        MBeanException, ReflectionException {
+                                                         MBeanException, ReflectionException {
         throw new UnsupportedOperationException();
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/JmxManagementService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/JmxManagementService.java?view=diff&rev=491330&r1=491329&r2=491330
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/JmxManagementService.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/JmxManagementService.java Sat Dec 30 13:59:40 2006
@@ -20,38 +20,40 @@
 
 import java.net.URI;
 
-import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.services.management.ManagementService;
-
 import org.osoa.sca.annotations.Destroy;
 import org.osoa.sca.annotations.Init;
 import org.osoa.sca.annotations.Property;
 
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.services.management.ManagementService;
+
 /**
  * JMX implementation of the management service.
- * 
- * @version $Revision$ $Date$
  *
+ * @version $Revision$ $Date$
  */
 public abstract class JmxManagementService implements ManagementService {
-    
-    /** Istrumentation mode used by the service. */
+
+    /**
+     * Istrumentation mode used by the service.
+     */
     @Property
     protected InstrumentationMode instrumentationMode;
 
     /**
-     * @see org.apache.tuscany.spi.services.management.ManagementService#registerComponent(java.net.URI, java.lang.String, org.apache.tuscany.spi.component.Component)
+     * @see org.apache.tuscany.spi.services.management.ManagementService#registerComponent(java.net.URI,
+     *java.lang.String,org.apache.tuscany.spi.component.Component)
      */
     public void registerComponent(URI compositeURI, String name, Component component) {
         throw new UnsupportedOperationException();
     }
-    
+
     /**
      * Starts the agent connector for the service.
      */
     @Init
     public abstract void start();
-    
+
     /**
      * Stops the agent connector for the service.
      */

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/ReflectedDynamicMBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/ReflectedDynamicMBean.java?view=diff&rev=491330&r1=491329&r2=491330
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/ReflectedDynamicMBean.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/services/management/jmx/ReflectedDynamicMBean.java Sat Dec 30 13:59:40 2006
@@ -31,7 +31,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import javax.management.Attribute;
 import javax.management.AttributeList;
 import javax.management.AttributeNotFoundException;
@@ -44,70 +43,89 @@
 import javax.management.ReflectionException;
 
 /**
- * Uses JMX dynamic MBean to expose management information of a delegate
- * instance using reflection. Currently constructor and notification 
- * metadata are not supported. Any attribute or operation that needs to 
- * be excluded from the management information can be specified optionally 
- * in the factory method. 
- * 
- * All the methods and properties on <code>java.lang.Object</code> are 
- * excluded by default. Also only public and non-static members are made 
- * available for management.
- * 
- * TODO Find a homw other than server.start for this class.
- * TODO Tidy up, unit tests
- * 
- * @version $Revsion$ $Date$
+ * Uses JMX dynamic MBean to expose management information of a delegate instance using reflection. Currently
+ * constructor and notification metadata are not supported. Any attribute or operation that needs to be excluded from
+ * the management information can be specified optionally in the factory method.
+ * <p/>
+ * All the methods and properties on <code>java.lang.Object</code> are excluded by default. Also only public and
+ * non-static members are made available for management.
+ * <p/>
+ * TODO Find a homw other than server.start for this class. TODO Tidy up, unit tests
  *
+ * @version $Revsion$ $Date$
  */
 public class ReflectedDynamicMBean implements DynamicMBean {
 
-    /** Excluded methods. */
+    /**
+     * Excluded methods.
+     */
     private static final List<String> DEFAULT_EXCLUDED_METHODS =
-        Arrays.asList(new String[] {"wait", "toString", "hashCode", "notify", "equals", "notifyAll", "getClass"});
+        Arrays.asList(new String[]{"wait", "toString", "hashCode", "notify", "equals", "notifyAll", "getClass"});
 
-    /** Excluded properties. */
-    private static final List<String> DEFAULT_EXCLUDED_PROPERTIES = Arrays.asList(new String[] {"class"});
+    /**
+     * Excluded properties.
+     */
+    private static final List<String> DEFAULT_EXCLUDED_PROPERTIES = Arrays.asList(new String[]{"class"});
 
-    /** Proxied object that is managed. */
+    /**
+     * Proxied object that is managed.
+     */
     private Object delegate;
 
-    /** Runtime type of the managed object. */
+    /**
+     * Runtime type of the managed object.
+     */
     private Class delegateClass;
-    
-    /** Delegate class name. */
+
+    /**
+     * Delegate class name.
+     */
     private String delegateClassName;
 
-    /** Cache of property write methods. */
+    /**
+     * Cache of property write methods.
+     */
     private Map<String, Method> propertyWriteMethods = new HashMap<String, Method>();
 
-    /** Cache of property read methods. */
+    /**
+     * Cache of property read methods.
+     */
     private Map<String, Method> propertyReadMethods = new HashMap<String, Method>();
 
-    /** Managed operation cache. */
+    /**
+     * Managed operation cache.
+     */
     private Map<String, Method> methods = new HashMap<String, Method>();
 
-    /** Property descriptor cache. */
+    /**
+     * Property descriptor cache.
+     */
     private Map<String, PropertyDescriptor> properties = new HashMap<String, PropertyDescriptor>();
 
-    /** Excluded methods. */
+    /**
+     * Excluded methods.
+     */
     private final List<String> excludedMethods = new ArrayList<String>();
 
-    /** Excluded properties. */
+    /**
+     * Excluded properties.
+     */
     private final List<String> excludedProperties = new ArrayList<String>();
-    
+
     /**
      * Introspects the bean and populate meta information.
+     *
      * @param delegate Proxied managed instance.
      */
     private ReflectedDynamicMBean(Object delegate) {
         this(delegate, new ArrayList<String>(), new ArrayList<String>());
     }
-    
+
     /**
      * Introspects the bean and populate meta information.
-     * @param delegate Proxied managed instance.
-     * @param excludedMethods Operations excluded from managed view.
+     *
+     * @param delegate           Proxied managed instance.
+     * @param excludedMethods    Operations excluded from managed view.
      * @param excludedProperties Properties excluded from managed view.
      */
     private ReflectedDynamicMBean(Object delegate, List<String> excludedMethods, List<String> excludedProperties) {
@@ -115,7 +133,7 @@
         this.delegate = delegate;
         this.delegateClass = delegate.getClass();
         this.delegateClassName = delegateClass.getName();
-        
+
         this.excludedMethods.addAll(excludedMethods);
         this.excludedMethods.addAll(DEFAULT_EXCLUDED_METHODS);
         this.excludedProperties.addAll(excludedProperties);
@@ -132,20 +150,23 @@
 
         cacheMethods(beanInfo);
     }
-    
+
     /**
      * Factory method for creating the management view.
-     * @param delegate Proxied managed instance.
-     * @param excludedMethods Operations excluded from managed view.
+     *
+     * @param delegate           Proxied managed instance.
+     * @param excludedMethods    Operations excluded from managed view.
      * @param excludedProperties Properties excluded from managed view.
      * @return Proxy for the managed instance.
      */
-    public static ReflectedDynamicMBean newInstance(Object delegate, List<String> excludedMethods, List<String> excludedProperties) {
+    public static ReflectedDynamicMBean newInstance(Object delegate, List<String> excludedMethods,
+                                                    List<String> excludedProperties) {
         return new ReflectedDynamicMBean(delegate, excludedMethods, excludedProperties);
     }
-    
+
     /**
      * Factory method for creating the management view.
+     *
      * @param delegate Proxied managed instance.
      * @return Proxy for the managed instance.
      */
@@ -156,7 +177,8 @@
     /**
      * @see javax.management.DynamicMBean#getAttribute(java.lang.String)
      */
-    public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
+    public Object getAttribute(String attribute)
+        throws AttributeNotFoundException, MBeanException, ReflectionException {
 
         Method readMethod = propertyReadMethods.get(attribute);
         if (readMethod == null) {
@@ -176,9 +198,9 @@
      * @see javax.management.DynamicMBean#getAttributes(java.lang.String[])
      */
     public AttributeList getAttributes(String[] attributes) {
-        
+
         AttributeList list = new AttributeList();
-        for(String attribute : attributes) {
+        for (String attribute : attributes) {
             try {
                 list.add(new Attribute(attribute, getAttribute(attribute)));
             } catch (AttributeNotFoundException ex) {
@@ -190,7 +212,7 @@
             }
         }
         return list;
-        
+
     }
 
     /**
@@ -220,17 +242,17 @@
         } catch (javax.management.IntrospectionException ex) {
             throw new InstrumentationException(ex);
         }
-        
+
     }
 
     /**
-     * @see javax.management.DynamicMBean#invoke(java.lang.String, java.lang.Object[], java.lang.String[])
+     * @see javax.management.DynamicMBean#invoke(java.lang.String,java.lang.Object[],java.lang.String[])
      */
     public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException,
-        ReflectionException {
-        
+                                                                                        ReflectionException {
+
         Method method = methods.get(actionName);
-        if(method == null) {
+        if (method == null) {
             throw new InstrumentationException("Operation not found: " + actionName);
         }
         try {
@@ -240,14 +262,14 @@
         } catch (InvocationTargetException ex) {
             throw new ReflectionException(ex);
         }
-        
+
     }
 
     /**
      * @see javax.management.DynamicMBean#setAttribute(javax.management.Attribute)
      */
     public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
-        MBeanException, ReflectionException {
+                                                         MBeanException, ReflectionException {
 
         Method writeMethod = propertyWriteMethods.get(attribute.getName());
         if (writeMethod == null) {
@@ -269,17 +291,19 @@
     public AttributeList setAttributes(AttributeList attributes) {
         throw new UnsupportedOperationException();
     }
+
     /**
      * Caches managed operations.
+     *
      * @param beanInfo Bean info for the managed instance.
      */
     private void cacheMethods(BeanInfo beanInfo) {
-        
+
         for (MethodDescriptor methodDescriptor : beanInfo.getMethodDescriptors()) {
 
             Method method = methodDescriptor.getMethod();
             String name = method.getName();
-            
+
             if (excludedMethods.contains(name)) {
                 continue;
             }
@@ -290,16 +314,17 @@
             if (propertyReadMethods.values().contains(method) || propertyWriteMethods.values().contains(method)) {
                 continue;
             }
-            
+
             // TODO Add support for overloaded methods
             methods.put(name, method);
-            
+
         }
-        
+
     }
 
     /**
      * Caches managed properties.
+     *
      * @param beanInfo Bean info for the managed instance.
      */
     private void cacheProperties(BeanInfo beanInfo) {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org