[jboss-svn-commits] JBL Code SVN: r17065 - in labs/jbossesb/trunk/product/tools/esbwizard: META-INF and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Dec 6 08:06:07 EST 2007
Author: kevin.conner at jboss.com
Date: 2007-12-06 08:06:06 -0500 (Thu, 06 Dec 2007)
New Revision: 17065
Added:
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/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/template/Activator.java
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/ESBNewWizard.java
labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java
labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml
Removed:
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/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/preferences/ProfileFieldEditor.java
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/util/ESBUtils.java
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/ESBServerPage.java
labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml
Log:
Remove profile patch: JBESB-1365
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/.classpath
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/.classpath 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/.classpath 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="bin" sourcepath="bin"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.jboss.ide.eclipse.jdt.core.classpath.j2ee-1.4"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
Copied: labs/jbossesb/trunk/product/tools/esbwizard/.classpath (from rev 13588, labs/jbossesb/trunk/product/tools/esbwizard/.classpath)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/.classpath (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/.classpath 2007-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Esbwizard Plug-in
-Bundle-SymbolicName: org.jboss.soa.esb.eclipse.template; singleton:=true
-Bundle-Version: 1.1.1
-Bundle-Activator: org.jboss.soa.esb.eclipse.template.Activator
-Bundle-Vendor: JBoss
-Bundle-Localization: plugin
-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.core.filesystem
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-ClassPath: .,
- bin/
Copied: labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF (from rev 13588, labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/META-INF/MANIFEST.MF 2007-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Esbwizard Plug-in
+Bundle-SymbolicName: org.jboss.soa.esb.eclipse.template; singleton:=true
+Bundle-Version: 1.1.1
+Bundle-Activator: org.jboss.soa.esb.eclipse.template.Activator
+Bundle-Vendor: JBoss
+Bundle-Localization: plugin
+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.core.filesystem
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/build.properties
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/build.properties 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/build.properties 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,12 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- .,\
- icons/,\
- template/,\
- lib/,\
- bin/
-jars.compile.order = .,\
- bin/org/
-src.includes = bin/,\
- lib/
Copied: labs/jbossesb/trunk/product/tools/esbwizard/build.properties (from rev 13588, labs/jbossesb/trunk/product/tools/esbwizard/build.properties)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/build.properties (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/build.properties 2007-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ template/,\
+ lib/
+jars.compile.order = .
Deleted: 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 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,40 +0,0 @@
-/*
- * 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";
- /**
- * The Application Server Profile location.
- */
- public static final String AS_PROFILE_LOCATION = "asProfileLocation";
-}
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferenceConstants.java (from rev 13588, 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-12-06 13:06:06 UTC (rev 17065)
@@ -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";
+}
Deleted: 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 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,133 +0,0 @@
-/*
- * 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.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Combo;
-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 ;
- /**
- * The profile field editor.
- */
- private ProfileFieldEditor profileEditor;
-
- /**
- * 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) ;
-
- profileEditor = new ProfileFieldEditor(parent) ;
- addField(profileEditor) ;
- profileEditor.setEnabled(enabled, parent) ;
- profileEditor.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()) ;
- profileEditor.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
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ESBPreferencePage.java (from rev 13588, 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-12-06 13:06:06 UTC (rev 17065)
@@ -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
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ProfileFieldEditor.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ProfileFieldEditor.java 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/preferences/ProfileFieldEditor.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,75 +0,0 @@
-/*
- * 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;
-
-/**
- * The Application Server Profile Directory field editor.
- *
- * @author johnathon
- */
-public class ProfileFieldEditor extends DirectoryFieldEditor
-{
- /**
- * The enabled flag.
- */
- private boolean enabled ;
-
- /**
- * Construct the Application Server Directory Field Editor.
- * @param parent The parent composite.
- */
- public ProfileFieldEditor(Composite parent)
- {
- super(ESBPreferenceConstants.AS_PROFILE_LOCATION, "&Application Server Profile Location:", parent);
- setEmptyStringAllowed(false) ;
- setErrorMessage("Application Server Profile location does not specify a valid Application Server profile");
- }
-
- /**
- * Check the state after a change.
- * Combo read only drop down limits to valid selections (assuming only directories are in the server dir.)
- * @return true if valid, false otherwise.
- */
- protected boolean doCheckState()
- {
- return true ;
- }
-
- /**
- * 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() ;
- }
-}
Deleted: 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-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,75 +0,0 @@
-/*
- * 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 org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * 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";
- // The shared instance
- private static Activator plugin;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- //plugin.getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, Status.OK, "plugin-msg-start", null));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java (from rev 13588, 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 (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/template/Activator.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +1,73 @@
+/*
+ * 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 org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * 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";
+ // The shared instance
+ private static Activator plugin;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Deleted: 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 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,441 +0,0 @@
-/*
- * 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.HashSet;
-import java.util.List;
-import java.util.Set;
-
-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 with a default profile?
- * @param location The specified location.
- * @return true if it is an ESB installation, false otherwise.
- */
- public static boolean isESBServerLocation(final String location)
- {
- return isESBServerLocation(location,"default");
- }
-
- /**
- * Does the specified location represent an ESB Server installation?
- * @param location The specified location.
- * @param profile
- * @return true if it is an ESB installation, false otherwise.
- */
- public static boolean isESBServerLocation(final String location, String profile)
- {
- // 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, profile)) ;
- }
- 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)
- {
- return isESBServerOrESBLocation(location, "default");
- }
-
- /**
- * Does the specified location represent an ESB server or ESB deployment?
- * @param location The specified location.
- * @param profileLocation
- * @return true if it is an App Server or ESB deployment, false otherwise.
- */
- public static boolean isESBServerOrESBLocation(final String location, String profileLocation)
- {
- // 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, profileLocation) || 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 "default" 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)
- {
- return hasDeployESBDirs(location,"default");
- }
-
- /**
- * Are the ESB artifacts in the deploy directory?
- * @param location The base location to check.
- * @param profile
- * @return true if the ESB artifacts are in deploy, false otherwise.
- */
- private static boolean hasDeployESBDirs(final IFileStore location, String profile)
- {
- final IFileStore serverDir = location.getChild("server") ;
- if (isDirectory(serverDir))
- {
- final IFileStore defaultDir = serverDir.getChild(profile) ;
- 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 using default profile.
- * @param esbLocation The ESB location.
- * @return The classpath entries for the artifact classpath.
- * @throws CoreException
- * @throws CoreException for errors.
- */
- public static IClasspathEntry[] getESBServerArtifactClasspath(final String esbLocation) throws CoreException
- {
- return getESBServerArtifactClasspath(esbLocation,"default");
- }
-
- /**
- * Get the artifact classpath for the ESB server.
- * @param esbLocation The ESB location.
- * @param asProfileLocation The AS Profile location.
- * @return The classpath entries for the artifact classpath.
- * @throws CoreException for errors.
- */
- public static IClasspathEntry[] getESBServerArtifactClasspath(final String esbLocation, final String asProfileLocation)
- throws CoreException
- {
- final ArrayList classpathEntries = new ArrayList() ;
- final HashSet jarEntries = new HashSet() ;
- final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
- final IPath deployPath = esbLocationPath.append("server/" + asProfileLocation + "/deploy") ;
-
- addSARArtifactJars(classpathEntries, jarEntries, deployPath, ESB_SAR) ;
- addESBArtifactJars(classpathEntries, jarEntries, deployPath, ESB_ARTIFACTS) ;
- addClientJars(classpathEntries, jarEntries, 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 HashSet jarEntries = new HashSet() ;
- final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
- final IPath asLocationPath = Path.fromOSString(asLocation) ;
-
- final IPath esbLibPath = esbLocationPath.append("lib") ;
- addSARArtifactJars(classpathEntries, jarEntries, esbLibPath, ESB_SAR) ;
- addESBArtifactJars(classpathEntries, jarEntries, esbLibPath, ESB_ARTIFACTS) ;
- addClientJars(classpathEntries, jarEntries, asLocationPath) ;
-
- return (IClasspathEntry[]) classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]) ;
- }
-
- /**
- * Add the SAR artifact jars to the classpath.
- * @param classpathEntries The current classpath list.
- * @param jarEntries The set of jars already added.
- * @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 Set jarEntries, final IPath parent, final String sarArtifact)
- throws CoreException
- {
- final IPath sarLibPath = parent.append(sarArtifact + "/lib") ;
- addAllJars(classpathEntries, jarEntries, sarLibPath) ;
- }
-
- /**
- * Add the ESB artifact jars to the classpath.
- * @param classpathEntries The current classpath list.
- * @param jarEntries The set of jars already added.
- * @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 Set jarEntries, 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, jarEntries, artifactPath) ;
- }
- }
-
- /**
- * Add the App Server client jars to the classpath.
- * @param classpathEntries The current classpath list.
- * @param jarEntries The set of jars already added.
- * @param asRoot The root of the app server install.
- */
- private static void addClientJars(final List classpathEntries, final Set jarEntries, final IPath asRoot)
- {
- final IPath clientJarPath = asRoot.append("client/jbossall-client.jar") ;
- addEntry(classpathEntries, jarEntries, clientJarPath) ;
- }
-
- /**
- * Add all jars in the specified directory.
- * @param classpathEntries The current classpath list.
- * @param jarEntries The set of jars already added.
- * @param directory The directory containing the jars.
- * @throws CoreException for errors.
- */
- private static void addAllJars(final List classpathEntries, final Set jarEntries, 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) ;
- addEntry(classpathEntries, jarEntries, childPath) ;
- }
- }
- }
- }
-
- /**
- * Add the jar entry to the classpath, checking for duplicates.
- * @param classpathEntries The current classpath list.
- * @param jarEntries The set of jars already added.
- * @param jarPath The current jar to add.
- */
- private static void addEntry(final List classpathEntries, final Set jarEntries, final IPath jarPath)
- {
- final String jarName = jarPath.lastSegment() ;
- if (jarEntries.add(jarName))
- {
- classpathEntries.add(JavaCore.newLibraryEntry(jarPath, null, null)) ;
- }
- }
-
- public static String[] getValidProfiles(final String location) {
- final String normalisedLocation = normalise(location) ;
- if (normalisedLocation != null){
- final IPath path = Path.fromOSString(normalisedLocation) ;
- final IFileStore serverDir = EFS.getLocalFileSystem().getStore(path) ;
- try {
- return serverDir.getChild("server").childNames(EFS.NONE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- return null;
- }
-}
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/util/ESBUtils.java (from rev 13588, 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-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +1,380 @@
+/*
+ * 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.HashSet;
+import java.util.List;
+import java.util.Set;
+
+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 HashSet jarEntries = new HashSet() ;
+ final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
+ final IPath deployPath = esbLocationPath.append("server/default/deploy") ;
+
+ addSARArtifactJars(classpathEntries, jarEntries, deployPath, ESB_SAR) ;
+ addESBArtifactJars(classpathEntries, jarEntries, deployPath, ESB_ARTIFACTS) ;
+ addClientJars(classpathEntries, jarEntries, 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 HashSet jarEntries = new HashSet() ;
+ final IPath esbLocationPath = Path.fromOSString(esbLocation) ;
+ final IPath asLocationPath = Path.fromOSString(asLocation) ;
+
+ final IPath esbLibPath = esbLocationPath.append("lib") ;
+ addSARArtifactJars(classpathEntries, jarEntries, esbLibPath, ESB_SAR) ;
+ addESBArtifactJars(classpathEntries, jarEntries, esbLibPath, ESB_ARTIFACTS) ;
+ addClientJars(classpathEntries, jarEntries, asLocationPath) ;
+
+ return (IClasspathEntry[]) classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]) ;
+ }
+
+ /**
+ * Add the SAR artifact jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param jarEntries The set of jars already added.
+ * @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 Set jarEntries, final IPath parent, final String sarArtifact)
+ throws CoreException
+ {
+ final IPath sarLibPath = parent.append(sarArtifact + "/lib") ;
+ addAllJars(classpathEntries, jarEntries, sarLibPath) ;
+ }
+
+ /**
+ * Add the ESB artifact jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param jarEntries The set of jars already added.
+ * @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 Set jarEntries, 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, jarEntries, artifactPath) ;
+ }
+ }
+
+ /**
+ * Add the App Server client jars to the classpath.
+ * @param classpathEntries The current classpath list.
+ * @param jarEntries The set of jars already added.
+ * @param asRoot The root of the app server install.
+ */
+ private static void addClientJars(final List classpathEntries, final Set jarEntries, final IPath asRoot)
+ {
+ final IPath clientJarPath = asRoot.append("client/jbossall-client.jar") ;
+ addEntry(classpathEntries, jarEntries, clientJarPath) ;
+ }
+
+ /**
+ * Add all jars in the specified directory.
+ * @param classpathEntries The current classpath list.
+ * @param jarEntries The set of jars already added.
+ * @param directory The directory containing the jars.
+ * @throws CoreException for errors.
+ */
+ private static void addAllJars(final List classpathEntries, final Set jarEntries, 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) ;
+ addEntry(classpathEntries, jarEntries, childPath) ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Add the jar entry to the classpath, checking for duplicates.
+ * @param classpathEntries The current classpath list.
+ * @param jarEntries The set of jars already added.
+ * @param jarPath The current jar to add.
+ */
+ private static void addEntry(final List classpathEntries, final Set jarEntries, final IPath jarPath)
+ {
+ final String jarName = jarPath.lastSegment() ;
+ if (jarEntries.add(jarName))
+ {
+ classpathEntries.add(JavaCore.newLibraryEntry(jarPath, null, null)) ;
+ }
+ }
+}
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/esb/eclipse/wizards/ESBNewWizard.java 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,277 +0,0 @@
-/*
- * 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();
- //If you are writing an Eclipse plug-in, you can use the services provided by org.eclipse.core.runtime.ILog
- //that is accessed through the method getLog() from your Plugin class.
- //Just create an instance of org.eclipse.core.runtime.Status with the right information and call the log() method on ILog.
- setNeedsProgressMonitor(true);
- Activator.getDefault().getLog().log(new Status(Status.INFO, Activator.PLUGIN_ID, Status.OK, "JRL-plugin-msg-onESBNewWizard", null));
- }
-
- /**
- * 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) ;
- final String asProfileLocation = preferenceStore.getString(ESBPreferenceConstants.AS_PROFILE_LOCATION);
- m_serverPage.setInitialESBLocation(esbLocation) ;
- m_serverPage.setInitialASLocation(asLocation) ;
- m_serverPage.setInitialASProfileLocation(asProfileLocation);
- 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
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java (from rev 13588, 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/ESBNewWizard.java (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBNewWizard.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -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/ESBServerPage.java
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,458 +0,0 @@
-/*
- * 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.Combo;
-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 initial value of the AS Profile location.
- */
- private String initialASProfileLocation ;
-
- /**
- * The ESB location label.
- */
- private Label esbLocationLabel ;
- /**
- * The AS location label.
- */
- private Label asLocationLabel ;
-
- /**
- * The AS Configlocation label.
- */
- private Label asProfileLocationLabel ;
-
- /**
- * The ESB location text field.
- */
- private Text esbLocationField ;
- /**
- * The AS location text field.
- */
- private Text asLocationField ;
- /**
- * The AS Profile location combo
- */
- private Combo asProfileLocationCombo;
-
- /**
- * The ESB browse button.
- */
- private Button esbLocationButton ;
- /**
- * The AS browse button.
- */
- private Button asLocationButton ;
- /**
- * Is the ESB location valid?
- */
- private boolean esbLocationValid = false;
- /**
- * Is the AS location enabled?
- */
- private boolean asEnabled = true ;
- /**
- * Is the AS location valid?
- */
- private boolean asLocationValid = false;
- /**
- * Is the profile selected?
- */
- private boolean asProfileSelected = false;
- /**
- * 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)) ;
-
- addEsbLocation(parent, dataComposite);
-
- addAsLocation(parent, dataComposite);
-
- addProfileLocation(parent, dataComposite);
-
- setErrorMessage(null);
- setMessage(null);
-
- if (initialESBLocation != null)
- {
- esbLocationField.setText(initialESBLocation) ;
- }
- if (asEnabled && (initialASLocation != null))
- {
- asLocationField.setText(initialASLocation) ;
- // validation occured in the pref pane
- asLocationValid = true;
- asLocationField.setEnabled(asLocationValid);
- }
- if (initialASProfileLocation != null){
- asProfileLocationCombo.setText(initialASProfileLocation);
- // validation occured in the pref pane
- asProfileSelected = true;
- asProfileLocationLabel.setVisible(asProfileSelected);
- asProfileLocationCombo.setVisible(asProfileSelected);
- asProfileLocationCombo.setEnabled(asProfileSelected);
- }
- dataComposite.pack(true);
- pageComposite.pack(true);
- setControl(pageComposite);
- }
-
- /**
- * Add the AS Profile widgets
- * @param parent
- * @param dataComposite
- */
- private void addProfileLocation(final Composite parent, final Composite dataComposite) {
- asProfileLocationLabel = new Label(dataComposite, SWT.NONE) ;
- asProfileLocationLabel.setVisible(asLocationValid);
- asProfileLocationLabel.setFont(parent.getFont()) ;
- asProfileLocationLabel.setText("Application Server Profile Location:") ;
-
- asProfileLocationCombo = new Combo(dataComposite, SWT.READ_ONLY);
- asProfileLocationCombo.setVisible(asLocationValid);
- asProfileLocationCombo.setFont(parent.getFont());
- asProfileLocationCombo.pack();
- asProfileLocationCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(final SelectionEvent event) {
- asProfileSelected() ;
- }
-
- });
- }
-
- /**
- * Add the Application Server widgets
- * @param parent
- * @param dataComposite
- */
- private void addAsLocation(final Composite parent, final Composite dataComposite) {
- 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.setEnabled(asEnabled);
- asLocationField.setText("Please choose esb location first");
- asLocationField.addModifyListener(new ModifyListener() {
- public void modifyText(final ModifyEvent event) {
- validateASLocation() ;
- }
- }) ;
-
- asLocationButton = new Button(dataComposite, SWT.PUSH) ;
- asLocationButton.setText(BROWSE_TEXT) ;
- asLocationButton.setEnabled(asEnabled);
- asLocationButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(final SelectionEvent event) {
- handleBrowse(asLocationField, "Application Server Location") ;
- }
- }) ;
- }
-
- /**
- * Add the ESB Server widgets
- * @param parent
- * @param dataComposite
- */
- private void addEsbLocation(final Composite parent, final Composite dataComposite) {
- 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") ;
- }
- }) ;
- }
-
- /**
- * Get the AS Location
- * populate from folders under the servers directory
- **/
- public void populateProfileSelection() {
- asProfileLocationCombo.setItems(ESBUtils.getValidProfiles(asLocationField.getText()));
- asProfileLocationCombo.pack();
- }
-
- /**
- * 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)
- {
- populateProfileSelection();
-
- if (!asLocationValid)
- {
- setErrorMessage("Invalid Application Server Install Location") ;
- }
- else
- {
- asProfileLocationCombo.setVisible(asLocationValid);
- asProfileLocationLabel.setVisible(asLocationValid);
- setErrorMessage(null) ;
- }
- }
- }
-
- }
-
- /**
- * Indicate the AS Profile location has been selected.
- */
- private void asProfileSelected()
- {
- asProfileSelected = true;
- if (asEnabled)
- {
-
- setPageComplete(asProfileSelected) ;
- 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 ;
- }
-
-
- /**
- * Get the value of the AS Profile location.
- * @return The AS Profile location or null if not valid.
- */
- public String getASProfileLocation()
- {
- if (asProfileLocationCombo != null)
- {
- return asProfileLocationCombo.getText() ;
- }
- return null ;
- }
-
- public String getInitialASProfileLocation() {
- return initialASProfileLocation;
- }
-
- public void setInitialASProfileLocation(String initialASProfileLocation) {
- this.initialASProfileLocation = initialASProfileLocation;
- }
-}
Copied: labs/jbossesb/trunk/product/tools/esbwizard/src/org/jboss/soa/esb/eclipse/wizards/ESBServerPage.java (from rev 13588, 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-12-06 13:06:06 UTC (rev 17065)
@@ -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 ;
+ }
+}
Deleted: labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml 2007-12-06 13:05:27 UTC (rev 17064)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml 2007-12-06 13:06:06 UTC (rev 17065)
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- 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-2006,
- @author JBoss Inc.
--->
-<!-- $Id: jbossesb-unittest-properties.xml $ -->
-<!--
- These options are described in the JBossESB manual.
- Defaults are provided here for convenience only.
-
- Please read through this file prior to using the system, and consider
- updating the specified entries.
--->
-<esb
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
- <properties name="core">
- <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
- <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
- <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
- </properties>
- <properties name="registry">
- <property name="org.jboss.soa.esb.registry.queryManagerURI"
- value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
- <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
- value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
- <property name="org.jboss.soa.esb.registry.implementationClass"
- value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
- <property name="org.jboss.soa.esb.registry.factoryClass"
- value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
- <property name="org.jboss.soa.esb.registry.user"
- value="jbossesb"/>
- <property name="org.jboss.soa.esb.registry.password"
- value="password"/>
- <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
- <property name="org.jboss.soa.esb.scout.proxy.transportClass"
- value="org.apache.ws.scout.transport.RMITransport"/>
- </properties>
- <properties name="transports" depends="core">
- <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
- <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
- <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
- <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
- <property name="org.jboss.soa.esb.mail.smtp.auth" value="true"/>
- </properties>
- <properties name="connection">
- <property name="min-pool-size" value="5"/>
- <property name="max-pool=size" value="10"/>
- <property name="blocking-timeout-millis" value="5000"/>
- <property name="abandoned-connection-timeout" value="10000"/>
- <property name="abandoned-connection-time-interval" value="30000"/>
- </properties>
- <properties name="dbstore">
- <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
- <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
- <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
- <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
- <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
- <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
- <!--table managed by pool to test for valid connections - created by pool automatically -->
- <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
- <!-- # of milliseconds to timeout waiting for a connection from pool -->
- <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
- </properties>
- <properties name="messagerouting">
- <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
- </properties>
-</esb>
Copied: labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml (from rev 13588, labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml)
===================================================================
--- labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/tools/esbwizard/template/jbossesb-properties.xml 2007-12-06 13:06:06 UTC (rev 17065)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+</esb>
More information about the jboss-svn-commits
mailing list