geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r553025 - in /geronimo/sandbox/geronimo-netbeans-plugin/src/main: java/org/apache/geronimo/netbeans/nodes/ resources/org/apache/geronimo/netbeans/
Date Wed, 04 Jul 2007 00:12:20 GMT
Author: jlaskowski
Date: Tue Jul  3 17:12:18 2007
New Revision: 553025

URL: http://svn.apache.org/viewvc?view=rev&rev=553025
Log:
List applications, ejbs, wars and servlets as nodes (ejbs may not work properly yet)

Modified:
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletsChildren.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebApplicationsChildren.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebModuleNode.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/main/resources/org/apache/geronimo/netbeans/Bundle.properties

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationNode.java
Tue Jul  3 17:12:18 2007
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
 import java.awt.Image;
@@ -12,14 +28,14 @@
 import org.openide.util.actions.SystemAction;
 
 /**
- * Node which describes enterprise application.
+ * @version $Rev$ $Date$
  */
 public class GeronimoEarApplicationNode extends AbstractNode {
 
-    public GeronimoEarApplicationNode(String fileName, Lookup lookup) {
-        super(new GeronimoEarModulesChildren(lookup, fileName));
-        setDisplayName(fileName.substring(0, fileName.indexOf('.')));
-        getCookieSet().add(new UndeployModuleCookieImpl(fileName, ModuleType.EAR, lookup));
+    public GeronimoEarApplicationNode(String name, Lookup lookup) {
+        super(new GeronimoEarModulesChildren(lookup, name));
+        setDisplayName(name);
+        getCookieSet().add(new UndeployModuleCookieImpl(name, ModuleType.EAR, lookup));
     }
 
     public Action[] getActions(boolean context) {

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarApplicationsChildren.java
Tue Jul  3 17:12:18 2007
@@ -1,14 +1,33 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
-import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.management.MBeanServerConnection;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.QueryExp;
 
 import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
 import org.openide.nodes.Children;
@@ -17,13 +36,11 @@
 import org.openide.util.RequestProcessor;
 
 /**
- * It describes children nodes of the EJB Modules node. Implements Refreshable interface
and due to it can be refreshed
- * via ResreshModulesAction.
+ * @version $Rev$ $Date$
  */
 public class GeronimoEarApplicationsChildren extends Children.Keys implements Refreshable
{
 
     private Lookup lookup;
-    private Boolean remoteManagementSupported = null;
 
     GeronimoEarApplicationsChildren(Lookup lookup) {
         this.lookup = lookup;
@@ -33,33 +50,19 @@
         setKeys(new Object[] { Util.WAIT_NODE });
 
         RequestProcessor.getDefault().post(new Runnable() {
-            Vector keys = new Vector();
-
             public void run() {
+                List<GeronimoEarApplicationNode> keys = new ArrayList<GeronimoEarApplicationNode>();
                 try {
-                    ObjectName searchPattern;
-                    String propertyName;
-                    if (isRemoteManagementSupported()) {
-                        searchPattern = new ObjectName("geronimo.management.local:j2eeType=J2EEApplication,*");
// NOI18N
-                        propertyName = "name"; // NOI18N
-                    } else {
-                        searchPattern = new ObjectName("geronimo.j2ee:service=EARDeployment,*");
// NOI18N
-                        propertyName = "url"; // NOI18N
-                    }
-                    Object server = Util.getRMIServer(lookup);
-                    Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
-                            new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
-                            new Object[] { searchPattern, null });
+                    ObjectName searchPattern = new ObjectName("geronimo:j2eeType=J2EEApplication,*");
 
-                    Iterator it = managedObj.iterator();
+                    MBeanServerConnection server = Util.getRMIServer(lookup);
+                    Set<ObjectInstance> managedObjSet = (Set<ObjectInstance>)
server.queryMBeans(searchPattern, null);
 
+                    Iterator<ObjectInstance> it = managedObjSet.iterator();
                     while (it.hasNext()) {
                         try {
-                            ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
-                            String name = elem.getKeyProperty(propertyName);
-
-                            name = name.substring(1, name.length() - 1);
-
+                            ObjectName ear = it.next().getObjectName();
+                            String name = ear.getKeyProperty("name");
                             keys.add(new GeronimoEarApplicationNode(name, lookup));
                         } catch (Exception e) {
                             Logger.getLogger("global").log(Level.INFO, null, e);
@@ -68,7 +71,11 @@
                 } catch (Exception e) {
                     Logger.getLogger("global").log(Level.INFO, null, e);
                 }
-
+                Collections.sort(keys, new Comparator<GeronimoEarApplicationNode>()
{
+                    public int compare(GeronimoEarApplicationNode node1, GeronimoEarApplicationNode
node2) {
+                        return node1.getDisplayName().compareTo(node2.getDisplayName());
+                    }
+                });
                 setKeys(keys);
             }
         }, 0);
@@ -93,12 +100,5 @@
         }
 
         return null;
-    }
-
-    private boolean isRemoteManagementSupported() {
-        if (remoteManagementSupported == null) {
-            remoteManagementSupported = Util.isRemoteManagementSupported(lookup);
-        }
-        return remoteManagementSupported;
     }
 }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEarModulesChildren.java
Tue Jul  3 17:12:18 2007
@@ -1,25 +1,47 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
-import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.management.MBeanServerConnection;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.QueryExp;
 
 import org.apache.geronimo.netbeans.GeronimoDeploymentManager;
+import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
+import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
 import org.openide.util.Lookup;
 import org.openide.util.RequestProcessor;
 
 /**
- * It describes children nodes of the enterprise application node.
+ * @version $Rev$ $Date$
  */
-public class GeronimoEarModulesChildren extends Children.Keys {
+public class GeronimoEarModulesChildren extends Children.Keys implements Refreshable {
 
     private Lookup lookup;
     private String j2eeAppName;
@@ -33,33 +55,32 @@
         setKeys(new Object[] { Util.WAIT_NODE });
 
         RequestProcessor.getDefault().post(new Runnable() {
-            Vector keys = new Vector();
-            GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup.lookup(GeronimoDeploymentManager.class);
-
             public void run() {
+                List<AbstractNode> keys = new ArrayList<AbstractNode>();
+
                 try {
-                    Object server = Util.getRMIServer(lookup);
-                    ObjectName searchPattern = new ObjectName("geronimo.management.local:J2EEApplication="
-                            + j2eeAppName + ",*");
-                    Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
-                            new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
-                            new Object[] { searchPattern, null });
+                    ObjectName searchPattern = new ObjectName("geronimo:J2EEApplication="
+ j2eeAppName + ",*");
 
-                    Iterator it = managedObj.iterator();
+                    MBeanServerConnection server = Util.getRMIServer(lookup);
+                    Set<ObjectInstance> managedObjSet = (Set<ObjectInstance>)
server.queryMBeans(searchPattern, null);
+
+                    Iterator<ObjectInstance> it = managedObjSet.iterator();
+
+                    GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup
+                            .lookup(GeronimoDeploymentManager.class);
 
-                    // Query results processing
                     while (it.hasNext()) {
                         try {
-                            ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
-                            String name = elem.getKeyProperty("name");
+                            ObjectName module = it.next().getObjectName();
 
-                            if (elem.getKeyProperty("j2eeType").equals("EJBModule"))
+                            if (module.getKeyProperty("j2eeType").equals("EJBModule")) {
+                                String name = module.getKeyProperty("name");
                                 keys.add(new GeronimoEjbModuleNode(name, lookup));
-                            else if (elem.getKeyProperty("j2eeType").equals("WebModule"))
{
-                                String url = "http://" + dm.getHost() + ":" + dm.getPort();
-                                String context = "FIXME - GeronimoEarModulesChildren";
-                                keys.add(new GeronimoWebModuleNode(name, lookup, (context
== null) ? null : url
-                                        + context));
+                            } else if (module.getKeyProperty("j2eeType").equals("WebModule"))
{
+                                // FIXME: Copied over from GeronimoWebModuleNode - unified
it
+                                String url = ((URL) Util.getMBeanParameter(dm, "URLFor",
module)).toString();
+                                String contextPath = (String) Util.getMBeanParameter(dm,
"contextPath", module);
+                                keys.add(new GeronimoWebModuleNode(contextPath, module.toString(),
lookup, url));
                             }
                         } catch (Exception e) {
                             Logger.getLogger("global").log(Level.INFO, null, e);
@@ -68,7 +89,11 @@
                 } catch (Exception e) {
                     Logger.getLogger("global").log(Level.INFO, null, e);
                 }
-
+                Collections.sort(keys, new Comparator<AbstractNode>() {
+                    public int compare(AbstractNode node1, AbstractNode node2) {
+                        return node1.getDisplayName().compareTo(node2.getDisplayName());
+                    }
+                });
                 setKeys(keys);
             }
         }, 0);

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModuleNode.java
Tue Jul  3 17:12:18 2007
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
 import java.awt.Image;
@@ -13,21 +29,21 @@
 import org.openide.util.actions.SystemAction;
 
 /**
- * Node which describes Web Module.
+ * @version $Rev$ $Date$
  */
 public class GeronimoEjbModuleNode extends AbstractNode {
 
-    public GeronimoEjbModuleNode(String fileName, Lookup lookup) {
-        this(fileName, lookup, false);
+    public GeronimoEjbModuleNode(String name, Lookup lookup) {
+        this(name, lookup, false);
     }
 
-    public GeronimoEjbModuleNode(String fileName, Lookup lookup, boolean isEJB3) {
+    public GeronimoEjbModuleNode(String name, Lookup lookup, boolean isEJB3) {
         super(Children.LEAF);
-        setDisplayName(fileName.substring(0, fileName.indexOf('.')));
+        setDisplayName(name);
         if (isEJB3) {
-            getCookieSet().add(new UndeployModuleCookieImpl(fileName, lookup));
+            getCookieSet().add(new UndeployModuleCookieImpl(name, lookup));
         } else {
-            getCookieSet().add(new UndeployModuleCookieImpl(fileName, ModuleType.EJB, lookup));
+            getCookieSet().add(new UndeployModuleCookieImpl(name, ModuleType.EJB, lookup));
         }
     }
 

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoEjbModulesChildren.java
Tue Jul  3 17:12:18 2007
@@ -1,16 +1,36 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.management.MBeanServerConnection;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.QueryExp;
 
+import org.apache.geronimo.netbeans.GeronimoDeploymentManager;
 import org.apache.geronimo.netbeans.nodes.actions.Refreshable;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
@@ -18,13 +38,11 @@
 import org.openide.util.RequestProcessor;
 
 /**
- * It describes children nodes of the EJB Modules node. Implements Refreshable interface
and due to it can be refreshed
- * via ResreshModulesAction.
+ * @version $Rev$ $Date$
  */
 public class GeronimoEjbModulesChildren extends Children.Keys implements Refreshable {
 
     private Lookup lookup;
-    private Boolean remoteManagementSupported = null;
 
     public GeronimoEjbModulesChildren(Lookup lookup) {
         this.lookup = lookup;
@@ -35,70 +53,42 @@
 
         RequestProcessor.getDefault().post(new Runnable() {
             public void run() {
-                List keys = new LinkedList();
-                Object server = Util.getRMIServer(lookup);
-                addEjbModules(server, keys);
-                addEJB3Modules(server, keys);
-
-                setKeys(keys);
-            }
-        }, 0);
-
-    }
-
-    private void addEjbModules(Object server, List keys) {
-
-        try {
-            String propertyName;
-            Object searchPattern;
-            if (isRemoteManagementSupported()) {
-                propertyName = "name"; // NOI18N
-                searchPattern = new ObjectName("geronimo.management.local:j2eeType=EJBModule,J2EEApplication=null,*");
// NOI18N
-            } else {
-                propertyName = "module"; // NOI18N
-                searchPattern = new ObjectName("geronimo.j2ee:service=EjbModule,*"); // NOI18N
-            }
-            Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
-                    new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
-                    new Object[] { searchPattern, null }); // NOI18N
-
-            Iterator it = managedObj.iterator();
-
-            // Query results processing
-            while (it.hasNext()) {
-                ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
-                String name = elem.getKeyProperty(propertyName);
-                keys.add(new GeronimoEjbModuleNode(name, lookup));
-            }
-
-        } catch (Exception e) {
-            Logger.getLogger("global").log(Level.INFO, null, e);
-        }
-    }
-
-    private void addEJB3Modules(Object server, List keys) {
+                List<GeronimoEjbModuleNode> keys = new ArrayList<GeronimoEjbModuleNode>();
+                try {
+                    ObjectName searchPattern = new ObjectName("geronimo:j2eeType=EJBModule,J2EEApplication=null,*");
 
-        try {
-            ObjectName searchPattern = new ObjectName("geronimo.j2ee:service=EJB3,*"); //
NOI18N
-            Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
-                    new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
-                    new Object[] { searchPattern, null }); // NOI18N
+                    MBeanServerConnection server = Util.getRMIServer(lookup);
+                    Set<ObjectInstance> managedObjSet = (Set<ObjectInstance>)
server.queryMBeans(searchPattern, null);
 
-            Iterator it = managedObj.iterator();
+                    Iterator<ObjectInstance> it = managedObjSet.iterator();
 
-            // Query results processing
-            while (it.hasNext()) {
-                try {
-                    ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
-                    String name = elem.getKeyProperty("module"); // NOI18N
-                    keys.add(new GeronimoEjbModuleNode(name, lookup, true));
-                } catch (Exception e) {
-                    Logger.getLogger("global").log(Level.INFO, null, e);
+                    GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup
+                            .lookup(GeronimoDeploymentManager.class);
+
+                    while (it.hasNext()) {
+                        try {
+                            // FIXME: Deploy EJB and find out what the necessary parameters
are
+                            ObjectName webModule = it.next().getObjectName();
+                            String name = (String) Util.getMBeanParameter(dm, "WARName",
webModule);
+                            String url = ((URL) Util.getMBeanParameter(dm, "URLFor", webModule)).toString();
+                            String context = (String) Util.getMBeanParameter(dm, "contextPath",
webModule);
+                            keys.add(new GeronimoEjbModuleNode(name, lookup));
+                        } catch (Exception ex) {
+                            Logger.getLogger("global").log(Level.INFO, null, ex);
+                        }
+                    }
+                } catch (Exception ex) {
+                    Logger.getLogger("global").log(Level.INFO, null, ex);
                 }
+                Collections.sort(keys, new Comparator<GeronimoEjbModuleNode>() {
+                    public int compare(GeronimoEjbModuleNode node1, GeronimoEjbModuleNode
node2) {
+                        return node1.getDisplayName().compareTo(node2.getDisplayName());
+                    }
+                });
+                setKeys(keys);
             }
-        } catch (Exception e) {
-            Logger.getLogger("global").log(Level.INFO, null, e);
-        }
+        }, 0);
+
     }
 
     protected void addNotify() {
@@ -119,12 +109,5 @@
         }
 
         return null;
-    }
-
-    private boolean isRemoteManagementSupported() {
-        if (remoteManagementSupported == null) {
-            remoteManagementSupported = Util.isRemoteManagementSupported(lookup);
-        }
-        return remoteManagementSupported;
     }
 }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletNode.java
Tue Jul  3 17:12:18 2007
@@ -1,6 +1,7 @@
 package org.apache.geronimo.netbeans.nodes;
 
 import javax.swing.Action;
+
 import org.openide.nodes.AbstractNode;
 import org.openide.nodes.Children;
 import org.openide.util.actions.SystemAction;
@@ -12,6 +13,7 @@
         setIconBaseWithExtension("org/apache/geronimo/netbeans/resources/Object.gif"); //
NOI18N
     }
 
+    // FIXME: Add run me action
     public Action[] getActions(boolean context) {
         return new SystemAction[] {};
     }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletsChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletsChildren.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletsChildren.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoServletsChildren.java
Tue Jul  3 17:12:18 2007
@@ -1,78 +1,85 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
-import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
-import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.management.MalformedObjectNameException;
+import javax.management.MBeanServerConnection;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.QueryExp;
 
-import org.openide.nodes.AbstractNode;
+import org.apache.geronimo.netbeans.GeronimoDeploymentManager;
 import org.openide.nodes.Children;
 import org.openide.nodes.Node;
 import org.openide.util.Lookup;
-import org.openide.util.NbBundle;
 import org.openide.util.RequestProcessor;
 
 /**
- * It describes children nodes of the Web Module node.
+ * @version $Rev$ $Date$
  */
 public class GeronimoServletsChildren extends Children.Keys {
 
-    private static final String WAIT_NODE = "wait_node"; // NOI18N
-
-    private String name;
+    private String webModuleObjectName;
     private Lookup lookup;
 
-    GeronimoServletsChildren(String name, Lookup lookup) {
+    GeronimoServletsChildren(String webModuleObjectName, Lookup lookup) {
         this.lookup = lookup;
-        this.name = name;
+        this.webModuleObjectName = webModuleObjectName;
     }
 
     public void updateKeys() {
-        setKeys(new Object[] { WAIT_NODE });
+        setKeys(new Object[] { Util.WAIT_NODE });
 
         RequestProcessor.getDefault().post(new Runnable() {
-            Vector keys = new Vector();
-
             public void run() {
+                List<GeronimoServletNode> keys = new ArrayList<GeronimoServletNode>();
                 try {
-                    Object server = Util.getRMIServer(lookup);
-                    ObjectName searchPattern = new ObjectName("geronimo.management.local:WebModule="
+ name
-                            + ",j2eeType=Servlet,*");
-                    Set managedObj = (Set) server.getClass().getMethod("queryMBeans",
-                            new Class[] { ObjectName.class, QueryExp.class }).invoke(server,
-                            new Object[] { searchPattern, null });
-
-                    Iterator it = managedObj.iterator();
-
-                    // Query results processing
-                    while (it.hasNext()) {
-                        ObjectName elem = ((ObjectInstance) it.next()).getObjectName();
-                        String s = elem.getKeyProperty("name");
-                        throw new IllegalArgumentException("TODO");
+                    ObjectName searchPattern = new ObjectName(webModuleObjectName);
+                    MBeanServerConnection server = Util.getRMIServer(lookup);
+                    Set<ObjectInstance> managedObjSet = (Set<ObjectInstance>)
server.queryMBeans(searchPattern, null);
+
+                    GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup
+                            .lookup(GeronimoDeploymentManager.class);
+
+                    Iterator<ObjectInstance> it = managedObjSet.iterator();
+                    if (it.hasNext()) {
+                        ObjectName webModule = it.next().getObjectName();
+                        String[] servlets = (String[]) Util.getMBeanParameter(dm, "servlets",
webModule);
+                        for (String servletName : servlets) {
+                            ObjectName servletNameObjectName = new ObjectName(servletName);
+                            String name = servletNameObjectName.getKeyProperty("name");
+                            keys.add(new GeronimoServletNode(name));
+                        }
                     }
-                } catch (MalformedObjectNameException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (NullPointerException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (IllegalArgumentException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (SecurityException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (InvocationTargetException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (IllegalAccessException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
-                } catch (NoSuchMethodException ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex.getMessage());
+                } catch (Exception ex) {
+                    Logger.getLogger("global").log(Level.INFO, ex.getLocalizedMessage(),
ex);
                 }
-
+                Collections.sort(keys, new Comparator<GeronimoServletNode>() {
+                    public int compare(GeronimoServletNode node1, GeronimoServletNode node2)
{
+                        return node1.getDisplayName().compareTo(node2.getDisplayName());
+                    }
+                });
                 setKeys(keys);
             }
         }, 0);
@@ -91,21 +98,10 @@
             return new Node[] { (GeronimoServletNode) key };
         }
 
-        if (key instanceof String && key.equals(WAIT_NODE)) {
-            return new Node[] { createWaitNode() };
+        if (key instanceof String && key.equals(Util.WAIT_NODE)) {
+            return new Node[] { Util.createWaitNode() };
         }
 
         return null;
-    }
-
-    /*
-     * Creates and returns the instance of the node representing the status 'WAIT' of the
node. It is used when it spent
-     * more time to create elements hierarchy. @return the wait node.
-     */
-    private Node createWaitNode() {
-        AbstractNode n = new AbstractNode(Children.LEAF);
-        n.setName(NbBundle.getMessage(GeronimoApplicationsChildren.class, "LBL_WaitNode_DisplayName"));
// NOI18N
-        n.setIconBaseWithExtension("org/openide/src/resources/wait.gif"); // NOI18N
-        return n;
     }
 }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebApplicationsChildren.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebApplicationsChildren.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebApplicationsChildren.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebApplicationsChildren.java
Tue Jul  3 17:12:18 2007
@@ -1,3 +1,19 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.geronimo.netbeans.nodes;
 
 import java.net.URL;
@@ -22,13 +38,11 @@
 import org.openide.util.RequestProcessor;
 
 /**
- * It describes children nodes of the Web Applications node. Implements Refreshable interface
and due to it can be
- * refreshed via ResreshModulesAction.
+ * @version $Rev$ $Date$
  */
 public class GeronimoWebApplicationsChildren extends Children.Keys implements Refreshable
{
 
     private Lookup lookup;
-    private Boolean remoteManagementSupported = null;
 
     public GeronimoWebApplicationsChildren(Lookup lookup) {
         this.lookup = lookup;
@@ -38,33 +52,30 @@
         setKeys(new Object[] { Util.WAIT_NODE });
 
         RequestProcessor.getDefault().post(new Runnable() {
-            List<GeronimoWebModuleNode> keys = new ArrayList<GeronimoWebModuleNode>();
-
             public void run() {
+                List<GeronimoWebModuleNode> keys = new ArrayList<GeronimoWebModuleNode>();
                 try {
                     ObjectName searchPattern = new ObjectName("geronimo:j2eeType=WebModule,J2EEApplication=null,*");
 
                     MBeanServerConnection server = Util.getRMIServer(lookup);
                     Set<ObjectInstance> managedObjSet = (Set<ObjectInstance>)
server.queryMBeans(searchPattern, null);
 
-                    Iterator<ObjectInstance> it = managedObjSet.iterator();
-
                     GeronimoDeploymentManager dm = (GeronimoDeploymentManager) lookup
                             .lookup(GeronimoDeploymentManager.class);
 
+                    Iterator<ObjectInstance> it = managedObjSet.iterator();
                     while (it.hasNext()) {
                         try {
                             ObjectName webModule = it.next().getObjectName();
-                            String name = (String) Util.getMBeanParameter(dm, "WARName",
webModule);
                             String url = ((URL) Util.getMBeanParameter(dm, "URLFor", webModule)).toString();
-                            String context = (String) Util.getMBeanParameter(dm, "contextPath",
webModule);
-                            keys.add(new GeronimoWebModuleNode(context, lookup, url));
+                            String contextPath = (String) Util.getMBeanParameter(dm, "contextPath",
webModule);
+                            keys.add(new GeronimoWebModuleNode(contextPath, webModule.toString(),
lookup, url));
                         } catch (Exception ex) {
-                            Logger.getLogger("global").log(Level.INFO, null, ex);
+                            Logger.getLogger("global").log(Level.INFO, ex.getLocalizedMessage(),
ex);
                         }
                     }
                 } catch (Exception ex) {
-                    Logger.getLogger("global").log(Level.INFO, null, ex);
+                    Logger.getLogger("global").log(Level.INFO, ex.getLocalizedMessage(),
ex);
                 }
                 Collections.sort(keys, new Comparator<GeronimoWebModuleNode>() {
                     public int compare(GeronimoWebModuleNode node1, GeronimoWebModuleNode
node2) {
@@ -94,12 +105,5 @@
         }
 
         return null;
-    }
-
-    private boolean isRemoteManagementSupported() {
-        if (remoteManagementSupported == null) {
-            remoteManagementSupported = Util.isRemoteManagementSupported(lookup);
-        }
-        return remoteManagementSupported;
     }
 }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebModuleNode.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebModuleNode.java?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebModuleNode.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/java/org/apache/geronimo/netbeans/nodes/GeronimoWebModuleNode.java
Tue Jul  3 17:12:18 2007
@@ -30,24 +30,15 @@
 import org.openide.util.actions.SystemAction;
 
 /**
- * Node which describes Web Module.
- * 
  * @version $Rev$ $Date$
  */
 public class GeronimoWebModuleNode extends AbstractNode {
 
-    final boolean isRemoteManagementSupported;
-
-    public GeronimoWebModuleNode(String name, Lookup lookup, String url) {
-        super(new GeronimoServletsChildren(name, lookup));
-        setDisplayName(name);
-        isRemoteManagementSupported = Util.isRemoteManagementSupported(lookup);
-        if (isRemoteManagementSupported) {
-            // we cannot find out the .war name w/o the management support, thus
-            // we cannot enable the Undeploy action
-            getCookieSet().add(new UndeployModuleCookieImpl(name, ModuleType.WAR, lookup));
-        }
-
+    // FIXME: Add ObjectName support in addition to stringified ObjectName
+    public GeronimoWebModuleNode(String contextPath, String objectName, Lookup lookup, String
url) {
+        super(new GeronimoServletsChildren(objectName, lookup));
+        setDisplayName(contextPath);
+        getCookieSet().add(new UndeployModuleCookieImpl(objectName, ModuleType.WAR, lookup));
         if (url != null)
             getCookieSet().add(new OpenURLActionCookieImpl(url));
     }
@@ -56,14 +47,8 @@
         if (getParentNode() instanceof GeronimoEarApplicationNode) {
             return new SystemAction[] { SystemAction.get(OpenURLAction.class) };
         } else {
-            if (isRemoteManagementSupported) {
-                return new SystemAction[] { SystemAction.get(OpenURLAction.class),
-                        SystemAction.get(UndeployModuleAction.class) };
-            } else {
-                // we cannot find out the .war name w/o the management support,
-                // thus we cannot enable the Undeploy action
-                return new SystemAction[] { SystemAction.get(OpenURLAction.class), };
-            }
+            return new SystemAction[] { SystemAction.get(OpenURLAction.class),
+                    SystemAction.get(UndeployModuleAction.class) };
         }
     }
 

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/main/resources/org/apache/geronimo/netbeans/Bundle.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/main/resources/org/apache/geronimo/netbeans/Bundle.properties?view=diff&rev=553025&r1=553024&r2=553025
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/main/resources/org/apache/geronimo/netbeans/Bundle.properties
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/main/resources/org/apache/geronimo/netbeans/Bundle.properties
Tue Jul  3 17:12:18 2007
@@ -1,5 +1,5 @@
-LBL_DisplayName=Apache Geronimo 2.0
-LBL_FactoryVersion=Deployment Factory for Apache Geronimo 2.0 Plugin 
+LBL_DisplayName=Apache Geronimo 2
+LBL_FactoryVersion=Deployment Factory for Apache Geronimo 2 Plugin 
 
 MSG_DEPLOYING=Deploying {0}
 MSG_Waiting_For_Url=Waiting for server to start the module {0}



Mime
View raw message