harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r438510 [2/5] - in /incubator/harmony/enhanced/tools/trunk/jmx_console: ./ doc/ doc/Images/ make/ src/ src/icons/ src/org/ src/org/apache/ src/org/apache/harmony/ src/org/apache/harmony/x/ src/org/apache/harmony/x/management/ src/org/apache...
Date Wed, 30 Aug 2006 15:03:03 GMT
Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/7_16x16.PNG
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/7_16x16.PNG?rev=438510&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/7_16x16.PNG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213.PNG
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213.PNG?rev=438510&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213.PNG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213_Author.txt
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213_Author.txt?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213_Author.txt (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213_Author.txt Wed Aug 30 08:02:59 2006
@@ -0,0 +1,5 @@
+Image of a dandelion with ant on it.
+
+Author: Volosyuk, Ivan T
+E-mail: ivan.volosyuk@gmail.com
+

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/8_320x213_Author.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/9_16x16.PNG
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/9_16x16.PNG?rev=438510&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/icons/9_16x16.PNG
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AttributeInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AttributeInfo.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AttributeInfo.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AttributeInfo.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,89 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import javax.management.Attribute;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class AttributeInfo extends Attribute {
+
+    /**
+     * Serial version UID for serialization purposes.
+     */
+    private static final long serialVersionUID = 3562800810589989580L;
+    
+    /**
+     * 
+     */
+    private boolean readable;
+    
+    /**
+     * 
+     */
+    private boolean writable;
+   
+    /**
+     * 
+     */
+    private String type;
+    
+    /**
+     * 
+     * @param attName
+     * @param attValue
+     * @param info
+     */
+    public AttributeInfo(String attName, Object attValue, boolean readable,
+            boolean writable, String type) {
+        
+        super(attName, attValue);
+        this.readable = readable;
+        this.writable = writable;
+        this.type = type;
+    }
+    
+    /**
+     * 
+     * @return
+     */
+    public boolean isReadable() {
+        return this.readable;
+    }
+    
+    /**
+     * 
+     * @return
+     */
+    public boolean isWritable() {
+        return this.writable;
+    }
+    
+    /**
+     * 
+     * @return
+     */
+    public String getType() {
+        return this.type;
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AttributeInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AuthorizationException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AuthorizationException.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AuthorizationException.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AuthorizationException.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,49 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class AuthorizationException extends Exception {
+
+    /**
+     * Serial version UID for serialization purposes.
+     */
+    private static final long serialVersionUID = 4147814259320062057L;
+    
+    /**
+     * Construct this object.
+     */
+    public AuthorizationException() {
+        super();
+    }
+    
+    /**
+     * Construct this object with message. 
+     * 
+     * @param msg The message.
+     */
+    public AuthorizationException(String msg) {
+        super(msg);
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/AuthorizationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ConnectionException.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ConnectionException.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ConnectionException.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,49 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class ConnectionException extends Exception {
+
+    /**
+     * Serial version UID for serialization purposes.
+     */
+    private static final long serialVersionUID = 8950501897834349489L;
+    
+    /**
+     * Construct this object.
+     */
+    public ConnectionException() {
+        super();
+    }
+    
+    /**
+     * Construct this object with message. 
+     * 
+     * @param msg The message.
+     */
+    public ConnectionException(String msg) {
+        super(msg);
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ConnectionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Controller.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Controller.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Controller.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Controller.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,196 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import java.util.List;
+
+
+/**
+ * An interface that works as a mid-layer between GUI and MBeanServer.
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public interface Controller {
+    
+    /**
+     * Start a JMX compliant server in the same JVM as this Controller
+     * registering MXBeans necessary to run VMMonitor.
+     * 
+     * @throws ConnectionException - If MBeanServer can not be created.
+     */
+    void connect() throws ConnectionException;
+    
+    /**
+     * Start a JMX compliant server in the same JVM as this Controller.
+     * 
+     * @param defaultDomain - The defaul domain for a newly created MBeanServer.
+     * @throws ConnectionException - If MBeanServer can not be created.
+     */
+    void connect(String defaultDomain) throws ConnectionException;
+    
+    /**
+     * Connect remotely to a running instance of JMX compliant server.
+     * 
+     * @param url - A connection URL that contains protocol, host and port. 
+     * @param login - A login.
+     * @param pass - A password.
+     * 
+     * @throws ConnectionException - If MBean server not found at the URL.
+     * @throws AuthorizationException - If credentials are not supplied or
+     *         incorrect.
+     */
+    void connect(String url, String login, String pass) 
+            throws ConnectionException, AuthorizationException;
+    
+    /** 
+     * Erase any references to MBeanServerConnection interface.
+     */
+    void disconnect();
+    
+    /**
+     * Get an access to common operations performed on MBeans.
+     * 
+     * @return MBeanOperations instance.
+     * 
+     * @throws ServerCommunicationException
+     */
+    MBeanOperations getMBeanOperations();
+    
+    /**
+     * Get an access to a specific MLet service registered on MBeanServer
+     * using its ObjectName.
+     * 
+     * @param objectName - The MLet service ObjectName.
+     * 
+     * @return MLetService instance.
+     * 
+     * @throws ServiceNotInstalledException - If such MLetService is not 
+     *         registered.
+     */
+    MLetService getMLetService(String objectName) 
+            throws ServiceNotInstalledException;
+    
+    /**
+     * Get all MLet services registerd on MBeanServer.
+     * 
+     * @return A collection containing ObjectNames of MLet services.
+     * 
+     * @throws ControllerOperationException - If the Exception occurs while
+     *         searching for MLet services.
+     * @throws ServiceNotInstalledException - If no MLet service found on 
+     *         a server.
+     */
+    List getMLetServices() throws ControllerOperationException, 
+            ServiceNotInstalledException;
+    
+    /**
+     * Get an access to a specific Monitor service registered on MBeanServer
+     * using its ObjectName.
+     * 
+     * @param objectName - The Monitor service ObjectName.
+     * 
+     * @return MonitorService instance.
+     * 
+     * @throws ServiceNotInstalledException - If such MonitorService is not 
+     *         registered.
+     */
+    MonitorService getMonitorService(String objectName) 
+            throws ServiceNotInstalledException;
+    
+    /**
+     * Get all Monitor services registerd on MBeanServer.
+     * 
+     * @return A collection containing ObjectNames of Monitor services.
+     * 
+     * @throws ControllerOperationException - If the Exception occurs while
+     *         searching for Monitor services.
+     * @throws ServiceNotInstalledException - If no Monitor service found on a 
+     *         server.
+     */
+    List getMonitorServices() throws ControllerOperationException, 
+            ServiceNotInstalledException;
+    
+    /**
+     * Get service that allows to monitor some BroadCaster's activity.
+     * 
+     * @return NotificationHandler instance.
+     */
+    NotificationHandler getNotificationService();
+    
+    /**
+     * Get an access to a specific Relation service registered on MBeanServer
+     * using its ObjectName.
+     * 
+     * @param objectName - The RealtionService ObjectName.
+     * 
+     * @return RealtionService instance.
+     * 
+     * @throws ServiceNotInstalledException - If such RealtionService is not 
+     *         registered.
+     */
+    RService getRelationService(String objectName) 
+            throws ServiceNotInstalledException;
+    
+    /**
+     * Get all Relation services registerd on MBeanServer.
+     * 
+     * @return A collection containing ObjectNames of Relation services.
+     * 
+     * @throws ControllerOperationException - If the Exception occurs while
+     *         searching for Relation services.
+     * @throws ServiceNotInstalledException - If no Relation service found on 
+     *         a server.
+     */
+    List getRelationServices() throws ControllerOperationException, 
+            ServiceNotInstalledException;
+    
+    /**
+     * Get an access to a specific Timer service registered on MBeanServer
+     * using its ObjectName.
+     * 
+     * @param objectName - The Timer service ObjectName.
+     * 
+     * @return Timer service instance.
+     * 
+     * @throws ServiceNotInstalledException - If such Timer service is not 
+     *         registered.
+     */
+    TimerService getTimerService(String objectName) 
+            throws ServiceNotInstalledException;
+    
+    /**
+     * Get all Timer services registerd on MBeanServer.
+     * 
+     * @return A collection containing ObjectNames of Timer services.
+     * 
+     * @throws ControllerOperationException - If the Exception occurs while
+     *         searching for Timer services.
+     * @throws ServiceNotInstalledException - If no Timer service found on 
+     *         a server.
+     */
+    List getTimerServices() throws ControllerOperationException, 
+            ServiceNotInstalledException;
+    
+    /**
+     * 
+     * @return
+     * @throws ServiceNotInstalledException
+     */
+    VMMonitor getVMMonitor() throws ServiceNotInstalledException;
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Controller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerFactory.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerFactory.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerFactory.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,38 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * This class is used to get Controller's implementation. 
+ * Right now it's always ControllerImpl instance. 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class ControllerFactory {
+
+    /**
+     * Get Controller reference.
+     * 
+     * @return Controller reference.
+     */
+    public static Controller getController() {
+        return ControllerImpl.getController();
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerImpl.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerImpl.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerImpl.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,320 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+
+
+/**
+ * An implementation of Controller interface.
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class ControllerImpl implements Controller {
+    
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con = null;
+    
+    /**
+     * {@inheritDoc} 
+     */
+    public void connect() 
+            throws ConnectionException {
+         
+        this.con = ManagementFactory.getPlatformMBeanServer();
+        
+        if (con == null) {
+            throw new ConnectionException(
+                    "Connection to a platform MBean server failed");
+        }
+    }
+    
+    /**
+     * {@inheritDoc} 
+     */
+    public void connect(String defaultDomain) 
+            throws ConnectionException {
+         
+        this.con = MBeanServerFactory.createMBeanServer(defaultDomain);
+        
+        if (con == null) {
+            throw new ConnectionException(
+                    "Connection to a local MBean server failed");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void connect(String url, String login, String pass) 
+            throws ConnectionException, AuthorizationException {
+        
+        try {
+            JMXServiceURL jmxUrl = new JMXServiceURL(url);
+            JMXConnector jmxc = JMXConnectorFactory.connect(jmxUrl);
+            this.con = jmxc.getMBeanServerConnection();
+        }
+        catch(Exception e) {
+            ConnectionException snfe = new ConnectionException(
+                    "Connection to a remote MBean server failed: " +
+                    e.getMessage());
+            snfe.initCause(e);
+            throw snfe;
+        }
+        
+        if (con == null) {
+            throw new ConnectionException(
+                    "Connection to a remote MBean server failed");
+        }
+    }
+    
+    /** 
+     * {@inheritDoc}
+     */
+    public void disconnect() {
+        this.con = null;
+    }
+    
+    /**
+     * Create new instance of this class.
+     * 
+     * @return This instance.
+     */
+    public static Controller getController() {
+        return new ControllerImpl();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public MBeanOperations getMBeanOperations() {
+        if (isConnected()) {
+            return new MBeanOperations(con);
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public MLetService getMLetService(String objectName) 
+            throws ServiceNotInstalledException {
+        
+        if (isConnected()) {
+            try {
+                return new MLetService(con, new ObjectName(objectName));
+            } catch(MalformedObjectNameException e) {
+                ServiceNotInstalledException snie = 
+                    new ServiceNotInstalledException(e.getMessage());
+                snie.initCause(e);
+                throw snie;
+            }
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public List getMLetServices() throws ControllerOperationException, 
+            ServiceNotInstalledException {
+        
+        return getService("javax.management.loading.MLet", "MLet");
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public MonitorService getMonitorService(String objectName) 
+            throws ServiceNotInstalledException {
+        
+        if (isConnected()) {
+            try {
+                return new MonitorService(con, new ObjectName(objectName));
+            } catch(MalformedObjectNameException e) {
+                ServiceNotInstalledException snie = 
+                    new ServiceNotInstalledException(e.getMessage());
+                snie.initCause(e);
+                throw snie;
+            }
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public List getMonitorServices() throws ControllerOperationException, 
+            ServiceNotInstalledException {
+        
+        return getService("javax.management.monitor.Monitor", "Monitor");
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public NotificationHandler getNotificationService() {
+        if (isConnected()) {
+            return new NotificationHandler(con);
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public RService getRelationService(String objectName) 
+            throws ServiceNotInstalledException {
+        
+        if (isConnected()) {
+            try {
+                return new RService(con, new ObjectName(objectName));
+            } catch(MalformedObjectNameException e) {
+                ServiceNotInstalledException snie = 
+                    new ServiceNotInstalledException(e.getMessage());
+                snie.initCause(e);
+                throw snie;
+            }
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public List getRelationServices() throws ControllerOperationException, 
+            ServiceNotInstalledException {
+        
+        return getService("javax.management.relation.RelationService", 
+                "Relation");
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public TimerService getTimerService(String objectName) 
+            throws ServiceNotInstalledException {
+        
+        if (isConnected()) {
+            try {
+                return new TimerService(con, new ObjectName(objectName));
+            } catch(MalformedObjectNameException e) {
+                ServiceNotInstalledException snie = 
+                    new ServiceNotInstalledException(e.getMessage());
+                snie.initCause(e);
+                throw snie;
+            }
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public List getTimerServices() throws ControllerOperationException, 
+            ServiceNotInstalledException {
+        
+        return getService("javax.management.timer.Timer", "Timer");
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public VMMonitor getVMMonitor() throws ServiceNotInstalledException {
+        if (isConnected()) {
+            return new VMMonitor(con);
+        } else {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+    }
+    
+    /*
+     * Query MBeans using a complete pattern, so all currently registered
+     * MBeans will be selected initially. Then filter MBeans by selecting
+     * only those that are instances of the class specified.  
+     * 
+     * @param serviceClass
+     * @param serviceName
+     * 
+     * @return
+     * 
+     * @throws ControllerOperationException
+     * @throws ServiceNotInstalledException
+     */
+    private List getService(String serviceClass, String serviceName) 
+            throws ControllerOperationException, ServiceNotInstalledException {
+        
+        if (!isConnected()) {
+            throw new IllegalStateException("Not connected to MBean server");
+        }
+        
+        List list = new ArrayList();
+        
+        try {
+            Set set = con.queryNames(new ObjectName("*:*"), null);
+            
+            for (Iterator it = set.iterator(); it.hasNext(); ) {
+                ObjectName on = (ObjectName) it.next();
+                
+                if (con.isInstanceOf(on, serviceClass)) {
+                    list.add(on);
+                }
+            }
+        } catch(Exception e) {
+            ControllerOperationException snie = 
+                new ControllerOperationException(e.getMessage());
+            snie.initCause(e);
+            throw snie;
+        }
+        
+        if (list.size() == 0) {
+            throw new ServiceNotInstalledException(
+                    "No " + serviceName + " service found on this MBean server");
+        } else {
+            return list;
+        }
+    }
+    
+    /**
+     * Check whether a connection to MBeanServer has been established.
+     */
+    private boolean isConnected() {
+        return (con != null);
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerOperationException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerOperationException.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerOperationException.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerOperationException.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,49 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class ControllerOperationException extends Exception {
+    
+    /**
+     * Serial version UID for serialization purposes.
+     */
+    private static final long serialVersionUID = 2339143132091711307L;
+    
+    /**
+     * Construct this object.
+     */
+    public ControllerOperationException() {
+        super();
+    }
+
+    /**
+     * Construct this object with message. 
+     * 
+     * @param msg The message.
+     */
+    public ControllerOperationException(String msg) {
+        super(msg);
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ControllerOperationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MBeanOperations.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MBeanOperations.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MBeanOperations.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MBeanOperations.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,463 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.4 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanParameterInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+
+/**
+ * Handles standard operations on MBeans, such as registering, 
+ * setting attributes, etc. No difference made for MBeans that are also
+ * JMX services. This class is intended to be initiated from Controller class
+ * and to be used by GUI.      
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.4 $
+ */
+public class MBeanOperations {
+    
+    /**
+     * A map containing primitives as its keys and their corresponding
+     * wrapper classes as its values.
+     */
+	private static Hashtable primWrappers = new Hashtable(8);
+    static {
+    	primWrappers.put("boolean", Boolean.class);
+    	primWrappers.put("byte", Byte.class);
+    	primWrappers.put("char", Character.class);
+    	primWrappers.put("double", Double.class);
+    	primWrappers.put("float", Float.class);
+    	primWrappers.put("int", Integer.class);
+    	primWrappers.put("long", Long.class);            
+    	primWrappers.put("short", Short.class);
+    }
+    
+    /**
+     * A map of primitive types as values and its string representation as keys.
+     */
+    private static HashMap primitives = new HashMap(8);
+    static {
+        primitives.put("boolean", Boolean.TYPE);
+        primitives.put("byte", Byte.TYPE);
+        primitives.put("char", Character.TYPE);
+        primitives.put("double", Double.TYPE);
+        primitives.put("float", Float.TYPE);
+        primitives.put("int", Integer.TYPE);
+        primitives.put("long", Long.TYPE);            
+        primitives.put("short", Short.TYPE);
+    }
+	
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con;
+    
+    /**
+     * Construct this object. It may be called from the Controller only.
+     * 
+     * @param con A reference to MBeanServer this class is initialized with.
+     *            Can not be null.  
+     */
+    MBeanOperations(MBeanServerConnection con) {
+        this.con = con;
+    }
+    
+    /**
+     * Invoke a method on MBean converting the given parameters
+     * from Strings to their actual Objects. Only primWrappers and Objects 
+     * that have constructor with single String parameter are allowed.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * @param operation - A name of the method to be invoked.
+     * @param params - An array of params in String format received from GUI.
+     * @param sign - The signature of the method to be invoked.
+     * 
+     * @return The result of the method's execution.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public Object execute(String name, String operation, String[] params,
+            String[] sign) throws ControllerOperationException {
+        
+        try {
+            Object[] p = null;
+            
+            if (sign != null) {
+                p = new Object[sign.length];
+                
+                for (int i = 0; i < p.length; i++) {
+                    Class cl = (Class) primWrappers.get(sign[i]);
+                    
+                    if (cl == null) {
+                        cl = Class.forName(sign[i]);
+                    }
+                    
+                    p[i] = cl.getConstructor(
+                            new Class[] { String.class }).newInstance(
+                                    new Object[] { params[i] });
+                }
+            }
+            
+            return con.invoke(new ObjectName(name), operation, p, sign);
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Convert String to ObjectName and invoke the corresponding method
+     * of the MBeanServerConnection.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * @param att - A name of the attribute.
+     * 
+     * @return The attribute's value.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public Object getAttribute(String name, String att) 
+            throws ControllerOperationException {
+        
+        try {
+            return this.con.getAttribute(new ObjectName(name), att);
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Get all unique domains that are used for currently registered MBeans.
+     * 
+     * @return An array of domains sorted in lexographical order.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public String[] getAllDomains() throws ControllerOperationException {
+        String[] dom = null;
+        
+        try {
+            dom = this.con.getDomains();
+        } catch (IOException e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        }
+        
+        Arrays.sort(dom);
+        return dom; 
+    }
+
+    /**
+     * Get MBeanInfo for the MBean specified.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @return MBeanInfo of a given MBean.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public MBeanInfo getMBeanInfo(String name) 
+            throws ControllerOperationException {
+        
+        try {
+            return this.con.getMBeanInfo(new ObjectName(name));
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Get all properties of the MBean specified.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @return A Hashtable contating keys and values of the MBean's properties.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public Hashtable getMBeanProperties(String name) 
+            throws ControllerOperationException {
+        
+        ObjectName on = null;
+        
+        try {
+            on = new ObjectName(name);
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+        
+        return on.getKeyPropertyList();
+    }
+    
+    /**
+     * Get all MBeans that are registered under given domain.
+     * 
+     * @param domain - A domain for which MBeans will be listed.
+     * 
+     * @return An array of the matching ObjectNames in canonical form.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public String[] getMBeansOfDomain(String domain) 
+            throws ControllerOperationException {
+        
+        Set set = null;
+        
+        try {
+            set = this.con.queryNames(new ObjectName(domain + ":*"), null);
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException();
+            coe.initCause(e);
+            throw coe;
+        } 
+        
+        String[] mbeans = new String[set.size()];
+        int i = 0;
+        
+        for (Iterator it = set.iterator(); it.hasNext(); i++) {
+            ObjectName on = (ObjectName) it.next();
+            mbeans[i] = on.getCanonicalName();
+        }
+        
+        return mbeans;
+    }
+    
+    /**
+     * Get all attributes, their values and 
+     * read/write access flags for the MBean specified.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @return A collection of all attributes, their values and 
+     *         read/write access flags for the MBean specified.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public List listAttributes(String name) throws ControllerOperationException {
+        MBeanAttributeInfo[] ai = getMBeanInfo(name).getAttributes();
+        List list = new ArrayList(ai.length);
+        
+        for (int i = 0; i < ai.length; i++) {
+            AttributeInfo info = new AttributeInfo(
+                    ai[i].getName(), 
+                    getAttribute(name, ai[i].getName()), 
+                    ai[i].isReadable(),
+                    ai[i].isWritable(),
+                    ai[i].getType());
+            list.add(info);
+        }
+        
+        return list;
+    }
+    
+    /**
+     * 
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @return
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public List listNotifications(String name) 
+            throws ControllerOperationException {
+        
+        MBeanNotificationInfo[] ni = getMBeanInfo(name).getNotifications();
+        List list = new ArrayList(ni.length);
+        
+        for (int i = 0; i < ni.length; i++) {
+            //OperationInfo info = new OperationInfo(); // Notifications
+            //list.add(info);
+        }
+        
+        return list;
+    }
+    
+    /**
+     * Get all operations, their return types and 
+     * signatures for the MBean specified. For each operation set a flag
+     * if it can be executed from GUI. To qualify all parameters of the
+     * operation must be either primWrappers or Objects that have a constructor 
+     * with a single String parameter.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @return A collection of all operations, their return types and 
+     *         signatures for the MBean specified.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public List listOperations(String name) throws ControllerOperationException {
+        MBeanOperationInfo[] oi = getMBeanInfo(name).getOperations();
+        List list = new ArrayList(oi.length);
+        
+        for (int i = 0; i < oi.length; i++) {
+            MBeanOperationInfo in = oi[i];
+            MBeanParameterInfo[] pi = in.getSignature();
+            String[] sign = new String[pi.length];
+            boolean executable = true;
+            
+            for (int j = 0; j < pi.length; j++) {
+                sign[j] = pi[j].getType();
+                Class cl = (Class) primitives.get(sign[j]);
+                
+                if (cl == null) {
+                    try {
+                        cl = Class.forName(sign[j]); 
+                    } catch(ClassNotFoundException cnfe) {
+                        executable = false;
+                    }
+                }
+                
+                try {
+                    cl.getConstructor(new Class[] { String.class });
+                } catch (SecurityException e) {
+                    executable = false;
+                } catch (NoSuchMethodException e) {
+                    executable = false;
+                }
+            }
+            
+            OperationInfo info = new OperationInfo(
+                    in.getName(),
+                    null,
+                    sign,
+                    in.getReturnType(),
+                    executable);
+            list.add(info);
+        }
+        
+        return list;
+    }
+    
+    /**
+     * Register a new MBean on MBeanServer. The MBean's class should be
+     * loadable through the MBeanServer's repository.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public void registerMBean(String className, String name) 
+            throws ControllerOperationException {
+        
+        try {
+            con.createMBean(className, 
+                    (name == null ? null : new ObjectName(name)));
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+
+    /**
+     * Set a new attribute value for the MBean's attribute.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * @param key - A name of the attribute.
+     * @param value - A value of the attribute.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public void setAttribute(String name, String key, String val, String type) 
+        throws ControllerOperationException {
+
+    	try {
+    		Class cl = (Class) primWrappers.get(type); 
+
+            if (cl == null) {
+                cl = Class.forName(type);
+            }
+            
+            Constructor constructor = cl.getConstructor(
+                    new Class[] { String.class });
+            Object obj = constructor.newInstance(new Object[] { val });
+            con.setAttribute(new ObjectName(name), new Attribute(key, obj));
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Unregister MBean specified by its ObjectName.
+     * 
+     * @param name - A String representation of the MBean's ObjectName.
+     * 
+     * @throws ControllerOperationException - Wraps any actual Exception.
+     */
+    public void unregisterMBean(String name) 
+            throws ControllerOperationException {
+        
+        try {
+            this.con.unregisterMBean(new ObjectName(name));
+        } catch (Exception e) {
+            ControllerOperationException coe = new ControllerOperationException(
+                    getCauseMsg(e));
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /*
+     * 
+     */
+    private String getCauseMsg(Throwable e) {
+        Throwable t = e.getCause();
+        
+        if (t == null) {
+            return e.getMessage();
+        } else {
+            return getCauseMsg(t);
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MBeanOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MLetService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MLetService.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MLetService.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MLetService.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,68 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import java.util.Collections;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class MLetService {
+
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con = null;
+    
+    /**
+     * An ObjectName this MLetService is registered with.
+     */
+    private ObjectName on = null;
+    
+    /**
+     * 
+     * @param con
+     * @param on
+     */
+    public MLetService(MBeanServerConnection con, ObjectName on) {
+        this.con = con;
+        this.on = on;
+    }
+    
+    /**
+     * 
+     * @param url
+     * @return
+     */
+    public Set getMBeansFromURL(String url) {
+        try {
+            return (Set) con.invoke(on, "getMBeansFromURL", 
+                new Object[] { url }, new String[] { String.class.getName() });
+        } catch (Exception e) {
+            return Collections.EMPTY_SET;
+        }
+    }
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MLetService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MonitorService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MonitorService.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MonitorService.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MonitorService.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,51 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class MonitorService {
+
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con = null;
+    
+    /**
+     * An ObjectName this MonitorService is registered with.
+     */
+    private ObjectName on = null;
+ 
+    /**
+     * 
+     * @param con
+     * @param on
+     */
+    public MonitorService(MBeanServerConnection con, ObjectName on) {
+        this.con = con;
+        this.on = on;
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/MonitorService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/NotificationHandler.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/NotificationHandler.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/NotificationHandler.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/NotificationHandler.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,153 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.Notification;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+
+
+/**
+ * Monitor Notifications sent by a specific broadcaster.
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class NotificationHandler implements NotificationListener {
+
+    /**
+     * A collection of broadcasters this listener is currently registered with.
+     */
+    private Hashtable broadcasters;
+    
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con;
+    
+    /**
+     * Cobstruct this object.
+     * 
+     * @param con A reference to MBeanServer.
+     */
+    public NotificationHandler(MBeanServerConnection con) {
+        this.broadcasters = new Hashtable();
+        this.con = con;
+    }
+    
+    /**
+     * Get Notifications of a broadcaster received since 
+     * last call of this method. 
+     * 
+     * @param broadcaster The ObjectName of a broadcaster.
+     * 
+     * @return A List of Notifications.
+     */
+    public Vector getNotifications(String broadcaster) 
+            throws ControllerOperationException {
+        
+        try {
+            ObjectName on = new ObjectName(broadcaster);
+            
+            synchronized (broadcasters) {
+                Vector list = (Vector) broadcasters.get(on);
+                broadcasters.put(on, new Vector());
+                
+                return list;
+            }
+        } catch (MalformedObjectNameException e) {
+            ControllerOperationException coe = 
+                new ControllerOperationException(e.getMessage());
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Store Notification in the collection under its broadcaster's ObjectName. 
+     * 
+     * @see NotificationListener#handleNotification(Notification, Object)
+     */
+    public void handleNotification(Notification not, Object object) {
+        Object on = not.getSource();
+        
+        synchronized (broadcasters) {
+            if (broadcasters.containsKey(on)) {
+                Vector list = (Vector) broadcasters.get(on);
+                list.add(not);
+            }
+        }
+    }
+    
+    /**
+     * Call MBeanServer to add this Listener to the broadcaster whose
+     * ObjectName is specified.
+     * 
+     * @param broadcaster The ObjectName of a broadcaster.
+     * 
+     * @throws ControllerOperationException Wrap any Exception.
+     */
+    public void subscribe(String broadcaster) 
+            throws ControllerOperationException {
+        
+        try {
+            ObjectName on = new ObjectName(broadcaster); 
+            con.addNotificationListener(on, this, null, null);
+            
+            synchronized (broadcasters) {
+                broadcasters.put(on, new Vector());
+            }
+        } catch (Exception e) {
+            ControllerOperationException coe = 
+                new ControllerOperationException(e.getMessage());
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+    
+    /**
+     * Call MBeanServer to remove this Listener from the broadcaster whose
+     * ObjectName is specified.
+     * 
+     * @param broadcaster The ObjectName of a broadcaster. 
+     * 
+     * @throws ControllerOperationException Wrap any Exception.
+     */
+    public void unsubscribe(String broadcaster) 
+            throws ControllerOperationException {
+        
+        try {
+            ObjectName on = new ObjectName(broadcaster); 
+            con.removeNotificationListener(on, this);
+            
+            synchronized (broadcasters) {
+                broadcasters.remove(on);
+            }
+        } catch (Exception e) {
+            ControllerOperationException coe = 
+                new ControllerOperationException(e.getMessage());
+            coe.initCause(e);
+            throw coe;
+        } 
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/NotificationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/OperationInfo.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/OperationInfo.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/OperationInfo.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/OperationInfo.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,135 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * Contains data about MBean operations that may be shown in GUI and
+ * handed back to Controller.
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class OperationInfo {
+
+    /**
+     * Operation's name.
+     */
+    private String name;
+    
+    /**
+     * Operation's parameters.
+     */
+    private String[] params;
+    
+    /**
+     * Operation's signature.
+     */
+    private String[] sign;
+    
+    /**
+     * Operation's return type.
+     */
+    private String returnType;
+    
+    /**
+     * A flag that shows if it's possible to execute an opeartion from GUI 
+     * due to parameter types.
+     */
+    private boolean executable;
+    
+    /**
+     * Construct the Object.
+     * 
+     * @param name - A name of the operation.
+     * @param params - Specific parameter values. They are null wneh data
+     *                 go from Controller to GUI.
+     * @param sign - A signature of the operation.
+     * @param returnType - A return type of the operation.
+     * @param executable - True if this operation may executed from GUI.
+     */
+    public OperationInfo(String name, String[] params, String[] sign,
+            String returnType, boolean executable) {
+        
+        this.name = name;
+        this.params = params;
+        this.sign = sign;
+        this.returnType = returnType;
+        this.executable = executable;
+    }
+    
+    /**
+     * Get operation name.
+     */
+    public String getName() {
+        return this.name;
+    }
+    
+    /**
+     * Get parameters.
+     */
+    public String[] getParams() {
+        return this.params;
+    }
+    
+    /**
+     * Get return type.
+     */
+    public String getReturnType() {
+        return this.returnType;
+    }
+    
+    /**
+     * Get signature.
+     */
+    public String[] getSign() {
+        return this.sign;
+    }
+    
+    /**
+     * Check if this operation may be executed from GUI.
+     */
+    public boolean isExecutable() {
+        return this.executable;
+    }
+    
+    /**
+     * Set parameter values in the existing instance of this class
+     * when data go back to the Controller.
+     * 
+     * @param params - New parameter values.
+     */
+    public void setParams(String[] params) {
+        this.params = params;
+    }
+    
+    /**
+     * Used to show operation data in GUI.
+     */
+    public String toString() {
+        String s = "";
+        
+        for (int i = 0; i < sign.length; i++) {
+            s += sign[i] + ", ";
+        }
+        
+        s = s.substring(0, s.length() - 2);
+        
+        return getReturnType() + " " + getName() + "(" + s + ")";
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/OperationInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/RService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/RService.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/RService.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/RService.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,71 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class RService {
+
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con = null;
+    
+    /**
+     * An ObjectName this MLetService is registered with.
+     */
+    private ObjectName on = null;
+    
+    /**
+     * 
+     * @param con
+     * @param on
+     */
+    public RService(MBeanServerConnection con, ObjectName on) {
+        this.con = con;
+        this.on = on;
+    }
+    
+    public void addRelation() {
+        
+    }
+    
+    public void addRelationType() {
+        
+    }
+    
+    public Object getAllRelations() {
+        return null;
+    }
+    
+    public Object getAllTypes() {
+        return null;
+    }
+    
+    public void removeRelation() {
+        
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/RService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ServiceNotInstalledException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ServiceNotInstalledException.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ServiceNotInstalledException.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ServiceNotInstalledException.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,49 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class ServiceNotInstalledException extends Exception {
+
+    /**
+     * Serial version UID for serialization purposes.
+     */
+    private static final long serialVersionUID = -8316470280820984399L;
+    
+    /**
+     * Construct this object.
+     */
+    public ServiceNotInstalledException() {
+        super();
+    }
+    
+    /**
+     * Construct this object with message. 
+     * 
+     * @param msg The message.
+     */
+    public ServiceNotInstalledException(String msg) {
+        super(msg);
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/ServiceNotInstalledException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Session.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Session.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Session.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Session.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,29 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class Session {
+    
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/Session.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/TimerService.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/TimerService.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/TimerService.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/TimerService.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,51 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.controller;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+
+/**
+ * 
+ *
+ * @author Sergey A. Krivenko
+ * @version $Revision: 1.3 $
+ */
+public class TimerService {
+
+    /**
+     * A reference to MBeanServer.
+     */
+    private MBeanServerConnection con = null;
+    
+    /**
+     * An ObjectName this MLetService is registered with.
+     */
+    private ObjectName on = null;
+    
+    /**
+     * 
+     * @param con
+     * @param on
+     */
+    public TimerService(MBeanServerConnection con, ObjectName on) {
+        this.con = con;
+        this.on = on;
+    }
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/controller/TimerService.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message