[jboss-svn-commits] JBL Code SVN: r13587 - in labs/jbossesb/trunk/product/tools: esbwizard/META-INF and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 17 17:19:11 EDT 2007
Author: kevin.conner at jboss.com
Date: 2007-07-17 17:19:11 -0400 (Tue, 17 Jul 2007)
New Revision: 13587
Added:
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ASDirectoryFieldEditor.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBDirectoryFieldEditor.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java
labs/jbossesb/trunk/product/tools/esbwizard/template/jbmq-queue-service.xml
labs/jbossesb/trunk/product/tools/updatesite/features/org.jboss.soa.esb.template_1.1.0.jar
labs/jbossesb/trunk/product/tools/updatesite/plugins/org.jboss.soa.esb.eclipse.template_1.1.0.jar
Removed:
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards/
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java
labs/jbossesb/trunk/product/tools/esbwizard/template.jar
labs/jbossesb/trunk/product/tools/esbwizard/template/build.properties
labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service-scoped.xml
labs/jbossesb/trunk/product/tools/esbwizard/template/lib/
Modified:
labs/jbossesb/trunk/product/tools/esbwizard/.classpath
labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF
labs/jbossesb/trunk/product/tools/esbwizard/build.properties
labs/jbossesb/trunk/product/tools/esbwizard/plugin.xml
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java
labs/jbossesb/trunk/product/tools/esbwizard/template/build.xml
labs/jbossesb/trunk/product/tools/esbwizard/template/deployment.xml
labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service.xml
labs/jbossesb/trunk/product/tools/esbwizard/template/jboss-esb.xml
labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java
labs/jbossesb/trunk/product/tools/updatesite/site.xml
Log:
Update esbwizard for current QS builds: JBESB-617
Modified: labs/jbossesb/trunk/product/tools/esbwizard/.classpath
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/.classpath 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/.classpath 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/commons-io-1.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF 2007-07-17 21:19:11 UTC (rev 13587)
@@ -2,23 +2,16 @@
Bundle-ManifestVersion: 2
Bundle-Name: Esbwizard Plug-in
Bundle-SymbolicName: org.jboss.soa.esb.eclipse.template; singleton:=true
-Bundle-Version: 1.0.0
+Bundle-Version: 1.1.0
Bundle-Activator: org.jboss.soa.esb.eclipse.template.Activator
Bundle-Vendor: JBoss
Bundle-Localization: plugin
-Bundle-ClassPath: template.jar,lib/commons-io-1.2.jar
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.jdt.core,
- org.eclipse.jdt.launching
+ org.eclipse.jdt.launching,
+ org.eclipse.core.filesystem
Eclipse-LazyStart: true
-Export-Package: META-INF,
- org.apache.commons.io,
- org.apache.commons.io.filefilter,
- org.apache.commons.io.input,
- org.apache.commons.io.output,
- org.jboss.soa.eclipse.wizards,
- org.jboss.soa.esb.eclipse.template
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Modified: labs/jbossesb/trunk/product/tools/esbwizard/build.properties
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/build.properties 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/build.properties 2007-07-17 21:19:11 UTC (rev 13587)
@@ -5,6 +5,5 @@
.,\
icons/,\
template/,\
- lib/,\
- template.jar
+ lib/
jars.compile.order = .
Modified: labs/jbossesb/trunk/product/tools/esbwizard/plugin.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/plugin.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/plugin.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -8,15 +8,22 @@
id="org.jboss.soa.esb.eclipse.template">
</category>
<wizard
- name="ESB Package"
+ name="ESB Project"
icon="icons/sample.gif"
category="org.jboss.soa.esb.eclipse.template"
project="true"
- class="org.jboss.soa.eclipse.wizards.ESBNewWizard"
- id="org.jboss.soa.eclipse.wizards.ESBNewWizard">
+ class="org.jboss.soa.esb.eclipse.wizards.ESBNewWizard"
+ id="org.jboss.soa.esb.eclipse.wizards.ESBNewWizard">
<description>
- A wizard that creates a new jBPM Project
+ A wizard that creates a new ESB Project
</description>
</wizard>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.jboss.soa.esb.eclipse.preferences.ESBPreferencePage"
+ id="org.jboss.soa.esb.eclipse.preferences.ESBPreferencePage"
+ name="ESB Preferences"/>
+ </extension>
</plugin>
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ASDirectoryFieldEditor.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ASDirectoryFieldEditor.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ASDirectoryFieldEditor.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.preferences;
+
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.soa.esb.eclipse.util.ESBUtils;
+
+/**
+ * The Application Server Directory field editor.
+ *
+ * @author kevin
+ */
+public class ASDirectoryFieldEditor extends DirectoryFieldEditor
+{
+ /**
+ * The enabled flag.
+ */
+ private boolean enabled ;
+
+ /**
+ * Construct the Application Server Directory Field Editor.
+ * @param parent The parent composite.
+ */
+ public ASDirectoryFieldEditor(Composite parent)
+ {
+ super(ESBPreferenceConstants.AS_LOCATION, "&Application Server Location:", parent);
+ setEmptyStringAllowed(false) ;
+ setErrorMessage("Application Server location does not specify an Application Server deployment");
+ }
+
+ /**
+ * Check the state after a change.
+ * @return true if valid, false otherwise.
+ */
+ protected boolean doCheckState()
+ {
+ if (!enabled)
+ {
+ return true ;
+ }
+
+ if (super.doCheckState())
+ {
+ final String esbLocation = getTextControl().getText();
+ return (ESBUtils.isASLocation(esbLocation)) ;
+ }
+ return false ;
+ }
+
+ /**
+ * Enable or disable the component.
+ * @param enabled true if the component is enabled, false otherwise.
+ * @param parent The parent composite.
+ */
+ public void setEnabled(final boolean enabled, final Composite parent)
+ {
+ this.enabled = enabled ;
+ super.setEnabled(enabled, parent);
+ setEmptyStringAllowed(!enabled) ;
+ if (!enabled)
+ {
+ setStringValue("") ;
+ }
+ refreshValidState() ;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ASDirectoryFieldEditor.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBDirectoryFieldEditor.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBDirectoryFieldEditor.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBDirectoryFieldEditor.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.preferences;
+
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.soa.esb.eclipse.util.ESBUtils;
+
+/**
+ * The ESB Directory field editor.
+ *
+ * @author kevin
+ */
+public class ESBDirectoryFieldEditor extends DirectoryFieldEditor
+{
+ /**
+ * Construct the ESB Directory Field Editor.
+ * @param parent The parent composite.
+ */
+ public ESBDirectoryFieldEditor(Composite parent)
+ {
+ super(ESBPreferenceConstants.ESB_LOCATION, "&ESB Install Location:", parent);
+ setEmptyStringAllowed(false) ;
+ setErrorMessage("ESB location does not specify an ESB installation");
+ }
+
+ /**
+ * Check the state after a change.
+ * @return true if valid, false otherwise.
+ */
+ protected boolean doCheckState()
+ {
+ if (super.doCheckState())
+ {
+ final String esbLocation = getTextControl().getText();
+ return (ESBUtils.isESBServerOrESBLocation(esbLocation)) ;
+ }
+ return false ;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBDirectoryFieldEditor.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.preferences;
+
+/**
+ * Constant definitions for ESB preferences
+ */
+public class ESBPreferenceConstants
+{
+ /**
+ * The ESB location.
+ */
+ public static final String ESB_LOCATION = "esbLocation";
+ /**
+ * The Application Server location.
+ */
+ public static final String AS_LOCATION = "asLocation";
+}
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.soa.esb.eclipse.template.Activator;
+import org.jboss.soa.esb.eclipse.util.ESBUtils;
+
+/**
+ * Handle preferences for the ESB plugin.
+ *
+ * The following preferences are currently required:
+ */
+public class ESBPreferencePage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage
+{
+ /**
+ * The esb field editor.
+ */
+ private ESBDirectoryFieldEditor esbEditor ;
+ /**
+ * The as field editor.
+ */
+ private ASDirectoryFieldEditor asEditor ;
+
+ /**
+ * Construct the ESB preference page.
+ */
+ public ESBPreferencePage()
+ {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("ESB preference page");
+ }
+
+ /**
+ * Creates the field editors for the preferences.
+ */
+ public void createFieldEditors()
+ {
+ final String esbLocation = getPreferenceStore().getString(ESBPreferenceConstants.ESB_LOCATION) ;
+ final boolean enabled = !ESBUtils.isESBServerLocation(esbLocation) ;
+
+ final Composite parent = getFieldEditorParent() ;
+
+ final ModifyListener validator = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setValid(false) ;
+ }
+ } ;
+
+ esbEditor = new ESBDirectoryFieldEditor(parent) ;
+ addField(esbEditor) ;
+ esbEditor.getTextControl(parent).addModifyListener(validator) ;
+
+ asEditor = new ASDirectoryFieldEditor(parent) ;
+ addField(asEditor) ;
+ asEditor.setEnabled(enabled, parent) ;
+ asEditor.getTextControl(parent).addModifyListener(validator) ;
+ }
+
+ /**
+ * Handle a property change event.
+ * @param PropertyChangeEvent The property change event.
+ */
+ public void propertyChange(final PropertyChangeEvent event)
+ {
+ final Object source = event.getSource() ;
+
+ if ((source == esbEditor) && FieldEditor.VALUE.equals(event.getProperty()))
+ {
+ validateEditors() ;
+ }
+
+ super.propertyChange(event);
+ }
+
+ /**
+ * Validate the editor.
+ */
+ private void validateEditors()
+ {
+ final String newLocation = esbEditor.getStringValue() ;
+ final boolean enabled = !ESBUtils.isESBServerLocation(newLocation) ;
+ asEditor.setEnabled(enabled, getFieldEditorParent()) ;
+ checkState() ;
+ }
+
+ /**
+ * Handle the initialisation of the preference page.
+ * @param workbench The current workbench.
+ */
+ public void init(final IWorkbench workbench)
+ {
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,8 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
package org.jboss.soa.esb.eclipse.template;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -11,25 +28,10 @@
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
-
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.soa.esb.eclipse.template";
- private ResourceBundle resourceBundle;
// The shared instance
private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle("org.cubictest.CubicTestPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
/*
* (non-Javadoc)
@@ -37,6 +39,7 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ plugin = this;
}
/*
@@ -57,10 +60,6 @@
return plugin;
}
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * Utility methods for identifying ESB and App Server deployments.
+ * @author kevin
+ */
+public class ESBUtils
+{
+ /**
+ * The name of the ESB sar.
+ */
+ private static final String ESB_SAR = "jbossesb.sar" ;
+ /**
+ * The current ESB artifacts.
+ */
+ private static final String[] ESB_ARTIFACTS = {
+ "jbossesb.esb", "jbpm.esb", "jbrules.esb",
+ "smooks.esb", "soap.esb", "spring.esb"
+ } ;
+
+ /**
+ * Does the specified location represent an ESB Server installation?
+ * @param location The specified location.
+ * @return true if it is an ESB installation, false otherwise.
+ */
+ public static boolean isESBServerLocation(final String location)
+ {
+ // esb installation has EULA, quickstarts and lib esb files
+ final String normalisedLocation = normalise(location) ;
+ if (normalisedLocation != null)
+ {
+ final IPath path = Path.fromOSString(normalisedLocation) ;
+ final IFileStore esbFileStore = EFS.getLocalFileSystem().getStore(path) ;
+ return (isDirectory(esbFileStore) && hasEULA(esbFileStore) &&
+ hasQuickstarts(esbFileStore) && hasDeployESBDirs(esbFileStore)) ;
+ }
+ return false ;
+ }
+
+ /**
+ * Does the specified location represent an ESB server or ESB deployment?
+ * @param location The specified location.
+ * @return true if it is an App Server or ESB deployment, false otherwise.
+ */
+ public static boolean isESBServerOrESBLocation(final String location)
+ {
+ // esb server installation has EULA, quickstarts and server/default/deploy esb files
+ final String normalisedLocation = normalise(location) ;
+ if (normalisedLocation != null)
+ {
+ final IPath path = Path.fromOSString(normalisedLocation) ;
+ final IFileStore esbFileStore = EFS.getLocalFileSystem().getStore(path) ;
+ return (isDirectory(esbFileStore) && hasEULA(esbFileStore) &&
+ hasQuickstarts(esbFileStore) &&
+ (hasDeployESBDirs(esbFileStore) || hasLibESBDirs(esbFileStore))) ;
+ }
+ return false ;
+ }
+
+ /**
+ * Does the specified location represent an App Server deployment?
+ * @param location The specified location.
+ * @return true if it is an App Server deployment, false otherwise.
+ */
+ public static boolean isASLocation(final String location)
+ {
+ // as server installation has server, client libs
+ final String normalisedLocation = normalise(location) ;
+ if (normalisedLocation != null)
+ {
+ final IPath path = Path.fromOSString(normalisedLocation) ;
+ final IFileStore asFileStore = EFS.getLocalFileSystem().getStore(path) ;
+ return (isDirectory(asFileStore) && hasServer(asFileStore) &&
+ hasClientLibs(asFileStore)) ;
+ }
+ return false ;
+ }
+
+ /**
+ * Normalise the location string to remove spaces.
+ * @param location The location.
+ * @return null if empty, trimmed location otherwise.
+ */
+ private static String normalise(final String location)
+ {
+ if (location != null)
+ {
+ final String trimmedLocation = location.trim() ;
+ return (trimmedLocation.length() > 0 ? trimmedLocation : null) ;
+ }
+ return null ;
+ }
+
+ /**
+ * Check the EULA, it should exist in all ESB installations.
+ * @param location The base location to check.
+ * @return true if the EULA exists, false otherwise.
+ */
+ private static boolean hasEULA(final IFileStore location)
+ {
+ final IFileStore eulaFileStore = location.getChild("JBossORG-EULA.txt") ;
+ final IFileInfo eulaFileInfo = eulaFileStore.fetchInfo() ;
+ return (eulaFileInfo.exists() && !eulaFileInfo.isDirectory()) ;
+ }
+
+ /**
+ * Check the quickstarts, they should exist in all ESB installations.
+ * @param location The base location to check.
+ * @return true if the EULA exists, false otherwise.
+ */
+ private static boolean hasQuickstarts(final IFileStore location)
+ {
+ final IFileStore samples = location.getChild("samples") ;
+ if (isDirectory(samples))
+ {
+ final IFileStore quickstarts = samples.getChild("quickstarts") ;
+ return isDirectory(quickstarts) ;
+ }
+ return false ;
+ }
+
+ /**
+ * Are the ESB artifacts in the lib directory?
+ * @param location The base location to check.
+ * @return true if the ESB artifacts are in lib, false otherwise.
+ */
+ private static boolean hasLibESBDirs(final IFileStore location)
+ {
+ final IFileStore libDir = location.getChild("lib") ;
+ return (isDirectory(libDir) && hasESBArtifacts(libDir)) ;
+ }
+
+ /**
+ * Are the ESB artifacts in the deploy directory?
+ * @param location The base location to check.
+ * @return true if the ESB artifacts are in deploy, false otherwise.
+ */
+ private static boolean hasDeployESBDirs(final IFileStore location)
+ {
+ final IFileStore serverDir = location.getChild("server") ;
+ if (isDirectory(serverDir))
+ {
+ final IFileStore defaultDir = serverDir.getChild("default") ;
+ if (isDirectory(defaultDir))
+ {
+ final IFileStore deployDir = defaultDir.getChild("deploy") ;
+ return (isDirectory(deployDir) && hasESBArtifacts(deployDir)) ;
+ }
+ }
+ return false ;
+ }
+
+ /**
+ * Does the location contain the app server client libs?
+ * @param location The base location to check.
+ * @return true if the AS client libs are present, false otherwise.
+ */
+ private static boolean hasClientLibs(final IFileStore location)
+ {
+ final IFileStore client = location.getChild("client") ;
+ if (isDirectory(client))
+ {
+ final IFileStore jbossAll = client.getChild("jbossall-client.jar") ;
+ return jbossAll.fetchInfo().exists() ;
+ }
+ return false ;
+ }
+
+ /**
+ * Does the location contain the AS directory?
+ * @param location The base location to check.
+ * @return true if the AS server directory is present, false otherwise.
+ */
+ private static boolean hasServer(final IFileStore location)
+ {
+ final IFileStore server = location.getChild("server") ;
+ return isDirectory(server) ;
+ }
+
+ /**
+ * Does the location contain the ESB artifacts>
+ * @param location The base location to check.
+ * @return true if the artifacts are present, false otherwise.
+ */
+ private static boolean hasESBArtifacts(final IFileStore location)
+ {
+ final int numArtifacts = ESB_ARTIFACTS.length ;
+ for(int count = 0 ; count < numArtifacts ; count++)
+ {
+ final String artifact = ESB_ARTIFACTS[count] ;
+ final IFileStore artifactFile = location.getChild(artifact) ;
+ if (!artifactFile.fetchInfo().exists())
+ {
+ return false ;
+ }
+ }
+
+ final IFileStore esbSarFile = location.getChild(ESB_SAR) ;
+ return esbSarFile.fetchInfo().exists() ;
+ }
+
+ /**
+ * Does the specified file represent a directory?
+ * @param file The file.
+ * @return true if it is a directory which exists, false otherwise.
+ */
+ private static boolean isDirectory(final IFileStore file)
+ {
+ final IFileInfo fileInfo = file.fetchInfo() ;
+ return (fileInfo.exists() && fileInfo.isDirectory()) ;
+ }
+
+ /**
+ * Get the artifact classpath for the ESB server.
+ * @param esbLocation The ESB location.
+ * @return The classpath entries for the artifact classpath.
+ * @throws CoreException for errors.
+ */
+ public static IClasspathEntry[] getESBServerArtifactClasspath(final String esbLocation)
+ throws CoreException
+ {
+ final ArrayList classpathEntries = new ArrayList() ;
+ final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
+ final IPath deployPath = esbLocationPath.append("server/default/deploy") ;
+
+ addSARArtifactJars(classpathEntries, deployPath, ESB_SAR) ;
+ addESBArtifactJars(classpathEntries, deployPath, ESB_ARTIFACTS) ;
+ addClientJars(classpathEntries, esbLocationPath) ;
+
+ return (IClasspathEntry[]) classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]) ;
+ }
+
+ /**
+ * Get the artifact classpath for the ESB server.
+ * @param esbLocation The ESB location.
+ * @param asLocation The AS location.
+ * @return The classpath entries for the artifact classpath.
+ * @throws CoreException for errors.
+ */
+ public static IClasspathEntry[] getESBArtifactClasspath(final String esbLocation, final String asLocation)
+ throws CoreException
+ {
+ final ArrayList classpathEntries = new ArrayList() ;
+ final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
+ final IPath asLocationPath = Path.fromOSString(asLocation) ;
+
+ final IPath esbLibPath = esbLocationPath.append("lib") ;
+ addSARArtifactJars(classpathEntries, esbLibPath, ESB_SAR) ;
+ addESBArtifactJars(classpathEntries, esbLibPath, ESB_ARTIFACTS) ;
+ addClientJars(classpathEntries, asLocationPath) ;
+
+ return (IClasspathEntry[]) classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]) ;
+ }
+
+ /**
+ * Add the SAR artifact jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param parent The parent of the sar artifact.
+ * @param sarArtifact The name of the sar artifact.
+ * @throws CoreException for errors.
+ */
+ private static void addSARArtifactJars(final List classpathEntries, final IPath parent, final String sarArtifact)
+ throws CoreException
+ {
+ final IPath sarLibPath = parent.append(sarArtifact + "/lib") ;
+ addAllJars(classpathEntries, sarLibPath) ;
+ }
+
+ /**
+ * Add the ESB artifact jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param parent The parent of the ESB artifacts.
+ * @param esbArtifacts The names of the esb artifacts.
+ * @throws CoreException for errors.
+ */
+ private static void addESBArtifactJars(final List classpathEntries, final IPath parent, final String[] esbArtifacts)
+ throws CoreException
+ {
+ final int numArtifacts = (esbArtifacts == null ? 0 : esbArtifacts.length) ;
+ for(int count = 0 ; count < numArtifacts ; count++)
+ {
+ final IPath artifactPath = parent.append(esbArtifacts[count]) ;
+ addAllJars(classpathEntries, artifactPath) ;
+ }
+ }
+
+ /**
+ * Add the App Server client jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param asRoot The root of the app server install.
+ */
+ private static void addClientJars(final List classpathEntries, final IPath asRoot)
+ {
+ final IPath clientJarPath = asRoot.append("client/jbossall-client.jar") ;
+ classpathEntries.add(JavaCore.newLibraryEntry(clientJarPath, null, null)) ;
+ }
+
+ /**
+ * Add all jars in the specified directory.
+ * @param classpathEntries The current classpath list.
+ * @param directory The directory containing the jars.
+ * @throws CoreException for errors.
+ */
+ private static void addAllJars(final List classpathEntries, final IPath root)
+ throws CoreException
+ {
+ final IFileStore rootStore = EFS.getLocalFileSystem().getStore(root) ;
+ final String[] names = rootStore.childNames(EFS.NONE, null);
+ final int numNames = (names == null ? 0 : names.length) ;
+ for(int count = 0 ; count < numNames ; count++)
+ {
+ final String child = names[count] ;
+ if ((child != null) && child.endsWith(".jar"))
+ {
+ final IFileStore childStore = rootStore.getChild(child) ;
+ final IFileInfo childInfo = childStore.fetchInfo() ;
+ if (childInfo.exists() && !childInfo.isDirectory())
+ {
+ final IPath childPath = root.append(child) ;
+ classpathEntries.add(JavaCore.newLibraryEntry(childPath, null, null)) ;
+ }
+ }
+ }
+ }
+}
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards (from rev 13394, labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards)
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards/ESBNewWizard.java 2007-07-12 07:11:41 UTC (rev 13394)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,220 +0,0 @@
-package org.jboss.soa.eclipse.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-import org.eclipse.ui.part.ISetSelectionTarget;
-
-/**
- * This is a new wizard which creates a very simple ESB project. The
- * wizard copies over the requisite files, sets the classpath, and refreshes.
- * Using the default WizardNewProjectCreationPage for now because all
- * that is needed to start is a project name. If we want to customize
- * the class names or the package names we're going to have to extend that a bit.
- */
-public class ESBNewWizard extends Wizard implements INewWizard {
- private WizardNewProjectCreationPage m_page;
- private IProject m_project;
- private IWorkbench m_workbench;
-
- /**
- * Constructor for ESBNewWizard.
- */
- public ESBNewWizard() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- /**
- * Adding the default new project wizard page to the wizard.
- */
- public void addPages() {
- super.addPages();
- setWindowTitle("New ESB Package Project");
- m_page = new WizardNewProjectCreationPage("WizardNewProjectCreationPage");
- m_page.setTitle("ESB Package Project");
- m_page.setDescription("Create a new ESB package project");
- m_page.setImageDescriptor(ImageDescriptor.createFromFile(getClass(),
- "/icons/sample.gif"));
- addPage(m_page);
- }
-
- /**
- * Create the project, start and complete the monitor progress.
- */
- private void createProject(IProgressMonitor monitor) throws InterruptedException, CoreException, IOException
- {
- if (monitor == null) {
- monitor= new NullProgressMonitor();
- }
- try {
- String strName = m_page.getProjectName();
- monitor.beginTask("Creating "+ strName + " Forrest Project", 3);
-
- IProject project= m_page.getProjectHandle();
- IPath locationPath= m_page.getLocationPath();
-
- // create the project
- IProjectDescription desc= project.getWorkspace().newProjectDescription(project.getName());
- if (!m_page.useDefaults()) {
- desc.setLocation(locationPath);
- }
-
- ESBProjectCreator esbpc = new ESBProjectCreator();
- esbpc.createJavaProject(m_page, project, m_workbench, monitor);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * performFinish is called when the user hits the "Finish" button.
- */
- public boolean performFinish() {
- m_project = m_page.getProjectHandle();
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor)
- throws CoreException, InterruptedException {
- try {
- createProject(monitor);
- selectAndReveal(m_project, m_workbench.getActiveWorkbenchWindow());
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- monitor.done();
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- selectAndReveal(m_project, m_workbench.getActiveWorkbenchWindow());
- return true;
- }
-
- /**
- * Refresh the workbench.
- * @param resource resource
- * @param window window
- */
- private void selectAndReveal(IResource resource,
- IWorkbenchWindow window) {
- if (!inputValid(resource, window)) return;
- Iterator itr = getParts(window.getActivePage()).iterator();
- while (itr.hasNext()) {
- selectAndRevealTarget(
- window,
- new StructuredSelection(resource),
- getTarget((IWorkbenchPart)itr.next()));
- }
- }
-
- /**
- * Return a target from a IWorkbenchPart.
- * @param part workbench part
- * @return target
- */
- private ISetSelectionTarget getTarget(IWorkbenchPart part) {
- ISetSelectionTarget target = null;
- if (part instanceof ISetSelectionTarget) {
- target = (ISetSelectionTarget)part;
- }
- else {
- target = (ISetSelectionTarget)part.getAdapter(ISetSelectionTarget.class);
- }
- return target;
- }
-
- /**
- * Check whether the window / resource combination is valid.
- * @param resource
- * @param window
- * @return
- */
- private boolean inputValid(IResource resource, IWorkbenchWindow window) {
- if (window == null || resource == null) return false;
- else if (window.getActivePage() == null) return false;
- else return true;
- }
-
- /**
- * Call select reveal.
- * @param window window
- * @param selection selection
- * @param target target
- */private void selectAndRevealTarget(IWorkbenchWindow window, final ISelection selection, ISetSelectionTarget target) {
- if (target == null) return;
- final ISetSelectionTarget finalTarget = target;
- window.getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- finalTarget.selectReveal(selection);
- }
- });
- }
-
- /**
- * Return a list of parts to iterate over.
- * @param page
- * @return list of parts
- */
- private List getParts(IWorkbenchPage page) {
- ArrayList result = new ArrayList();
- addParts(result, page.getViewReferences());
- addParts(result, page.getEditorReferences());
- return result;
- }
-
- /**
- * Copy all of the workbench part references into the list.
- * @param parts list of parts
- * @param refs workbench part references
- */
- private void addParts(ArrayList parts, IWorkbenchPartReference[] refs) {
- for (int i = 0; i < refs.length; i++) {
- IWorkbenchPart part = refs[i].getPart(false);
- if (part != null) {
- parts.add(part);
- }
- }
- }
-
- /**
- * We will accept the selection in the workbench to see if
- * we can initialize from it.
- * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.m_workbench = workbench;
- this.m_project = null;
- setNeedsProgressMonitor(true);
- }
-}
\ No newline at end of file
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java (from rev 13584, labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards/ESBNewWizard.java)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,271 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import org.jboss.soa.esb.eclipse.preferences.ESBPreferenceConstants;
+import org.jboss.soa.esb.eclipse.template.Activator;
+
+/**
+ * This is a new wizard which creates a very simple ESB project. The
+ * wizard copies over the requisite files, sets the classpath, and refreshes.
+ * Using the default WizardNewProjectCreationPage for now because all
+ * that is needed to start is a project name. If we want to customize
+ * the class names or the package names we're going to have to extend that a bit.
+ */
+public class ESBNewWizard extends Wizard implements INewWizard {
+ private WizardNewProjectCreationPage m_page;
+ private ESBServerPage m_serverPage;
+ private IProject m_project;
+ private IWorkbench m_workbench;
+
+ /**
+ * Constructor for ESBNewWizard.
+ */
+ public ESBNewWizard() {
+ super();
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * Adding the default new project wizard page to the wizard.
+ */
+ public void addPages() {
+ super.addPages();
+ setWindowTitle("New ESB Package Project");
+
+ m_page = new WizardNewProjectCreationPage("WizardNewProjectCreationPage");
+ m_page.setTitle("ESB Package Project");
+ m_page.setDescription("Create a new ESB package project");
+ addPage(m_page);
+
+ m_serverPage = new ESBServerPage("ESBServerPage") ;
+ m_serverPage.setTitle("ESB Server Location") ;
+ m_serverPage.setDescription("Specify location of ESB installation and Application Server") ;
+
+ final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore() ;
+
+ final String esbLocation = preferenceStore.getString(ESBPreferenceConstants.ESB_LOCATION) ;
+ final String asLocation = preferenceStore.getString(ESBPreferenceConstants.AS_LOCATION) ;
+ m_serverPage.setInitialESBLocation(esbLocation) ;
+ m_serverPage.setInitialASLocation(asLocation) ;
+
+ addPage(m_serverPage) ;
+ }
+
+ /**
+ * Create the project, start and complete the monitor progress.
+ */
+ private void createProject(IProgressMonitor monitor) throws InterruptedException, CoreException, InvocationTargetException
+ {
+ if (monitor == null) {
+ monitor= new NullProgressMonitor();
+ }
+ try {
+ String strName = m_page.getProjectName();
+ monitor.beginTask("Creating "+ strName + " ESB Project", 3);
+
+ IProject project= m_page.getProjectHandle();
+ IPath locationPath= m_page.getLocationPath();
+
+ // create the project
+ IProjectDescription desc= project.getWorkspace().newProjectDescription(project.getName());
+ if (!m_page.useDefaults()) {
+ desc.setLocation(locationPath);
+ }
+
+ ESBProjectCreator esbpc = new ESBProjectCreator();
+ try {
+ esbpc.createJavaProject(m_page, m_serverPage, project, m_workbench, monitor);
+ } catch (final IOException ioe) {
+ throw new InvocationTargetException(ioe) ;
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /**
+ * performFinish is called when the user hits the "Finish" button.
+ */
+ public boolean performFinish() {
+ m_project = m_page.getProjectHandle();
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InterruptedException, InvocationTargetException {
+ try {
+ createProject(monitor);
+ selectAndReveal(m_project, m_workbench.getActiveWorkbenchWindow());
+ } finally {
+ monitor.done();
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InvocationTargetException ite) {
+ final Throwable targetException = ite.getTargetException() ;
+ if (targetException instanceof CoreException) {
+ ErrorDialog.openError(getShell(), "Error creating project",
+ null, ((CoreException)targetException).getStatus());
+ } else {
+ final String targetMessage = targetException.getMessage() ;
+ final String message = (targetMessage != null ? targetMessage : targetException.toString()) ;
+ final IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, message, targetException);
+ Activator.getDefault().getLog().log(status) ;
+ MessageDialog.openError(getShell(), "Error creating project", targetException.getMessage()) ;
+ }
+ } catch (InterruptedException e) {
+ return false ;
+ }
+ selectAndReveal(m_project, m_workbench.getActiveWorkbenchWindow());
+ return true;
+ }
+
+ /**
+ * Refresh the workbench.
+ * @param resource resource
+ * @param window window
+ */
+ private void selectAndReveal(IResource resource,
+ IWorkbenchWindow window) {
+ if (!inputValid(resource, window)) return;
+ Iterator itr = getParts(window.getActivePage()).iterator();
+ while (itr.hasNext()) {
+ selectAndRevealTarget(
+ window,
+ new StructuredSelection(resource),
+ getTarget((IWorkbenchPart)itr.next()));
+ }
+ }
+
+ /**
+ * Return a target from a IWorkbenchPart.
+ * @param part workbench part
+ * @return target
+ */
+ private ISetSelectionTarget getTarget(IWorkbenchPart part) {
+ ISetSelectionTarget target = null;
+ if (part instanceof ISetSelectionTarget) {
+ target = (ISetSelectionTarget)part;
+ }
+ else {
+ target = (ISetSelectionTarget)part.getAdapter(ISetSelectionTarget.class);
+ }
+ return target;
+ }
+
+ /**
+ * Check whether the window / resource combination is valid.
+ * @param resource
+ * @param window
+ * @return
+ */
+ private boolean inputValid(IResource resource, IWorkbenchWindow window) {
+ if (window == null || resource == null) return false;
+ else if (window.getActivePage() == null) return false;
+ else return true;
+ }
+
+ /**
+ * Call select reveal.
+ * @param window window
+ * @param selection selection
+ * @param target target
+ */private void selectAndRevealTarget(IWorkbenchWindow window, final ISelection selection, ISetSelectionTarget target) {
+ if (target == null) return;
+ final ISetSelectionTarget finalTarget = target;
+ window.getShell().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ finalTarget.selectReveal(selection);
+ }
+ });
+ }
+
+ /**
+ * Return a list of parts to iterate over.
+ * @param page
+ * @return list of parts
+ */
+ private List getParts(IWorkbenchPage page) {
+ ArrayList result = new ArrayList();
+ addParts(result, page.getViewReferences());
+ addParts(result, page.getEditorReferences());
+ return result;
+ }
+
+ /**
+ * Copy all of the workbench part references into the list.
+ * @param parts list of parts
+ * @param refs workbench part references
+ */
+ private void addParts(ArrayList parts, IWorkbenchPartReference[] refs) {
+ for (int i = 0; i < refs.length; i++) {
+ IWorkbenchPart part = refs[i].getPart(false);
+ if (part != null) {
+ parts.add(part);
+ }
+ }
+ }
+
+ /**
+ * We will accept the selection in the workbench to see if
+ * we can initialize from it.
+ * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.m_workbench = workbench;
+ this.m_project = null;
+ setNeedsProgressMonitor(true);
+ }
+}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards/ESBProjectCreator.java 2007-07-12 07:11:41 UTC (rev 13394)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,127 +0,0 @@
-package org.jboss.soa.eclipse.wizards;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.io.FileUtils;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * This object is a helper class which helps create the java project by
- * copying in the template files, and create the classpath using the
- */
-public class ESBProjectCreator {
- private static final String BUNDLE_NAME = "org.jboss.soa.esb.eclipse.template";
- private static final String TEMPLATE_FILES_DIR = "template";
-
- /**
- * Copy all of the template files from the plugin into the new eclipse
- * project.
- */
- public void FindZipFile(IProject f_project) {
- URL url = null;
- try {
- url = FileLocator.toFileURL(Platform.getBundle(BUNDLE_NAME).getEntry(TEMPLATE_FILES_DIR));
- File esbFilesDir = new File(url.getFile());
- String esbFiles[] = esbFilesDir.list();
- for (int i = 0; i < esbFiles.length; i++) {
- File temp = new File(esbFilesDir + File.separator + esbFiles[i]);
- if (temp.isDirectory()) {
- FileUtils.copyDirectoryToDirectory(temp, new File(f_project.getLocationURI()));
- } else {
- FileUtils.copyFileToDirectory(temp, new File(f_project.getLocationURI()));
- }
- }
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
- }
-
- /**
- *
- * @param f_page the WizardNewProjectCreationPage
- * @param f_project the IProject being created
- * @param f_workbench workbench
- * @param monitor monitor
- * @throws JavaModelException java model exception
- * @throws CoreException core exception
- */
- public void createJavaProject(WizardNewProjectCreationPage f_page,
- IProject f_project, IWorkbench f_workbench, IProgressMonitor monitor)
- throws JavaModelException, CoreException {
- monitor.beginTask("Creating ESB Package", 0);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IProject project = root.getProject(f_page.getProjectName());
-
- IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
-
- if(!Platform.getLocation().equals(f_page.getLocationPath()))
- description.setLocation(f_page.getLocationPath());
-
- description.setNatureIds(new String[] { JavaCore.NATURE_ID });
- ICommand buildCommand = description.newCommand();
- buildCommand.setBuilderName(JavaCore.BUILDER_ID);
- description.setBuildSpec(new ICommand[] { buildCommand });
- project.create(description, monitor);
- project.open(monitor);
-
- IJavaProject javaProject = JavaCore.create(project);
-
- IFolder srcFolder = project.getFolder("src");
- srcFolder.create(true, true, monitor);
-
- IFolder binFolder = project.getFolder("bin");
- binFolder.create(true, true, monitor);
-
- IFolder libFolder = project.getFolder("lib");
- libFolder.create(true, true, monitor);
- IFolder libExtFolder = project.getFolder("lib/ext");
- FindZipFile(project);
-
- javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
-
- IClasspathEntry[] libraryClasspath = new IClasspathEntry[] {
- JavaCore.newLibraryEntry(libExtFolder.getFile("jbossall-client.jar").getFullPath(), null, null),
- JavaCore.newLibraryEntry(libFolder.getFile("jbossesb-listeners.jar").getFullPath(), null, null),
- JavaCore.newLibraryEntry(libFolder.getFile("jbossesb-rosetta.jar").getFullPath(), null, null),
- JavaCore.newLibraryEntry(libFolder.getFile("jbossesb-services.jar").getFullPath(), null, null)
- };
- IClasspathEntry[] classpath = new IClasspathEntry[2 + libraryClasspath.length];
- // Source entry must be first in classpath
- classpath[0] = JavaCore.newSourceEntry(project.getProject().getFullPath().append(new Path("/src")));
- // Add the JRE for the classpath
- classpath[1] = JavaRuntime.getDefaultJREContainerEntry();
- // Add all of the jars
- int counter = 2;
- for (int i = 0; i < libraryClasspath.length; i++) {
- classpath[counter++] = libraryClasspath[i];
- }
-
- // Set the raw classpath
- javaProject.setRawClasspath(classpath, binFolder.getFullPath(), monitor);
-
- project.refreshLocal(IResource.DEPTH_INFINITE, null);
- monitor.worked(1);
- }
-}
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java (from rev 13584, labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/eclipse/wizards/ESBProjectCreator.java)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBProjectCreator.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,172 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.wizards;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+import org.jboss.soa.esb.eclipse.template.Activator;
+import org.jboss.soa.esb.eclipse.util.ESBUtils;
+
+/**
+ * This object is a helper class which helps create the java project by
+ * copying in the template files, and create the classpath using the
+ */
+public class ESBProjectCreator {
+ private static final String TEMPLATE_FILES_DIR = "/template";
+
+ private static final String QUICKSTART_CONF_PROPERTY = "quickstart.conf" ;
+
+ /**
+ * Copy all of the template files from the plugin into the new eclipse
+ * project.
+ */
+ public void copyTemplateFiles(IProject f_project, final IProgressMonitor monitor) throws CoreException, IOException {
+ final IPath templatePath = Path.fromOSString(TEMPLATE_FILES_DIR) ;
+ final Activator activator = Activator.getDefault() ;
+ final URL templateURL = FileLocator.find(activator.getBundle(), templatePath, null) ;
+ final URL templateFileURL = FileLocator.toFileURL(templateURL) ;
+ final URI templateURI ;
+ try
+ {
+ templateURI = new URI(templateFileURL.toExternalForm()) ;
+ }
+ catch (final URISyntaxException urise)
+ {
+ throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, 0, "Failed to convert URL", urise));
+ }
+ final IFileStore templateFileStore = EFS.getStore(templateURI) ;
+ final IFileStore destinationFileStore = EFS.getStore(f_project.getLocationURI()) ;
+ templateFileStore.copy(destinationFileStore, EFS.NONE, monitor) ;
+ }
+
+ /**
+ *
+ * @param f_page the WizardNewProjectCreationPage
+ * @param f_serverPage The ESB server page.
+ * @param f_project the IProject being created
+ * @param f_workbench workbench
+ * @param monitor monitor
+ * @throws JavaModelException java model exception
+ * @throws CoreException core exception
+ */
+ public void createJavaProject(WizardNewProjectCreationPage f_page, ESBServerPage f_serverPage,
+
+ IProject f_project, IWorkbench f_workbench, IProgressMonitor monitor)
+ throws JavaModelException, CoreException, IOException {
+ monitor.beginTask("Creating ESB Package", 0);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(f_page.getProjectName());
+
+ IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
+
+ if(!Platform.getLocation().equals(f_page.getLocationPath()))
+ description.setLocation(f_page.getLocationPath());
+
+ description.setNatureIds(new String[] { JavaCore.NATURE_ID });
+ ICommand buildCommand = description.newCommand();
+ buildCommand.setBuilderName(JavaCore.BUILDER_ID);
+ description.setBuildSpec(new ICommand[] { buildCommand });
+ project.create(description, monitor);
+ project.open(monitor);
+
+ IJavaProject javaProject = JavaCore.create(project);
+
+ IFolder srcFolder = project.getFolder("src");
+ srcFolder.create(true, true, monitor);
+
+ IFolder binFolder = project.getFolder("bin");
+ binFolder.create(true, true, monitor);
+
+ copyTemplateFiles(project, monitor);
+
+ javaProject.setOutputLocation(binFolder.getFullPath(), monitor);
+
+ final String esbLocation = f_serverPage.getESBLocation() ;
+ final String asLocation = f_serverPage.getASLocation() ;
+
+ final IClasspathEntry[] libraryClasspath ;
+ if (asLocation != null)
+ {
+ libraryClasspath = ESBUtils.getESBArtifactClasspath(esbLocation, asLocation) ;
+ }
+ else
+ {
+ libraryClasspath = ESBUtils.getESBServerArtifactClasspath(esbLocation) ;
+ }
+ IClasspathEntry[] classpath = new IClasspathEntry[2 + libraryClasspath.length];
+ // Source entry must be first in classpath
+ classpath[0] = JavaCore.newSourceEntry(project.getProject().getFullPath().append(new Path("/src")));
+ // Add the JRE for the classpath
+ classpath[1] = JavaRuntime.getDefaultJREContainerEntry();
+ // Add all of the jars
+ System.arraycopy(libraryClasspath, 0, classpath, 2, libraryClasspath.length) ;
+
+ // Set the raw classpath
+ javaProject.setRawClasspath(classpath, binFolder.getFullPath(), monitor);
+
+ // create build.properties file
+ final IFile propertyFile = project.getFile("build.properties") ;
+ final IPath basePath = Path.fromOSString(esbLocation) ;
+ final IPath confDir = basePath.append("samples/quickstarts/conf") ;
+ final String confDirValue = confDir.makeAbsolute().toOSString() ;
+
+ final Properties props = new Properties() ;
+ props.put(QUICKSTART_CONF_PROPERTY, confDirValue) ;
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
+ props.store(baos, "# Autogenerated by ESB Eclipse Wizard") ;
+
+ propertyFile.create(new ByteArrayInputStream(baos.toByteArray()), false, monitor) ;
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ monitor.worked(1);
+ }
+}
Added: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,333 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2007
+ */
+
+package org.jboss.soa.esb.eclipse.wizards;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.soa.esb.eclipse.util.ESBUtils;
+
+/**
+ * The wizard page for configuring the ESB install and application server locations.
+ *
+ * @author kevin
+ */
+public class ESBServerPage extends WizardPage
+{
+ /**
+ * The default text width.
+ */
+ private static final int TEXT_WIDTH = 250 ;
+ /**
+ * The text for the browse button.
+ */
+ private static final String BROWSE_TEXT = "Browse" ;
+
+ /**
+ * The initial value of the ESB location.
+ */
+ private String initialESBLocation ;
+ /**
+ * The initial value of the AS location.
+ */
+ private String initialASLocation ;
+ /**
+ * The ESB location label.
+ */
+ private Label esbLocationLabel ;
+ /**
+ * The AS location label.
+ */
+ private Label asLocationLabel ;
+ /**
+ * The ESB location text field.
+ */
+ private Text esbLocationField ;
+ /**
+ * The AS location text field.
+ */
+ private Text asLocationField ;
+ /**
+ * The ESB browse button.
+ */
+ private Button esbLocationButton ;
+ /**
+ * The AS browse button.
+ */
+ private Button asLocationButton ;
+
+ /**
+ * Is the ESB location valid?
+ */
+ private boolean esbLocationValid ;
+ /**
+ * Is the AS location valid?
+ */
+ private boolean asLocationValid ;
+ /**
+ * Is the AS location enabled?
+ */
+ private boolean asEnabled = true ;
+
+ /**
+ * Construct the wizard page.
+ * @param pageName The page name.
+ */
+ public ESBServerPage(final String pageName)
+ {
+ super(pageName) ;
+ }
+
+ /**
+ * Create the control for the page.
+ * @param parent The parent composite.
+ */
+ public void createControl(final Composite parent)
+ {
+ final Composite pageComposite = new Composite(parent, SWT.NULL) ;
+ pageComposite.setFont(parent.getFont()) ;
+ initializeDialogUnits(parent) ;
+
+ pageComposite.setLayout(new GridLayout()) ;
+ pageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)) ;
+
+ final Composite dataComposite = new Composite(pageComposite, SWT.NONE) ;
+ dataComposite.setLayout(new GridLayout(3, false)) ;
+ dataComposite.setLayoutData(new GridData(SWT.FILL, GridData.CENTER, true, false)) ;
+
+ esbLocationLabel = new Label(dataComposite, SWT.NONE) ;
+ esbLocationLabel.setFont(parent.getFont()) ;
+ esbLocationLabel.setText("ESB Install Location:") ;
+
+ esbLocationField = new Text(dataComposite, SWT.BORDER) ;
+ esbLocationField.setLayoutData(new GridData(TEXT_WIDTH, SWT.DEFAULT)) ;
+ esbLocationField.setFont(parent.getFont()) ;
+ esbLocationField.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ validateESBLocation() ;
+ }
+ }) ;
+
+ esbLocationButton = new Button(dataComposite, SWT.PUSH) ;
+ esbLocationButton.setText(BROWSE_TEXT) ;
+ esbLocationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent event) {
+ handleBrowse(esbLocationField, "ESB Install Location") ;
+ }
+ }) ;
+
+ asLocationLabel = new Label(dataComposite, SWT.NONE) ;
+ asLocationLabel.setFont(parent.getFont()) ;
+ asLocationLabel.setText("Application Server Location:") ;
+
+ asLocationField = new Text(dataComposite, SWT.BORDER) ;
+ asLocationField.setLayoutData(new GridData(TEXT_WIDTH, SWT.DEFAULT)) ;
+ asLocationField.setFont(parent.getFont()) ;
+ asLocationField.addModifyListener(new ModifyListener() {
+ public void modifyText(final ModifyEvent event) {
+ validateASLocation() ;
+ }
+ }) ;
+
+
+ asLocationButton = new Button(dataComposite, SWT.PUSH) ;
+ asLocationButton.setText(BROWSE_TEXT) ;
+ asLocationButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(final SelectionEvent event) {
+ handleBrowse(asLocationField, "Application Server Location") ;
+ }
+ }) ;
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ if (initialESBLocation != null)
+ {
+ esbLocationField.setText(initialESBLocation) ;
+ }
+ if (asEnabled && (initialASLocation != null))
+ {
+ asLocationField.setText(initialASLocation) ;
+ }
+
+ setControl(pageComposite); ;
+ }
+
+ /**
+ * Set the initial value of the ESB location.
+ * @param initialESBLocation The initial value.
+ */
+ public void setInitialESBLocation(final String initialESBLocation)
+ {
+ this.initialESBLocation = initialESBLocation ;
+ }
+
+ /**
+ * Set the initial value of the AS location.
+ * @param initialASLocation The initial value.
+ */
+ public void setInitialASLocation(final String initialASLocation)
+ {
+ this.initialASLocation = initialASLocation ;
+ }
+
+ /**
+ * Validate the ESB location.
+ */
+ private void validateESBLocation()
+ {
+ final String esbLocation = esbLocationField.getText() ;
+
+ esbLocationValid = ESBUtils.isESBServerOrESBLocation(esbLocation) ;
+ if (!esbLocationValid)
+ {
+ setErrorMessage("Invalid ESB Install Location") ;
+ }
+ else
+ {
+ setErrorMessage(null) ;
+ }
+
+ final boolean enabled = !(esbLocationValid && ESBUtils.isESBServerLocation(esbLocation)) ;
+ if (enabled != asEnabled)
+ {
+ asEnabled = enabled ;
+ asLocationField.setText("") ;
+ asLocationLabel.setEnabled(enabled) ;
+ asLocationField.setEnabled(enabled) ;
+ asLocationButton.setEnabled(enabled) ;
+ }
+
+ if (esbLocationValid && asEnabled && !asLocationValid)
+ {
+ setErrorMessage("Invalid Application Server Install Location") ;
+ }
+ setPageComplete(esbLocationValid && (!asEnabled || asLocationValid)) ;
+ }
+
+ /**
+ * Validate the AS location.
+ */
+ private void validateASLocation()
+ {
+ if (asEnabled)
+ {
+ final String asLocation = asLocationField.getText() ;
+
+ asLocationValid = ESBUtils.isASLocation(asLocation) ;
+
+ if (esbLocationValid)
+ {
+ setPageComplete(asLocationValid) ;
+
+ if (!asLocationValid)
+ {
+ setErrorMessage("Invalid Application Server Install Location") ;
+ }
+ else
+ {
+ setErrorMessage(null) ;
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Handle the browse button for the specified location field.
+ * @param locationField The location field.
+ */
+ private void handleBrowse(final Text locationField, final String message)
+ {
+ final String path = getPath(locationField) ;
+ final DirectoryDialog directoryDialog = new DirectoryDialog(locationField.getShell()) ;
+ directoryDialog.setMessage(message) ;
+ directoryDialog.setFilterPath(path) ;
+ final String directory = directoryDialog.open() ;
+ if (directory != null)
+ {
+ locationField.setText(directory) ;
+ }
+ }
+
+ /**
+ * Get the path value for the directory dialog.
+ * @param locationField The text field containing the path.
+ * @return The path value if the directory exists, empty string otherwise.
+ */
+ private String getPath(final Text locationField)
+ {
+ final String pathValue = locationField.getText() ;
+ if (pathValue.length() > 0)
+ {
+ final IPath path = Path.fromOSString(pathValue) ;
+ final IFileStore pathFileStore = EFS.getLocalFileSystem().getStore(path) ;
+ final IFileInfo pathFileInfo = pathFileStore.fetchInfo() ;
+
+ if (pathFileInfo.exists())
+ {
+ return pathValue ;
+ }
+ }
+ return "" ;
+ }
+
+ /**
+ * Get the value of the ESB location.
+ * @return The ESB location or null if not valid.
+ */
+ public String getESBLocation()
+ {
+ if ((esbLocationField != null) && esbLocationValid)
+ {
+ return esbLocationField.getText() ;
+ }
+ return null ;
+ }
+
+ /**
+ * Get the value of the AS location.
+ * @return The AS location or null if not valid.
+ */
+ public String getASLocation()
+ {
+ if ((asLocationField != null) && asLocationValid)
+ {
+ return asLocationField.getText() ;
+ }
+ return null ;
+ }
+}
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/template/build.properties
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/build.properties 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/build.properties 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,3 +0,0 @@
-org.jboss.esb.server.home=/Users/tcunning/jboss-4.0.5.GA
-org.jboss.esb.server.config=messaging
-#org.jboss.esb.server.home=/usr/local/jboss-4.0.5.GA
Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/build.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/build.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/build.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -6,86 +6,12 @@
</description>
<property file="build.properties"/>
-
- <property name="org.jboss.esb.server.deploy.dir"
- value="${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}/deploy"/>
- <property name="root" location="."/>
- <property name="build.dir" value="${root}/build"/>
- <property name="classes" value="${build.dir}/classes" />
-
-
- <path id="compile-classpath">
- <fileset dir="${root}/lib" includes="*.jar"/>
- <fileset dir="${root}/lib/ext" includes="*.jar"/>
- </path>
-
- <path id="exec-classpath">
- <fileset dir="${root}/lib/ext" includes="*.jar" />
- <pathelement location="${classes}" />
- </path>
-
- <target name="clean">
- <delete dir="${build.dir}"/>
- </target>
+ <!-- Import the base Ant build script... -->
+ <import file="${quickstart.conf}/base-build.xml"/>
- <target name="compile">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${classes}" />
- <javac srcdir="${basedir}/src" destdir="${classes}">
- <classpath refid="compile-classpath" />
- </javac>
- </target>
-
- <target name="package-deployment" depends="compile">
- <jar destfile="${build.dir}/${ant.project.name}.esb">
- <fileset dir="${build.dir}/classes" />
- <fileset dir="${build.dir}" includes="*.jar,*.war"/>
- <fileset dir="${build.dir}" includes="deployment.xml"/>
- <fileset dir="${build.dir}" includes="META-INF/**" />
- <fileset dir="${basedir}/src" excludes="**/*.java" /> <!-- Please leave the src dir in here! -->
- <fileset dir="${basedir}" includes="jbm-queue-service.xml"/>
- </jar>
- </target>
-
- <target name="check-properties">
- <condition property="props-set">
- <and>
- <isset property="org.jboss.esb.server.config"/>
- <isset property="org.jboss.esb.server.home"/>
- </and>
- </condition>
- </target>
-
- <target name="deploy-dir-not-set"
- depends="check-properties"
- unless="props-set">
- <echo>ERROR</echo>
- <echo>Please set the org.jboss.esb.server.home and</echo>
- <echo>org.jboss.esb.server.config properties in</echo>
- <echo>build.properties.</echo>
- </target>
-
- <target name="deploy-esb-archive" depends="deploy-dir-not-set"
- if="props-set">
- <copy file="${build.dir}/${ant.project.name}.esb" overwrite="true" todir="${org.jboss.esb.server.deploy.dir}" />
- </target>
-
- <target name="deploy">
- <echo>Deploying Quickstart to JBoss ESB/App Server...</echo>
-
- <mkdir dir="${build.dir}/META-INF" />
- <copy todir="${build.dir}/META-INF">
- <fileset dir="${basedir}" includes="jboss-esb.xml" />
- <fileset dir="${basedir}" includes="deployment.xml" />
- </copy>
-
- <antcall target="package-deployment" />
- <antcall target="deploy-esb-archive" />
- </target>
-
<target name="runtest" depends="compile"
- description="sends a JMS message to queue/quickstart_helloworld_Request_gw">
+ description="sends a JMS message to queue/eclipse_quickstart_helloworld_Request_gw">
<echo>Runs Test JMS Sender</echo>
<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SendJMSMessage" failonerror="true">
<arg value="Hello World"/>
@@ -97,7 +23,7 @@
description="Will send an esb Message">
<echo>Runs Test ESB Message Sender</echo>
<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.helloworld.test.SendEsbMessage" failonerror="true">
- <arg value="FirstServiceESB"/> <!-- service category -->
+ <arg value="FirstEclipseServiceESB"/> <!-- service category -->
<arg value="SimpleListener"/> <!-- service name -->
<arg value="Hello World - Straight to ESB listener - no Gateway"/> <!-- Message text -->
<classpath refid="exec-classpath"/>
Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/deployment.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/deployment.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,4 +1,4 @@
<jbossesb-deployment>
- <depends>jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_esb</depends>
- <depends>jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_gw</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_esb</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_gw</depends>
</jbossesb-deployment>
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service-scoped.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service-scoped.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service-scoped.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<server>
-
- <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
- <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
- </loader-repository>
-
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_esb"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
- <mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_gw"
- xmbean-dd="xmdesc/Queue-xmbean.xml">
- <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
- <depends>jboss.messaging:service=PostOffice</depends>
- </mbean>
-</server>
Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jbm-queue-service.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,18 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<server>
-
- <loader-repository>jboss.messaging:loader=ScopedLoaderRepository
- <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
- </loader-repository>
-
<mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_esb"
+ name="jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_esb"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
<mbean code="org.jboss.jms.server.destination.QueueService"
- name="jboss.messaging.destination:service=Queue,name=quickstart_helloworld_Request_gw"
+ name="jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_gw"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
Added: labs/jbossesb/trunk/product/tools/esbwizard/template/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jbmq-queue-service.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_esb">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=eclipse_quickstart_helloworld_Request_gw">
+ <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+ </mbean>
+</server>
Property changes on: labs/jbossesb/trunk/product/tools/esbwizard/template/jbmq-queue-service.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jboss-esb.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jboss-esb.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -9,13 +9,13 @@
<jms-bus busid="quickstartGwChannel">
<jms-message-filter
dest-type="QUEUE"
- dest-name="queue/quickstart_helloworld_Request_gw"
+ dest-name="queue/eclipse_quickstart_helloworld_Request_gw"
/>
</jms-bus>
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter
dest-type="QUEUE"
- dest-name="queue/quickstart_helloworld_Request_esb"
+ dest-name="queue/eclipse_quickstart_helloworld_Request_esb"
/>
</jms-bus>
@@ -24,7 +24,7 @@
<services>
<service
- category="FirstServiceESB"
+ category="FirstEclipseServiceESB"
name="SimpleListener"
description="Hello World">
<listeners>
Modified: labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/src/org/jboss/soa/esb/samples/quickstart/helloworld/test/SendJMSMessage.java 2007-07-17 21:19:11 UTC (rev 13587)
@@ -52,7 +52,7 @@
Object tmp = iniCtx.lookup("ConnectionFactory");
QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
conn = qcf.createQueueConnection();
- que = (Queue) iniCtx.lookup("queue/quickstart_helloworld_Request_gw");
+ que = (Queue) iniCtx.lookup("queue/eclipse_quickstart_helloworld_Request_gw");
session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
System.out.println("Connection Started");
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/template.jar
===================================================================
(Binary files differ)
Added: labs/jbossesb/trunk/product/tools/updatesite/features/org.jboss.soa.esb.template_1.1.0.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/tools/updatesite/features/org.jboss.soa.esb.template_1.1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/tools/updatesite/plugins/org.jboss.soa.esb.eclipse.template_1.1.0.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/tools/updatesite/plugins/org.jboss.soa.esb.eclipse.template_1.1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/trunk/product/tools/updatesite/site.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/updatesite/site.xml 2007-07-17 21:05:47 UTC (rev 13586)
+++ labs/jbossesb/trunk/product/tools/updatesite/site.xml 2007-07-17 21:19:11 UTC (rev 13587)
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
-<feature id="org.jboss.soa.esb.template" version="1.0.0" url="features/org.jboss.soa.esb.template_1.0.0.jar">
-<category name="org.jboss.soa.esb.template"/>
-</feature>
-<category-def label="JBoss ESB Template 1.0" name="org.jboss.soa.esb.template"/>
+ <feature url="features/org.jboss.soa.esb.template_1.0.0.jar" id="org.jboss.soa.esb.template" version="1.0.0">
+ <category name="org.jboss.soa.esb.template"/>
+ </feature>
+ <feature url="features/org.jboss.soa.esb.template_1.1.0.jar" id="org.jboss.soa.esb.template" version="1.1.0">
+ <category name="org.jboss.soa.esb.template"/>
+ </feature>
+ <category-def name="org.jboss.soa.esb.template" label="JBoss ESB Template"/>
</site>
More information about the jboss-svn-commits
mailing list