geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r558375 - in /geronimo/sandbox/geronimo-netbeans-plugin: ./ nbproject/ src/org/apache/geronimo/netbeans/ src/org/apache/geronimo/netbeans/nodes/ src/org/apache/geronimo/netbeans/resources/ src/org/apache/geronimo/netbeans/wizard/
Date Sat, 21 Jul 2007 19:45:42 GMT
Author: jlaskowski
Date: Sat Jul 21 12:45:41 2007
New Revision: 558375

URL: http://svn.apache.org/viewvc?view=rev&rev=558375
Log:
Register Geronimo with a given home directory

Added:
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
  (with props)
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
  (with props)
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
  (with props)
Modified:
    geronimo/sandbox/geronimo-netbeans-plugin/NOTICE.txt
    geronimo/sandbox/geronimo-netbeans-plugin/nbproject/genfiles.properties
    geronimo/sandbox/geronimo-netbeans-plugin/nbproject/project.xml
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/Bundle.properties
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoDeploymentFactory.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoInstantiatingIterator.java
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/nodes/Bundle.properties
    geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/resources/Bundle.properties

Modified: geronimo/sandbox/geronimo-netbeans-plugin/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/NOTICE.txt?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/NOTICE.txt (original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/NOTICE.txt Sat Jul 21 12:45:41 2007
@@ -1,10 +1,2 @@
-=========================================================================
-==  NOTICE file corresponding to section 4(d) of the Apache License,   ==
-==  Version 2.0, in this case for the Apache Geronimo distribution.    ==
-=========================================================================
-
-Apache Geronimo 
-Copyright 2003-2007 The Apache Software Foundation
-
 This product includes software developed by
 The Apache Software Foundation (http://www.apache.org/).

Modified: geronimo/sandbox/geronimo-netbeans-plugin/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/nbproject/genfiles.properties?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/nbproject/genfiles.properties (original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/nbproject/genfiles.properties Sat Jul 21 12:45:41
2007
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=3ce78166
+build.xml.data.CRC32=6eb541c4
 build.xml.script.CRC32=06cbcef2
 build.xml.stylesheet.CRC32=05353c81
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files
for you.
-nbproject/build-impl.xml.data.CRC32=3ce78166
+nbproject/build-impl.xml.data.CRC32=6eb541c4
 nbproject/build-impl.xml.script.CRC32=47f49d5d
 nbproject/build-impl.xml.stylesheet.CRC32=3f8b4615

Modified: geronimo/sandbox/geronimo-netbeans-plugin/nbproject/project.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/nbproject/project.xml?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/nbproject/project.xml (original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/nbproject/project.xml Sat Jul 21 12:45:41 2007
@@ -7,6 +7,15 @@
             <standalone/>
             <module-dependencies>
                 <dependency>
+                    <code-name-base>org.jdesktop.layout</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.4</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
                     <code-name-base>org.netbeans.modules.j2eeapis</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
@@ -40,6 +49,14 @@
                     <run-dependency>
                         <release-version>1</release-version>
                         <specification-version>1.14</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.awt</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>6.11.0.1</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/Bundle.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/Bundle.properties?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/Bundle.properties
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/Bundle.properties
Sat Jul 21 12:45:41 2007
@@ -1,7 +1,27 @@
+#=====================================================================
+#  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.
+#=====================================================================
+#
+# $Rev$ $Date$
+#
 LBL_DisplayName=Apache Geronimo 2.0
 LBL_FactoryVersion=Deployment Factory for Apache Geronimo 2.0 Plugin 
 
-MSG_InstallerName=Apache Geronimo Installer
+MSG_InstallerName=Apache Geronimo Installer XYZ
 MSG_CreateFailed=Cannot create {0} server instance.
 MSG_GeronimoServerPlatform=Apache Geronimo Platform
-MSG_InvalidUri=Invalid URI: {0}
\ No newline at end of file
+MSG_InvalidUri=Invalid URI: {0}
+MSG_DmInstantiateFailed=Error at Deployment Manager instantiation
\ No newline at end of file

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoDeploymentFactory.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoDeploymentFactory.java?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoDeploymentFactory.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoDeploymentFactory.java
Sat Jul 21 12:45:41 2007
@@ -16,6 +16,15 @@
  */
 package org.apache.geronimo.netbeans;
 
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
 import javax.enterprise.deploy.spi.DeploymentManager;
 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
@@ -28,10 +37,27 @@
 public class GeronimoDeploymentFactory implements DeploymentFactory {
 
     public static final String URI_PREFIX = "deployer:geronimo";
+
+    private static final String DEPLOYMENT_FACTORY_CLASS_NAME = "org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl";
+
+    private static final Logger logger = Logger.getLogger(GeronimoDeploymentFactory.class.getName());
+
+    private static final String DEPLOYER_JAR_PATH = "/bin/deployer.jar";
+
+    private static final String SERVER_JAR_PATH = "/bin/server.jar";
+
+    private static final String DEPLOY_JSR88_PARTIAL_JAR_PATH = "/repository/org/apache/geronimo/modules/geronimo-deploy-jsr88/";
+
     private static DeploymentFactory instance;
 
     /**
-     * Executed by NB when the Geronimo deployment factory is required - when?
+     * Map of a server installation directory to a deployment factory
+     */
+    private Map<String, DeploymentFactory> factories = new HashMap<String, DeploymentFactory>();
+
+
+    /**
+     * Executed by NB when the Geronimo deployment factory is required
      * It's the method pointed out by layer.xml file in Factory.instance
      */
     public static synchronized DeploymentFactory create() {
@@ -46,12 +72,18 @@
         return uri != null && uri.startsWith(URI_PREFIX);
     }
 
-    public DeploymentManager getDeploymentManager(String uri, String username, String password)

-            throws DeploymentManagerCreationException {
+    public DeploymentManager getDeploymentManager(String uri, String username, String password)
throws DeploymentManagerCreationException {
         if (!handlesURI(uri)) {
             String errorMsg = NbBundle.getMessage(GeronimoDeploymentFactory.class, "MSG_InvalidUri",
uri);
             throw new DeploymentManagerCreationException(errorMsg);
         }
+
+        DeploymentFactory df = getFactory(uri);
+        if (df == null) {
+            String errorMsg = NbBundle.getMessage(GeronimoDeploymentFactory.class, "MSG_DmInstantiateFailed",
uri);
+            throw new DeploymentManagerCreationException(errorMsg);
+        }
+
         return new GeronimoDeploymentManager();
     }
 
@@ -65,5 +97,67 @@
 
     public String getProductVersion() {
         return NbBundle.getMessage(GeronimoDeploymentFactory.class, "LBL_FactoryVersion");
+    }
+
+    private DeploymentFactory getFactory(String instanceURL) {
+        DeploymentFactory factory = null;
+        try {
+            String serverDir = "c:/apps/geronimo-tomcat6-jee5-2.0-SNAPSHOT";
+
+            factory = factories.get(serverDir);
+            if (factory == null) {
+                URLClassLoader loader = getGeronimoClassLoader(serverDir);
+                factory = (DeploymentFactory) loader.loadClass(DEPLOYMENT_FACTORY_CLASS_NAME).newInstance();
+                factories.put(serverDir, factory);
+            }
+        } catch (Exception e) {
+            logger.log(Level.WARNING, e.getLocalizedMessage(), e);
+        }
+        return factory;
+    }
+
+    private static URLClassLoader getGeronimoClassLoader(String serverRoot) {
+        URLClassLoader loader = null;
+        try {
+            List<URL> urlList = new ArrayList<URL>();
+            {
+                File[] libs = new File(serverRoot + "/lib").listFiles();
+                for (File lib : libs) {
+                    urlList.add(lib.toURI().toURL());
+                }
+            }
+            urlList.add(new File(serverRoot + DEPLOYER_JAR_PATH).toURI().toURL());
+            urlList.add(new File(serverRoot + SERVER_JAR_PATH).toURI().toURL());
+            // FIXME: Remove the static, hardcoded paths
+            final String geronimo_deploy_config_jar = "/repository/org/apache/geronimo/modules/geronimo-deploy-config/2.0-SNAPSHOT/geronimo-deploy-config-2.0-SNAPSHOT.jar";
+            urlList.add(new File(serverRoot + geronimo_deploy_config_jar).toURI().toURL());
+            final String geronimo_system_jar = "/repository/org/apache/geronimo/modules/geronimo-system/2.0-SNAPSHOT/geronimo-system-2.0-SNAPSHOT.jar";
+            urlList.add(new File(serverRoot + geronimo_system_jar).toURI().toURL());
+            final String commons_logging_jar = "/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar";
+            urlList.add(new File(serverRoot + commons_logging_jar).toURI().toURL());
+            final String geronimo_deploy_jsr88 = "/repository/org/apache/geronimo/modules/geronimo-deploy-jsr88/2.0-SNAPSHOT/geronimo-deploy-jsr88-2.0-SNAPSHOT.jar";
+            urlList.add(new File(serverRoot + geronimo_deploy_jsr88).toURI().toURL());
+            final String geronimo_javaee_deployment_spec_jar = "/repository/org/apache/geronimo/specs/geronimo-javaee-deployment_1.1MR3_spec/1.0-SNAPSHOT/geronimo-javaee-deployment_1.1MR3_spec-1.0-SNAPSHOT.jar";
+            urlList.add(new File(serverRoot + geronimo_javaee_deployment_spec_jar).toURI().toURL());
+            // FIXME: Fix the mess with jar versioning
+            {
+                File[] libs = new File(serverRoot + DEPLOY_JSR88_PARTIAL_JAR_PATH).listFiles();
+                String version = "2.0-M6"; // the latest official version
+                for (File lib : libs) {
+                    URL jsr88DirUrl = lib.toURI().toURL();
+                    urlList.add(jsr88DirUrl);
+                    String[] pathParts = jsr88DirUrl.toString().split("/");
+                    version = pathParts[pathParts.length - 1]; // 2.0-SNAPSHOT
+                }
+                File deployJsr88Jar = new File(serverRoot + DEPLOY_JSR88_PARTIAL_JAR_PATH
+ version + File.separator + "geronimo-deploy-jsr88-" + version + ".jar");
+                if (deployJsr88Jar.exists()) {
+                    urlList.add(deployJsr88Jar.toURI().toURL());
+                }
+            }
+            loader = new URLClassLoader(urlList.toArray(new URL[]{}), GeronimoDeploymentFactory.class.getClassLoader());
+        } catch (Exception e) {
+            logger.log(Level.WARNING, e.getLocalizedMessage(), e);
+        }
+        return loader;
     }
 }

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoInstantiatingIterator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoInstantiatingIterator.java?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoInstantiatingIterator.java
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoInstantiatingIterator.java
Sat Jul 21 12:45:41 2007
@@ -16,30 +16,37 @@
  */
 package org.apache.geronimo.netbeans;
 
-import java.awt.Component;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
 import javax.swing.event.ChangeListener;
+import org.apache.geronimo.netbeans.wizard.GeronimoServerLocationPanel;
 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
 import org.openide.WizardDescriptor;
 import org.openide.WizardDescriptor.Panel;
-import org.openide.util.HelpCtx;
 import org.openide.util.NbBundle;
 
 /**
+ * Iterator for a wizard for registering a new geronimo instance
+ *
  * @version $Rev$ $Date$
  */
-class GeronimoInstantiatingIterator implements WizardDescriptor.InstantiatingIterator {
+public class GeronimoInstantiatingIterator implements WizardDescriptor.InstantiatingIterator
{
 
     private static final String PROP_DISPLAY_NAME = "ServInstWizard_displayName";
+
     private static final Logger logger = Logger.getLogger(GeronimoInstantiatingIterator.class.getName());
 
-    private InstallPanel panel;
+    private List<String> steps = new ArrayList<String>(1);
+    {
+        steps.add(NbBundle.getMessage(GeronimoServerLocationPanel.class, "TXT_SERVER_LOCATION_STEP"));
+    }
+
+    private WizardDescriptor.Panel serverLocationPanel;
     private WizardDescriptor wizard;
 
     public Set instantiate() throws IOException {
@@ -65,12 +72,15 @@
     }
 
     public Panel current() {
-        if (panel == null) {
-            panel = new InstallPanel();
+        if (serverLocationPanel == null) {
+            serverLocationPanel = new GeronimoServerLocationPanel(steps.toArray(new String[steps.size()]),
this);
         }
-        return panel;
+        return serverLocationPanel;
     }
 
+    /**
+     * Probably not used at all
+     */
     public String name() {
         return NbBundle.getMessage(GeronimoInstantiatingIterator.class, "MSG_InstallerName");
     }
@@ -93,34 +103,5 @@
     }
 
     public void removeChangeListener(ChangeListener l) {
-    }
-
-    private static class InstallPanel implements WizardDescriptor.Panel {
-
-        public void removeChangeListener(ChangeListener l) {
-        }
-
-        public void addChangeListener(ChangeListener l) {
-        }
-
-        public void storeSettings(Object settings) {
-        }
-
-        public void readSettings(Object settings) {
-        }
-
-        public boolean isValid() {
-            return true;
-        }
-
-        public HelpCtx getHelp() {
-            return HelpCtx.DEFAULT_HELP;
-        }
-
-        public Component getComponent() {
-            JPanel panel = new JPanel();
-            panel.add(new JLabel("< Put your installation form implementation here! >"));
-            return panel;
-        }
     }
 }

Added: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java?view=auto&rev=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
(added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
Sat Jul 21 12:45:41 2007
@@ -0,0 +1,77 @@
+/**
+ *  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;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoPluginUtils {
+
+    private static List<String> serverRequirements = new LinkedList<String>();
+    static {
+        serverRequirements.add("bin");
+        serverRequirements.add("lib");
+        serverRequirements.add("repository");
+        serverRequirements.add("schema");
+        serverRequirements.add("var");
+        serverRequirements.add("bin/deployer.jar");
+        serverRequirements.add("bin/server.jar");
+        // TODO: Make sure that the version number is verified to ensure the plugin works
with the Geronimo 2.0 version
+        // serverRequirements.add("lib/geronimo-kernel-*.jar");
+        // // used in GeronimoDeploymentFactory
+        // serverRequirements
+        // .add("repository/org/apache/geronimo/modules/geronimo-deploy-jsr88/*/geronimo-deploy-jsr88-*.jar");
+    }
+
+    public static boolean isValidServerLocation(File candidate) {
+        return isValidServerLocation(candidate, serverRequirements);
+    }
+
+    private static boolean isValidServerLocation(File candidate, List<String> requirements)
{
+        if (null == candidate || !candidate.exists() || !candidate.canRead() || !candidate.isDirectory()
|| !hasRequiredChildren(candidate, requirements)) {
+            return false;
+        }
+        return true;
+    }
+
+    private static boolean hasRequiredChildren(File candidate, final List<String> requiredChildren)
{
+        if (null == candidate) {
+            return false;
+        }
+        String[] children = candidate.list();
+        if (null == children) {
+            return false;
+        }
+        if (null == requiredChildren) {
+            return true;
+        }
+        Iterator<String> iter = requiredChildren.iterator();
+        while (iter.hasNext()) {
+            String next = iter.next();
+            File test = new File(candidate.getPath() + File.separator + next);
+            if (!test.exists()) {
+                return false;
+            }
+        }
+        return true;
+    }
+}

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/GeronimoPluginUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/nodes/Bundle.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/nodes/Bundle.properties?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/nodes/Bundle.properties
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/nodes/Bundle.properties
Sat Jul 21 12:45:41 2007
@@ -1,2 +1,21 @@
+#=====================================================================
+#  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.
+#=====================================================================
+#
+# $Rev$ $Date$
+#
 TXT_GeronimoManagerNode=.../nodes/Bundle.properties#TXT_GeronimoManagerNode
 

Modified: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/resources/Bundle.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/resources/Bundle.properties?view=diff&rev=558375&r1=558374&r2=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/resources/Bundle.properties
(original)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/resources/Bundle.properties
Sat Jul 21 12:45:41 2007
@@ -1,4 +1,23 @@
-OpenIDE-Module-Name=Apache Geronimo plugin for NetBeans IDE
+#=====================================================================
+#  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.
+#=====================================================================
+#
+# $Rev$ $Date$
+#
+OpenIDE-Module-Name=NetBeans plugin for Apache Geronimo
 OpenIDE-Module-Display-Category=Java EE
 OpenIDE-Module-Short-Description=Geronimo NetBeans Plugin
 OpenIDE-Module-Long-Description=\

Added: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties?view=auto&rev=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
(added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
Sat Jul 21 12:45:41 2007
@@ -0,0 +1,26 @@
+#=====================================================================
+#  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.
+#=====================================================================
+#
+# $Rev$ $Date$
+#
+TXT_SERVER_LOCATION_STEP=Server Location
+LBL_SERVER_LOCATION=Server Location:
+LBL_BROWSE_BUTTON=Br&owse...
+ACSD_locationBrowseButton=Browse for the server location
+ACSD_locationField=Server Location
+DIRECTORIES_FILTER_NAME=Directories
+ERR_InvalidServerLocation=The entered installation directory is not a valid Geronimo 2.0
directory
\ No newline at end of file

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/Bundle.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java?view=auto&rev=558375
==============================================================================
--- geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
(added)
+++ geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
Sat Jul 21 12:45:41 2007
@@ -0,0 +1,247 @@
+/**
+ *  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.wizard;
+
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.filechooser.FileFilter;
+import org.apache.geronimo.netbeans.GeronimoInstantiatingIterator;
+import org.apache.geronimo.netbeans.GeronimoPluginUtils;
+import org.openide.WizardDescriptor;
+import org.openide.util.HelpCtx;
+import org.openide.util.NbBundle;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GeronimoServerLocationPanel extends JPanel implements WizardDescriptor.Panel
{
+
+    /**
+     * If it contains non-null value the String is displayed the bottom of the wizard
+     * and should inform user why the panel is invalid and why the Next/Finish
+     * buttons were disabled.
+     *
+     * Copied over form {@link org.openide.WizardDescriptor}
+     * @see http://www.netbeans.org/download/dev/javadoc/org-openide-dialogs/org/openide/doc-files/wizard-guidebook.html
+     */
+    private static final String PROP_ERROR_MESSAGE = "WizardPanel_errorMessage";
+
+    /**
+     * Represents array of content items.
+     *
+     * (Copied over from {@link org.openide.WizardDescriptor}
+     */
+    private static final String PROP_CONTENT_DATA = "WizardPanel_contentData";
+
+    private static final String PROP_CONTENT_SELECTED_INDEX = "WizardPanel_contentSelectedIndex";
+
+    private GeronimoInstantiatingIterator instantiatingIterator;
+
+    private transient WizardDescriptor wizardDescriptor;
+
+    private transient Set<ChangeListener> listeners = new HashSet<ChangeListener>();
+
+    private final JTextField locationField = new JTextField();
+
+    public GeronimoServerLocationPanel(String[] steps, GeronimoInstantiatingIterator instantiatingIterator)
{
+        super();
+        this.instantiatingIterator = instantiatingIterator;
+
+        int selectedIndex = 0;
+
+        putClientProperty(PROP_CONTENT_DATA, steps);
+        putClientProperty(PROP_CONTENT_SELECTED_INDEX, selectedIndex);
+
+        setName(steps[selectedIndex]);
+
+        init();
+    }
+
+    public Component getComponent() {
+        return this;
+    }
+
+    public HelpCtx getHelp() {
+        // Show no Help button for this panel:
+        return HelpCtx.DEFAULT_HELP;
+        // If you have context help:
+        // return new HelpCtx(GeronimoServerLocationPanel.class);
+        // or
+        // return new HelpCtx("j2eeplugins_registering_app_server_geronimo_location");
+    }
+
+    /**
+     * Test whether the panel is finished and it is safe to proceed to the next one.
+     */
+    @Override
+    public boolean isValid() {
+        wizardDescriptor.putProperty(PROP_ERROR_MESSAGE, null);
+
+        File serverLocation = new File(locationField.getText());
+
+        if (!GeronimoPluginUtils.isValidServerLocation(serverLocation)) {
+            String msg = NbBundle.getMessage(GeronimoServerLocationPanel.class, "ERR_InvalidServerLocation");
+            wizardDescriptor.putProperty(PROP_ERROR_MESSAGE, msg);
+            return false;
+        }
+        return true;
+    }
+
+    public void readSettings(Object settings) {
+        this.wizardDescriptor = (WizardDescriptor) settings;
+    }
+
+    public void storeSettings(Object settings) {
+    }
+
+    public void addChangeListener(ChangeListener listener) {
+        synchronized (listeners) {
+            listeners.add(listener);
+        }
+    }
+
+    public void removeChangeListener(ChangeListener listener) {
+        if (listeners != null) {
+            synchronized (listeners) {
+                listeners.remove(listener);
+            }
+        }
+    }
+
+    /**
+     * Initializes the panel
+     */
+    private void init() {
+        final JLabel locationLabel = new JLabel();
+        final JButton locationBrowseButton = new JButton();
+        final JPanel formattingPanel = new JPanel();
+
+        GridBagConstraints gridBagConstraints;
+
+        setLayout(new GridBagLayout());
+
+        locationLabel.setText(NbBundle.getMessage(GeronimoServerLocationPanel.class, "LBL_SERVER_LOCATION"));
// NOI18N
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.anchor = GridBagConstraints.EAST;
+        locationLabel.setLabelFor(locationField);
+        add(locationLabel, gridBagConstraints);
+
+        locationField.setColumns(15);
+        locationField.addKeyListener(new KeyAdapter() {
+
+            public void keyTyped(KeyEvent event) {
+                fireChangeEvent();
+            }
+
+            public void keyReleased(KeyEvent event) {
+                fireChangeEvent();
+            }
+        });
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 1;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.insets = new Insets(0, 10, 0, 10);
+        locationField.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(GeronimoServerLocationPanel.class,
"ACSD_locationField")); // NOI18N
+        add(locationField, gridBagConstraints);
+
+        // add server installation directory field browse button
+        org.openide.awt.Mnemonics.setLocalizedText(locationBrowseButton, NbBundle.getMessage(GeronimoServerLocationPanel.class,
"LBL_BROWSE_BUTTON"));
+        locationBrowseButton.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent event) {
+                JFileChooser fileChooser = new JFileChooser();
+
+                fileChooser.setFileFilter(new FileFilter() {
+
+                    public boolean accept(File file) {
+                        if (file.exists() && file.isDirectory()) {
+                            return true;
+                        }
+                        return false;
+                    }
+
+                    public String getDescription() {
+                        return NbBundle.getMessage(GeronimoServerLocationPanel.class, "DIRECTORIES_FILTER_NAME");
// NOI18N
+                    }
+                });
+                fileChooser.setMultiSelectionEnabled(false);
+                fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+                File currentLocation = new File(locationField.getText());
+                if (currentLocation.exists() && currentLocation.isDirectory()) {
+                    fileChooser.setCurrentDirectory(currentLocation.getParentFile());
+                    fileChooser.setSelectedFile(currentLocation);
+                }
+
+                if (fileChooser.showOpenDialog(GeronimoServerLocationPanel.this) == JFileChooser.APPROVE_OPTION)
{
+                    locationField.setText(fileChooser.getSelectedFile().getPath());
+                    fireChangeEvent();
+                }
+            }
+        });
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 2;
+        gridBagConstraints.gridy = 0;
+        gridBagConstraints.anchor = GridBagConstraints.WEST;
+        locationBrowseButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(GeronimoServerLocationPanel.class,
"ACSD_locationBrowseButton")); // NOI18N
+        add(locationBrowseButton, gridBagConstraints);
+
+        // add the empty panel, that will take up all the remaining space
+        gridBagConstraints = new GridBagConstraints();
+        gridBagConstraints.gridx = 0;
+        gridBagConstraints.gridy = 1;
+        gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
+        gridBagConstraints.weighty = 1.0;
+        add(formattingPanel, gridBagConstraints);
+    }
+
+    private void fireChangeEvent() {
+        ChangeEvent event = new ChangeEvent(this);
+        fireChangeEvent(event);
+    }
+
+    private void fireChangeEvent(ChangeEvent event) {
+        Iterator<ChangeListener> it;
+        synchronized (listeners) {
+            it = new HashSet<ChangeListener>(listeners).iterator();
+        }
+        while (it.hasNext()) {
+            it.next().stateChanged(event);
+        }
+    }
+}

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/geronimo-netbeans-plugin/src/org/apache/geronimo/netbeans/wizard/GeronimoServerLocationPanel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message