Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 68705 Details for
Bug 179329
osgi generation failed with NPE
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
A patch for the problem described
patch.txt (text/plain), 74.32 KB, created by
Andrew Eberbach
on 2007-05-24 22:05:55 EDT
(
hide
)
Description:
A patch for the problem described
Filename:
MIME Type:
Creator:
Andrew Eberbach
Created:
2007-05-24 22:05:55 EDT
Size:
74.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.wsdm.tooling.codegeneration >Index: src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProjectHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration/src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProjectHelper.java,v >retrieving revision 1.3 >diff -u -r1.3 ProjectHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProjectHelper.java 25 Apr 2007 18:35:55 -0000 1.3 >+++ src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProjectHelper.java 25 May 2007 02:04:47 -0000 >@@ -12,7 +12,9 @@ > > package org.eclipse.tptp.wsdm.tooling.provisional.util; > >+import java.io.File; > import java.net.URI; >+import java.net.URL; > > import org.eclipse.core.filesystem.URIUtil; > import org.eclipse.core.resources.ICommand; >@@ -25,8 +27,8 @@ > import org.eclipse.core.runtime.CoreException; > > public abstract class ProjectHelper { >- >- protected IProject getProject(String location, String name) throws CoreException { >+ >+ protected IProject getProject(String location, String name, String natureId, boolean create) throws CoreException { > IWorkspace workspace = ResourcesPlugin.getWorkspace(); > IWorkspaceRoot root = workspace.getRoot(); > >@@ -35,9 +37,13 @@ > URI projectURI = location==null?null:URIUtil.toURI(location); > desc.setLocationURI(projectURI); > >+ if(natureId != null) { >+ addNature(natureId, desc); >+ } >+ > IProject project = root.getProject(name); > >- if(project != null) { >+ if(create && project != null) { > project.create(desc, null); > project.open(null); > } >@@ -45,15 +51,12 @@ > return project; > } > >- public void addNature(String natureId) throws CoreException { >- IProject project = getProject(); >- IProjectDescription description = project.getDescription(); >+ private void addNature(String natureId, IProjectDescription description) throws CoreException { > String[] natures = description.getNatureIds(); > String[] newNatures = new String[natures.length + 1]; > System.arraycopy(natures, 0, newNatures, 0, natures.length); > newNatures[natures.length] = natureId; >- description.setNatureIds(newNatures); >- project.setDescription(description, null); >+ description.setNatureIds(newNatures); > } > > public void refreshProject() throws Exception { >@@ -72,5 +75,9 @@ > getProject().setDescription(desc, null); > } > >+ public static File toFile(URL url) { >+ return new File(url.getFile()); >+ } >+ > public abstract IProject getProject(); > } >Index: src/org/eclipse/tptp/wsdm/tooling/internal/util/PluginProjectHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration/src/org/eclipse/tptp/wsdm/tooling/internal/util/PluginProjectHelper.java,v >retrieving revision 1.3 >diff -u -r1.3 PluginProjectHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/util/PluginProjectHelper.java 26 Apr 2007 22:18:08 -0000 1.3 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/util/PluginProjectHelper.java 25 May 2007 02:04:47 -0000 >@@ -21,8 +21,8 @@ > private static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$ > > public PluginProjectHelper(String projectLocation, String projectName) throws Exception { >- super(projectLocation, projectName); >- addNature(PLUGIN_NATURE); >+ super(projectLocation, projectName, JavaCore.NATURE_ID); >+ initializeClasspath(); > IClasspathEntry cpe = JavaCore.newContainerEntry(Path.fromOSString("org.eclipse.pde.core.requiredPlugins")); //$NON-NLS-1$ > addClasspathEntry(cpe); > } >Index: src/org/eclipse/tptp/wsdm/tooling/internal/util/JavaProjectHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration/src/org/eclipse/tptp/wsdm/tooling/internal/util/JavaProjectHelper.java,v >retrieving revision 1.4 >diff -u -r1.4 JavaProjectHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/util/JavaProjectHelper.java 25 Apr 2007 18:35:55 -0000 1.4 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/util/JavaProjectHelper.java 25 May 2007 02:04:47 -0000 >@@ -31,13 +31,19 @@ > > IProject _project = null; > >- public JavaProjectHelper(String location, String projectName) throws Exception { >- _project = getProject(location, projectName); >- addNature(JavaCore.NATURE_ID); >+ public JavaProjectHelper(String location, String projectName, String natureId) throws Exception { >+ if(natureId == null) { >+ natureId = JavaCore.NATURE_ID; >+ } >+ _project = getProject(location, projectName, natureId, true); > initializeClasspath(); > } >+ >+ public JavaProjectHelper(String location, String projectName) throws Exception { >+ this(location, projectName, JavaCore.NATURE_ID); >+ } > >- private void initializeClasspath() throws JavaModelException { >+ protected void initializeClasspath() throws JavaModelException { > IJavaProject javaProj = JavaCore.create(_project); > javaProj.setRawClasspath(new IClasspathEntry[] {}, null); > addClasspathEntry(JavaRuntime.getDefaultJREContainerEntry()); >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiMiniProjectizer.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiMiniProjectizer.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiMiniProjectizer.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiMiniProjectizer.java 7 May 2007 09:15:19 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,19 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * $Id: EclipseOsgiMiniProjectizer.java,v 1.2 2007/05/07 09:15:19 dnsmith Exp $ >- * >- * Contributors: >- * Balan Subramanian (bsubram@us.ibm.com) >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >- >-import org.apache.muse.tools.generator.projectizer.OsgiMiniProjectizer; >- >-public class EclipseOsgiMiniProjectizer extends OsgiMiniProjectizer { >- >-} >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiProjectizer.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration/src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiProjectizer.java,v >retrieving revision 1.17 >diff -u -r1.17 EclipseOsgiProjectizer.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiProjectizer.java 25 Apr 2007 18:35:55 -0000 1.17 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiProjectizer.java 25 May 2007 02:04:47 -0000 >@@ -49,8 +49,6 @@ > private File[] _additionalJars; > private Object[][] _instances; > >- private int _resourceCounter = 0; >- > private String _projectLocation; > > private String _projectName; >@@ -60,21 +58,26 @@ > > loadParameters(data); > >- PluginProjectHelper helper = createProject(_projectLocation, _projectName); >- >+ PluginProjectHelper helper = createProject(_projectLocation, _projectName); > _targetDirectory = helper.getProjectDirectory(); >- >- File descriptorFile = new File(_targetDirectory, EclipseOsgiProjectizerConstants.MUSE_DESCRIPTOR_FILE); >- >+ > File javaSourceDir = new File(_targetDirectory, OsgiProjectizerConstants.JAVA_SRC_DIR); >+ > createJavaSources(javaSourceDir, _filesMaps); >- >- File wsdldir = new File(_targetDirectory, OsgiProjectizerConstants.WSDL_DIR); >- >+ createArtifacts(javaSourceDir); >+ >+ helper.refreshProject(); >+ } >+ >+ protected void createArtifacts(File javaSourceDir) throws Exception { > createActivatorFile(javaSourceDir, EclipseOsgiProjectizerConstants.ACTIVATOR_FILE_RESOURCE); > > File routerEntriesDir = new File(_targetDirectory,OsgiProjectizerConstants.ROUTER_ENTRIES_DIR); > >+ File descriptorFile = new File(_targetDirectory, EclipseOsgiProjectizerConstants.MUSE_DESCRIPTOR_FILE); >+ >+ File wsdldir = new File(_targetDirectory, OsgiProjectizerConstants.WSDL_DIR); >+ > createManifest(_targetDirectory, EclipseOsgiProjectizerConstants.OSGI_MANIFEST_FILE_RESOURCE, EclipseOsgiProjectizerConstants.OSGI_MANIFEST_FILE); > > for(int i=0; i < _capabilitiesList.length; i++) { >@@ -94,17 +97,21 @@ > } > > createBuildProperties(_targetDirectory, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE_RESOURCE, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE); >- >- helper.refreshProject(); >+ } >+ >+ protected void loadParameters(ConfigurationData data) { >+ super.loadParameters(data); >+ _additionalJars = (File[])data.getParameter(EclipseConfigurationData.ADDITIONAL_JARS); >+ _instances = (Object[][])data.getParameter(EclipseConfigurationData.INSTANCES); >+ _projectName = (String)data.getParameter(EclipseConfigurationData.PROJECT_NAME); >+ _projectLocation = (String)data.getParameter(EclipseConfigurationData.PROJECT_LOCATION); > } > > protected void createRouterEntries(File routerEntriesDir, Object[][] instances) > throws Exception { >- >- routerEntriesDir.mkdirs(); >- >- for(int i=0; i < _instances.length; i++) { >- Object[] instancePair = _instances[i]; >+ >+ for(int i=0; i < instances.length; i++) { >+ Object[] instancePair = instances[i]; > > // > //This is really tacky, but it's the only real way to do this >@@ -117,22 +124,21 @@ > Element instanceElement = (Element) instancePair[1]; > > File serviceDir = new File(routerEntriesDir, resourcePathName); >- File routerEntryFile = new File(serviceDir, getResourceFileName()); >+ File routerEntryFile = new File(serviceDir, getResourceFileName(i)); > > writeToFileCheck(instanceElement, routerEntryFile); > } > } > >- protected String getResourceFileName() { >- return Axis2ProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(_resourceCounter++)); >- } >- >- protected void loadParameters(ConfigurationData data) { >- super.loadParameters(data); >- _additionalJars = (File[])data.getParameter(EclipseConfigurationData.ADDITIONAL_JARS); >- _instances = (Object[][])data.getParameter(EclipseConfigurationData.INSTANCES); >- _projectName = (String)data.getParameter(EclipseConfigurationData.PROJECT_NAME); >- _projectLocation = (String)data.getParameter(EclipseConfigurationData.PROJECT_LOCATION); >+ /** >+ * Get the name of a resource-instance file with the appropriate counter. This is >+ * really just a string-replace of the PLACE_HOLDER value with the given counter >+ * >+ * @param counter The number to use in the string replace >+ * @return The string with PLACE_HOLDER replaced by the string value of counter >+ */ >+ protected String getResourceFileName(int counter) { >+ return Axis2ProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(counter)); > } > > protected void createManifest(File baseTargetDir, String manifestFileResource, String manifestFileName) throws Exception { >@@ -140,7 +146,7 @@ > > String packageName = getSymbolicName().toString(); > >- Object[] filler = { getSymbolicName(), packageName + "." + EclipseOsgiProjectizerConstants.ACTIVATOR_CLASSNAME, getSymbolicName()}; >+ Object[] filler = { getSymbolicName(), makeActivatorName(packageName), getSymbolicName()}; > String newManifest = loadString(manifestTemplateIS, filler); > > newManifest = addAdditionalJars(newManifest); >@@ -149,6 +155,10 @@ > writeToFileCheck(newManifest, manifestFile); > } > >+ protected String makeActivatorName(String packageName) { >+ return packageName + "." + EclipseOsgiProjectizerConstants.ACTIVATOR_CLASSNAME; >+ } >+ > private String addAdditionalJars(String newManifest) throws IOException { > ByteArrayInputStream bais = new ByteArrayInputStream(newManifest.getBytes()); > Manifest manifest = null; >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration/plugin.xml,v >retrieving revision 1.10 >diff -u -r1.10 plugin.xml >--- plugin.xml 1 May 2007 16:40:31 -0000 1.10 >+++ plugin.xml 25 May 2007 02:04:47 -0000 >@@ -24,4 +24,17 @@ > servicePath="/" > servicePort="80"/> > </extension> >+ <extension >+ point="org.eclipse.tptp.wsdm.editor.codeGeneration"> >+ <description >+ container="Mini" >+ platform="OSGi"> >+ </description> >+ <projectizer >+ class="org.eclipse.tptp.wsdm.tooling.internal.projectizer.EclipseOsgiProjectizer" >+ name="OSGi mini" >+ servicePath="/" >+ servicePort="80"> >+ </projectizer> >+ </extension> > </plugin> >Index: src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProgressMonitorHelper.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProgressMonitorHelper.java >diff -N src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProgressMonitorHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/provisional/util/ProgressMonitorHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+package org.eclipse.tptp.wsdm.tooling.provisional.util; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+ >+public class ProgressMonitorHelper { >+ >+ private IProgressMonitor _monitor; >+ >+ public ProgressMonitorHelper(IProgressMonitor monitor) { >+ _monitor = monitor; >+ } >+ >+ public void finishProgressMonitor() { >+ if (_monitor != null) { >+ _monitor.done(); >+ } >+ } >+ >+ public void recordProgress(int i) { >+ if (_monitor != null) { >+ _monitor.worked(1); >+ } >+ } >+ >+ public void startProgressMonitor(int i) { >+ if(_monitor != null) { >+ _monitor.beginTask("Running Projectizer", i); >+ } >+ } >+ >+ public void recordProgress() { >+ recordProgress(1); >+ } >+} >#P org.eclipse.tptp.wsdm.editor >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java,v >retrieving revision 1.11 >diff -u -r1.11 GenerationOptionsPage.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java 1 May 2007 16:40:34 -0000 1.11 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/GenerationOptionsPage.java 25 May 2007 02:04:48 -0000 >@@ -34,6 +34,7 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.dialogs.DialogPage; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.util.Util; > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.osgi.util.TextProcessor; >@@ -56,7 +57,9 @@ > import org.eclipse.tptp.wsdm.tooling.editor.internal.Activator; > import org.eclipse.tptp.wsdm.tooling.editor.mrt.relationship.dialog.internal.MemoryComboBox; > import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; >+import org.eclipse.tptp.wsdm.tooling.preferences.internal.Axis2ServerLocationPreferencePage; > import org.eclipse.tptp.wsdm.tooling.util.internal.Validation; >+import org.eclipse.tptp.wsdm.tooling.validation.util.internal.ValidationUtils; > > /** > * This wizard enables the use to specify the projectizer options and also the >@@ -94,12 +97,21 @@ > > private Label _containerLabel; > >+ private Listener _containerComboListener = new Listener() { >+ >+ public void handleEvent(Event event) { >+ dialogChanged(); >+ } >+ >+ }; >+ > public GenerationOptionsPage() { > super("wizardPage"); > setTitle(Messages.HOOKUP_WIZARD_TXT1); > setDescription(Messages.HOOKUP_WIZARD_TXT2); > > loadExtensionData(); >+ setPageComplete(false); > } > > private void loadExtensionData() { >@@ -109,7 +121,7 @@ > > for (int i = 0; i < extensions.length; i++) { > IConfigurationElement[] elements = extensions[i].getConfigurationElements(); >- CodeGenerationData codeGenData = new CodeGenerationData(elements); >+ CodeGenerationData codeGenData = new CodeGenerationData(elements); > updatePlatformContainerMap(codeGenData); > } > } >@@ -138,7 +150,6 @@ > > public void createControl(Composite parent) { > setControl(doLayout(parent)); >- dialogChanged(); > } > > private Composite doLayout(Composite parent) { >@@ -273,6 +284,7 @@ > Combo combo = new Combo(page, SWT.BORDER | SWT.READ_ONLY); > combo.setEnabled(false); > >+ combo.addListener(SWT.Modify, _containerComboListener); > return combo; > } > >@@ -465,7 +477,6 @@ > { > public void handleEvent(Event e) > { >- setLocationForSelection(); > dialogChanged(); > } > }; >@@ -475,6 +486,7 @@ > String platform = _projectizerCombo.getText(); > > Map containerCodeGenDataMap = (Map) _platformContainerMap.get(platform); >+ _containerCombo.removeListener(SWT.Modify, _containerComboListener); > _containerCombo.removeAll(); > > boolean hasContainers = containerCodeGenDataMap.size() != 0; >@@ -486,21 +498,18 @@ > _containerCombo.select(0); > } > >+ _containerCombo.addListener(SWT.Modify, _containerComboListener); > _containerCombo.setEnabled(hasContainers); > _containerLabel.setEnabled(hasContainers); > > dialogChanged(); > } > }; >- >- void setLocationForSelection() >- { >-// _locationArea.updateProjectName(getProjectNameFieldValue()); >- } > >+ private TargetedFileList[] _filesToCopy; >+ > protected void dialogChanged() > { >- if(true) return; > String prjName = getProjectName(); > > if (prjName.length() == 0) >@@ -526,8 +535,6 @@ > return; > } > >- canFlipToNextPage(); >- > updateStatus(null, DialogPage.NONE); > } > >@@ -551,7 +558,7 @@ > > public boolean shouldPersistArtifacts() > { >- return _persistExtraArtifactsButton.isEnabled(); >+ return _persistExtraArtifactsButton.getSelection(); > } > > /** >@@ -632,37 +639,10 @@ > > return baseAddress; > } >- >- /** >- * Checks to see if the Next Page can be enabled or not. >- */ >- public boolean canFlipToNextPage(){ >- return true; >-// Axis2ServerLocationPage nextPage = (Axis2ServerLocationPage)this.getNextPage(); >-// if(isPageComplete() && isAxis2Project()) >-// { >-// nextPage.makePageComplete(false); >-// String userLocation = nextPage.getUserDefinedLocation(); >-// if(userLocation != null && userLocation.trim().length() > 0) >-// { >-// nextPage._serverNameField.setText(userLocation); >-// }else >-// { >-// nextPage._serverNameField.setText(nextPage.getPreferenceServerLocation()); >-// } >-// >-// return true; >-// } >-// >-// nextPage.makePageComplete(true); >-// >-// return false; >- } > >- /** >- * Returns whether the new Project to be created is a Axis2 project >- * @return >- */ >+ public boolean canFlipToNextPage() { >+ return isPageComplete() && isAxis2Project(); >+ } > public boolean isAxis2Project(){ > String container = getSelectedData().getContainer(); > return container != null && container.equals("Axis2"); >@@ -671,4 +651,41 @@ > public void saveCombo() { > MemoryComboBox.save(_projectNameField, PROJECT_MEMORY_COMBO_ID, Preferences.userNodeForPackage(GenerationOptionsPage.class)); > } >+ >+ private String validateLocation() >+ { >+ String serverHome = getPreferenceServerLocation(); >+ >+ ISoapServerDependency axisValidators[] = ValidationUtils.getAllAxisValidators(); >+ for(int i = 0 ; i < axisValidators.length ; i++){ >+ >+ ISoapServerDependency axis2Dependency = (Axis2ServerDependency)axisValidators[i]; >+ String errorMessage = axis2Dependency.validateSoapServerHome(serverHome); >+ if(errorMessage!=null) >+ return errorMessage; >+ _filesToCopy = axis2Dependency.getFilesToCopy(); >+ if(_filesToCopy == null) >+ _filesToCopy = new TargetedFileList[0]; >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the Axis2 files to copied to generated code >+ * @return >+ */ >+ public TargetedFileList[] getAxis2FilesToCopy() >+ { >+ validateLocation(); >+ return _filesToCopy; >+ } >+ >+ protected String getPreferenceServerLocation() >+ { >+ IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >+ String location = store.getString(Axis2ServerLocationPreferencePage.SERVER_LOCATION_PREFERENCE_KEY).trim(); >+ if(location != null && !location.equals("")) >+ return location; >+ return ""; >+ } > } >\ No newline at end of file >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java,v >retrieving revision 1.17 >diff -u -r1.17 NewProjectWizard.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java 27 Apr 2007 12:31:32 -0000 1.17 >+++ src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/NewProjectWizard.java 25 May 2007 02:04:48 -0000 >@@ -64,8 +64,6 @@ > > private GenerationOptionsPage _generationOptionsPage; > >- private Axis2ServerLocationPage _axis2ServerLocationPage; >- > private String _projectName; > > private boolean _overwrite; >@@ -115,9 +113,6 @@ > _generationOptionsPage = new GenerationOptionsPage(); > addPage(_generationOptionsPage); > >- _axis2ServerLocationPage = new Axis2ServerLocationPage(); >- addPage(_axis2ServerLocationPage); >- > // TODO AME why is this hardcoded here? why is it getting reloaded? > Image imgTP = EclipseUtils.loadImage(PlatformUI.getWorkbench().getDisplay(), > "icons/wizban/newEndpointProject_wiz.gif"); >@@ -151,7 +146,7 @@ > _serverLocation); > // Update the Lib and module location > } >- _requiredAxis2Files = _axis2ServerLocationPage.getAxis2FilesToCopy(); >+ _requiredAxis2Files = _generationOptionsPage.getAxis2FilesToCopy(); > } catch (Exception e) { > throw new RuntimeException(e); > } >@@ -214,15 +209,12 @@ > _projectLocation = _generationOptionsPage.getProjectLocation(); > > if (_isAxis2Project) { >- _serverLocation = _axis2ServerLocationPage.getServerLocation(); >- updatePreference = _axis2ServerLocationPage.isUpdatePreference(); >- popupAxis2LicenseDialog(); >+ _serverLocation = _generationOptionsPage.getPreferenceServerLocation(); > } > > IRunnableWithProgress runnable = new IRunnableWithProgress() { > public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >- if (!_isAxis2Project || _licenseAccepted) >- performFinish(monitor); >+ performFinish(monitor); > } > }; > >@@ -303,11 +295,9 @@ > > private void handle(String message, Exception e) { > _generationOptionsPage.setErrorMessage(message); >- _axis2ServerLocationPage.setErrorMessage(message); >- > WsdmToolingLog.log(IStatus.ERROR, IStatus.OK, message, e); > } >- >+ > private void openTasksView() { > IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); > ViewPart view = (ViewPart) page.findView(TASK_VIEW_ID); >@@ -323,5 +313,8 @@ > page.activate(view); > } > } >- >+ >+ public boolean canFinish() { >+ return _generationOptionsPage.isPageComplete(); >+ } > } >Index: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/Axis2ServerLocationPage.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/Axis2ServerLocationPage.java >diff -N src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/Axis2ServerLocationPage.java >--- src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/Axis2ServerLocationPage.java 19 Apr 2007 19:06:17 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,232 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Balan Subramanian (bsubram@us.ibm.com) >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional; >- >-import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.jface.wizard.WizardPage; >-import org.eclipse.osgi.util.TextProcessor; >-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.eclipse.tptp.wsdm.tooling.editor.internal.Activator; >-import org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages; >-import org.eclipse.tptp.wsdm.tooling.preferences.internal.Axis2ServerLocationPreferencePage; >-import org.eclipse.tptp.wsdm.tooling.validation.util.internal.ValidationUtils; >- >-/** >- * This is Wizard Page to show the Axis2 server location details >- * >- */ >-public class Axis2ServerLocationPage extends WizardPage >-{ >- >- protected Text _serverNameField; >- private Button _browseButton; >- private Button _preferenceUpdate; >- private TargetedFileList[] _filesToCopy; >- >- private String userDefinedLocation =""; >- >- /** >- * Instantiates the class. >- */ >- public Axis2ServerLocationPage() >- { >- super("wizardPage"); >- setTitle(Messages.HOOKUP_WIZARD_TXT1); >- setDescription(Messages.HOOKUP_WIZARD_TXT2); >- } >- >- /** >- * Creates wizard controls. >- */ >- public void createControl(Composite parent) >- { >- Composite page = new Composite(parent, SWT.NULL); >- GridLayout layout = new GridLayout(1, false); >- page.setLayout(layout); >- createPageControls(page); >- //dialogChanged(); >- setControl(page); >- } >- >- private void createPageControls(Composite page) >- { >- Composite column = new Composite(page, SWT.NULL); >- GridLayout layout = new GridLayout(2, false); >- column.setLayout(layout); >- createServerLocationColumn(column); >- } >- >- private void createServerLocationColumn(Composite parent) >- { >- GridData data = new GridData(GridData.FILL_HORIZONTAL); >- data.horizontalSpan = 2; >- // new server location label >- Label serverLabel = new Label(parent, SWT.NONE); >- serverLabel.setText(Messages.CODE_GEN_AXIS2_LOCATION); >- serverLabel.setFont(parent.getFont()); >- serverLabel.setLayoutData(data); >- >- // server location entry field >- data = new GridData(GridData.FILL_HORIZONTAL); >- data.widthHint = 350; >- data.horizontalSpan = 1; >- _serverNameField = new Text(parent, SWT.BORDER); >- _serverNameField.setLayoutData(data); >- _serverNameField.setFont(parent.getFont()); >- _serverNameField.addModifyListener(new ModifyListener() >- { >- public void modifyText(ModifyEvent e) >- { >- boolean pageCompleted = true; >- userDefinedLocation = _serverNameField.getText(); >- String errorMsg = validateLocation(); >- if(errorMsg == null) >- { >- setErrorMessage(errorMsg); >- pageCompleted = true; >- } >- else >- { >- setErrorMessage(errorMsg); >- pageCompleted = false; >- } >- makePageComplete(pageCompleted); >- } >- }); >- >- // _serverNameField.setText(getPreferenceServerLocation()); >- >- // browse button >- _browseButton = new Button(parent, SWT.PUSH); >- _browseButton.setText(Messages.HOOKUP_WIZARD_TXT5); >- _browseButton.addSelectionListener(new SelectionAdapter() >- { >- public void widgetSelected(SelectionEvent event) >- { >- handleLocationBrowseButtonPressed(); >- } >- }); >- >- // server location entry field >- data = new GridData(GridData.FILL_HORIZONTAL); >- //data.widthHint = 350; >- data.horizontalSpan = 2; >- _preferenceUpdate = new Button(parent, SWT.CHECK); >- _preferenceUpdate.setText(Messages.CODE_GEN_UPDATE_PREF); >- _preferenceUpdate.setLayoutData(data); >- _preferenceUpdate.setFont(parent.getFont()); >- } >- >- protected String getPreferenceServerLocation() >- { >- IPreferenceStore store = Activator.getPlugin().getPreferenceStore(); >- String location = store.getString(Axis2ServerLocationPreferencePage.SERVER_LOCATION_PREFERENCE_KEY).trim(); >- if(location != null && !location.equals("")) >- return location; >- return ""; >- } >- >- private void handleLocationBrowseButtonPressed() >- { >- >- String selectedDirectory = null; >- >- DirectoryDialog dialog = new DirectoryDialog(_serverNameField.getShell()); >- dialog.setMessage(Messages.CODE_GEN_DIR_LOCATION); >- //dialog.setFilterPath(dirName); >- selectedDirectory = dialog.open(); >- >- if (selectedDirectory != null) >- updateLocationField(selectedDirectory); >- >- } >- >- private void updateLocationField(String selectedPath) >- { >- _serverNameField.setText(TextProcessor.process(selectedPath)); >- } >- >- /** >- * Returns the server location. >- * @return >- */ >- public String getServerLocation() >- { >- return _serverNameField.getText(); >- } >- >- /** >- * Checks to see if Update Preferences checkbox is selected >- * @return >- */ >- public boolean isUpdatePreference() >- { >- return _preferenceUpdate.getSelection(); >- } >- >- private String validateLocation() >- { >- String serverHome = _serverNameField.getText(); >- >- ISoapServerDependency axisValidators[] = ValidationUtils.getAllAxisValidators(); >- for(int i = 0 ; i < axisValidators.length ; i++){ >- >- ISoapServerDependency axis2Dependency = (Axis2ServerDependency)axisValidators[i]; >- String errorMessage = axis2Dependency.validateSoapServerHome(serverHome); >- if(errorMessage!=null) >- return errorMessage; >- _filesToCopy = axis2Dependency.getFilesToCopy(); >- if(_filesToCopy == null) >- _filesToCopy = new TargetedFileList[0]; >- } >- return null; >- } >- >- /** >- * Returns the Axis2 files to copied to generated code >- * @return >- */ >- public TargetedFileList[] getAxis2FilesToCopy() >- { >- return _filesToCopy; >- } >- >- /** >- * Method to Set the Wizard page to complete state >- * @param validPage >- */ >- public synchronized void makePageComplete(boolean completePage) >- { >- if(completePage){ >- setPageComplete(true); >- } >- else >- setPageComplete(false); >- } >- >- protected String getUserDefinedLocation() >- { >- return userDefinedLocation; >- } >-} >Index: src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.editor/src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties,v >retrieving revision 1.19 >diff -u -r1.19 messages.properties >--- src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 27 Apr 2007 22:58:07 -0000 1.19 >+++ src/org/eclipse/tptp/wsdm/tooling/nls/messages/mrt/internal/messages.properties 25 May 2007 02:04:48 -0000 >@@ -32,7 +32,7 @@ > SYSTEM_CAPS_ERROR_2 = IWAT0646E Access Denied > HOOKUP_WIZARD_TXT1 = Deployment target and generation options > HOOKUP_WIZARD_TXT2 = This wizard creates code for touchpoint >-HOOKUP_WIZARD_TXT3 = Overwrite files if necessary >+HOOKUP_WIZARD_TXT3 = Overwrite files > HOOKUP_WIZARD_PERSIST = Persist generated artifacts > HOOKUP_WIZARD_TXT4 = Output project > HOOKUP_WIZARD_TXT5 = Browse... >#P org.eclipse.tptp.wsdm.tooling.codegeneration.j2ee >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizer.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration.j2ee/src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizer.java,v >retrieving revision 1.1 >diff -u -r1.1 EclipseJ2EEMiniProjectizer.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizer.java 1 May 2007 16:40:38 -0000 1.1 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizer.java 25 May 2007 02:04:49 -0000 >@@ -1,7 +1,292 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Andrew Eberbach (aeberbac@us.ibm.com) >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ > package org.eclipse.tptp.wsdm.tooling.internal.projectizer; > >+import java.io.File; >+import java.io.FileNotFoundException; >+import java.io.InputStream; >+import java.net.URL; >+import java.util.Map; >+ > import org.apache.muse.tools.generator.projectizer.J2EEMiniProjectizer; >+import org.apache.muse.tools.generator.util.ConfigurationData; >+import org.apache.muse.util.FileUtils; >+import org.apache.muse.ws.resource.metadata.MetadataDescriptor; >+import org.apache.muse.ws.wsdl.WsdlUtils; >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional.EclipseConfigurationData; >+import org.eclipse.tptp.wsdm.tooling.internal.util.WebProjectHelper; >+import org.eclipse.tptp.wsdm.tooling.provisional.util.ProgressMonitorHelper; >+import org.eclipse.tptp.wsdm.tooling.provisional.util.ProjectHelper; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; > > public class EclipseJ2EEMiniProjectizer extends J2EEMiniProjectizer { >+ private static final String[] LIB_BUNDLE_IDS = { >+ "org.apache.muse.api", //$NON-NLS-1$ >+ "org.apache.muse.impl", //$NON-NLS-1$ >+ "org.apache.muse.core", //$NON-NLS-1$ >+ "org.apache.muse.tools", //$NON-NLS-1$ >+ "org.apache.muse.utils" //$NON-NLS-1$ >+ }; >+ >+ private static final String CONTAINER_BUNDLE = "org.apache.muse.tools";//$NON-NLS-1$ >+ private static final String CONTAINER_RESOURCE = "/containers/muse-platform-mini-2.2.0.jar";//$NON-NLS-1$ >+ >+ private String _projectName; >+ private String _projectLocation; >+ private File[] _additionalJars; >+ private Object[][] _instances; >+ private ProgressMonitorHelper _progressMonitorHelper; >+ >+ public void projectize(ConfigurationData configuration) throws Exception { >+ ConfigurationData.checkConfiguration(this, configuration); >+ loadParameters(configuration); >+ ProgressMonitorHelper progressHelper = getProgressMonitor(); >+ progressHelper.startProgressMonitor(6); >+ >+ try { >+ WebProjectHelper helper = createProjectHelper(); >+ >+ helper.setSuspendValidation(true); >+ >+ createJavaSources(helper, progressHelper); >+ createArtifacts(helper, progressHelper); >+ createLibraries(helper, progressHelper); >+ >+ helper.refreshProject(); >+ helper.setSuspendValidation(false); >+ } finally { >+ progressHelper.finishProgressMonitor(); >+ } >+ } >+ >+ protected void createLibraries(WebProjectHelper helper, ProgressMonitorHelper progressHelper) throws Exception { >+ copyLibrariesFromBundles(helper, LIB_BUNDLE_IDS); >+ progressHelper.recordProgress(); >+ >+ copyAdditionalJars(helper); >+ progressHelper.recordProgress(); >+ >+ copyContainer(helper); >+ progressHelper.recordProgress(); >+ } >+ >+ protected void copyContainer(WebProjectHelper helper) throws Exception { >+ File webInfLibDir = new File(helper.getProjectDirectory(), EclipseJ2EEMiniProjectizerConstants.WEBINFLIB_DIR); >+ URL url = Platform.getBundle(CONTAINER_BUNDLE).getEntry(CONTAINER_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File libSource = ProjectHelper.toFile(url); >+ FileUtils.copy(libSource, webInfLibDir); >+ } >+ >+ protected void copyAdditionalJars(WebProjectHelper helper) throws Exception { >+ File webInfLibDir = new File(helper.getProjectDirectory(), EclipseJ2EEMiniProjectizerConstants.WEBINFLIB_DIR); >+ >+ File[] additionalJars = getAdditionalJars(); >+ >+ if(additionalJars != null) { >+ for (int i=0; i < additionalJars.length; i++) { >+ if(!additionalJars[i].exists()) { >+ throw new FileNotFoundException(additionalJars[i].getAbsolutePath()); >+ } >+ >+ FileUtils.copyFile(additionalJars[i], webInfLibDir); >+ } >+ } >+ } >+ >+ protected void copyLibrariesFromBundles(WebProjectHelper helper, String[] libBundleIds) throws Exception { >+ URL url = null; >+ File webInfDir = new File(helper.getProjectDirectory(), EclipseJ2EEMiniProjectizerConstants.WEBINF_DIR); >+ >+ for (int i=0; i < libBundleIds.length; i++) { >+ url = Platform.getBundle(libBundleIds[i]).getEntry(EclipseJ2EEMiniProjectizerConstants.PROJECT_LIB_DIR_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File libSource = ProjectHelper.toFile(url); >+ FileUtils.copyDirectory(libSource, webInfDir); >+ } >+ } >+ >+ protected WebProjectHelper createProjectHelper() throws Exception { >+ return new WebProjectHelper( >+ getProjectName(), >+ getProjectLocation(), >+ EclipseJ2EEMiniProjectizerConstants.JAVA_BIN_DIR, >+ EclipseJ2EEMiniProjectizerConstants.JAVA_SRC_DIR); >+ } >+ >+ protected void createJavaSources(WebProjectHelper helper, ProgressMonitorHelper progressHelper) throws Exception { >+ File javaSourceDir = new File( >+ helper.getProjectDirectory(), >+ EclipseJ2EEMiniProjectizerConstants.JAVA_SRC_DIR); >+ >+ createJavaSources(javaSourceDir, getFilesMaps()); >+ progressHelper.recordProgress(); >+ } >+ >+ protected void createArtifacts(WebProjectHelper helper, ProgressMonitorHelper progressHelper) throws Exception { >+ File descriptorFile = new File( >+ helper.getProjectDirectory(), >+ EclipseJ2EEMiniProjectizerConstants.DESCRIPTOR_FILE); >+ >+ File wsdldir = new File( >+ helper.getProjectDirectory(), >+ EclipseJ2EEMiniProjectizerConstants.WSDL_DIR); >+ >+ File routerEntriesDir = new File( >+ helper.getProjectDirectory(), >+ EclipseJ2EEMiniProjectizerConstants.ROUTER_ENTRIES_DIR); >+ >+ for(int i=0; i < getNumCapabilityMaps(); i++) { >+ Map capabilities = getCapabilityMap(i); >+ MetadataDescriptor rmd = getMetadata(i); >+ Document wsdl = getWsdl(i); >+ >+ createDescriptor(getDescriptor(), >+ wsdl, >+ descriptorFile, >+ capabilities, >+ EclipseJ2EEMiniProjectizerConstants.WSDL_RELATIVE_PATH, >+ i); >+ >+ createRMDFile(rmd, wsdl, wsdldir); >+ createWSDLFile(wsdl, wsdldir); >+ >+ if(getInstances() == null) { >+ createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]); >+ } >+ } >+ >+ progressHelper.recordProgress(); >+ >+ if(getInstances() != null) { >+ createRouterEntries(routerEntriesDir, getInstances()); >+ } >+ >+ createWebDescriptor(helper); >+ createBuildFile(helper.getProjectDirectory(), >+ EclipseJ2EEMiniProjectizerConstants.BUILD_FILE_RESOURCE, >+ EclipseJ2EEMiniProjectizerConstants.BUILD_FILE); >+ >+ progressHelper.recordProgress(); >+ } >+ >+ protected void createBuildFile(File baseTargetDir, String buildFileResource, String buildFile) throws Exception { >+ InputStream buildTemplate = FileUtils.loadFromContext(this.getClass(),buildFileResource); >+ File build = new File(baseTargetDir, buildFile); >+ copyStreamCheck(buildTemplate, build); >+ } >+ >+ protected void createWebDescriptor(WebProjectHelper helper) throws Exception { >+ File webInfDir = new File(helper.getProjectDirectory(),EclipseJ2EEMiniProjectizerConstants.WEBINF_DIR); >+ File descriptorFile = new File(webInfDir, EclipseJ2EEMiniProjectizerConstants.WEBXML_FILE); >+ if(!descriptorFile.delete()) { >+ throw new Exception(); >+ } >+ createFileFromResource(webInfDir, >+ EclipseJ2EEMiniProjectizerConstants.WEBXML_RESOURCE, >+ EclipseJ2EEMiniProjectizerConstants.WEBXML_FILE); >+ } >+ >+ protected Map getCapabilityMap(int index) { >+ return _capabilitiesList[index]; >+ } >+ >+ protected void createRouterEntries(File routerEntriesDir,Object[][] instances) throws Exception { >+ routerEntriesDir.mkdirs(); >+ >+ for (int i = 0; i < getInstances().length; i++) { >+ Object[] instancePair = getInstances()[i]; >+ >+ // >+ // This is really tacky, but it's the only real way to do this >+ // since there are no pairs. The File use is to get the last element >+ // of the path in a nice, non-hack way. >+ // >+ String path = (String) instancePair[0]; >+ String resourcePathName = new File(path).getName(); >+ >+ Element instanceElement = (Element) instancePair[1]; >+ >+ File serviceDir = new File(routerEntriesDir, resourcePathName); >+ File routerEntryFile = new File(serviceDir, getResourceFileName(i)); >+ >+ writeToFileCheck(instanceElement, routerEntryFile); >+ } >+ } >+ >+ /** >+ * Get the name of a resource-instance file with the appropriate counter. This is >+ * really just a string-replace of the PLACE_HOLDER value with the given counter >+ * >+ * @param counter The number to use in the string replace >+ * @return The string with PLACE_HOLDER replaced by the string value of counter >+ */ >+ protected String getResourceFileName(int counter) { >+ return EclipseJ2EEMiniProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(counter)); >+ } >+ >+ protected void loadParameters(ConfigurationData data) { >+ super.loadParameters(data); >+ >+ _additionalJars = (File[]) data.getParameter(EclipseConfigurationData.ADDITIONAL_JARS); >+ _instances = (Object[][]) data.getParameter(EclipseConfigurationData.INSTANCES); >+ _progressMonitorHelper = new ProgressMonitorHelper((IProgressMonitor) data.getParameter(EclipseConfigurationData.PROGRESS_MONITOR)); >+ _projectName = (String) data.getParameter(EclipseConfigurationData.PROJECT_NAME); >+ _projectLocation = (String) data.getParameter(EclipseConfigurationData.PROJECT_LOCATION); >+ } >+ >+ protected File[] getAdditionalJars() { >+ return _additionalJars; >+ } >+ >+ protected Map[] getFilesMaps() { >+ return _filesMaps; >+ } >+ >+ protected String getProjectLocation() { >+ return _projectLocation; >+ } >+ >+ protected String getProjectName() { >+ return _projectName; >+ } >+ >+ protected ProgressMonitorHelper getProgressMonitor() { >+ return _progressMonitorHelper; >+ } >+ >+ protected Object[][] getInstances() { >+ return _instances; >+ } >+ >+ protected Document getDescriptor() { >+ return _descriptor; >+ } >+ >+ protected int getNumCapabilityMaps() { >+ return _capabilitiesList.length; >+ } >+ >+ protected Document getWsdl(int index) { >+ return _wsdls[index]; >+ } > >+ protected MetadataDescriptor getMetadata(int index) { >+ return _metadatas[index]; >+ } > } >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2Projectizer.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2Projectizer.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2Projectizer.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2Projectizer.java 25 Apr 2007 18:35:59 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,272 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Balan Subramanian (bsubram@us.ibm.com) >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >- >- >-import java.io.File; >-import java.io.FileNotFoundException; >-import java.net.URL; >-import java.util.Map; >- >-import org.apache.muse.tools.generator.projectizer.Axis2ProjectizerConstants; >-import org.apache.muse.tools.generator.projectizer.J2EEAxis2Projectizer; >-import org.apache.muse.tools.generator.util.ConfigurationData; >-import org.apache.muse.tools.generator.util.ServicesDescriptorHelper; >-import org.apache.muse.util.FileUtils; >-import org.apache.muse.ws.resource.metadata.MetadataDescriptor; >-import org.apache.muse.ws.wsdl.WsdlUtils; >-import org.eclipse.core.runtime.FileLocator; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional.EclipseConfigurationData; >-import org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional.TargetedFileList; >-import org.eclipse.tptp.wsdm.tooling.internal.codegeneration.Activator; >-import org.eclipse.tptp.wsdm.tooling.internal.util.WebProjectHelper; >-import org.w3c.dom.Document; >-import org.w3c.dom.Element; >- >-/** >- * Construct the projectizer for code generation >- */ >-public class EclipseAxis2Projectizer extends J2EEAxis2Projectizer { >- >- private static final String[] LIB_BUNDLE_IDS = { >- "org.apache.muse.api", //$NON-NLS-1$ >- "org.apache.muse.impl", //$NON-NLS-1$ >- "org.apache.muse.core", //$NON-NLS-1$ >- "org.apache.muse.tools", //$NON-NLS-1$ >- "org.apache.muse.utils" //$NON-NLS-1$ >- }; >- >- private static final String[] MODULE_BUNDLE_IDS = { >- "org.apache.muse.tools", //$NON-NLS-1$ >- }; >- >- private File[] _additionalJars; >- private Object[][] _instances; >- private IProgressMonitor _progressMonitor; >- private TargetedFileList[] _filesToCopy; >- >- private int _resourceCounter = 0; >- >- private String _projectName; >- >- private String _projectLocation; >- >- public void projectize(ConfigurationData configuration) throws Exception { >- >- ConfigurationData.checkConfiguration(this, configuration); >- >- try { >- >- loadParameters(configuration); >- >- startProgressMonitor(_progressMonitor, 10); >- >- WebProjectHelper helper = createProject(); >- >- _targetDirectory = helper.getProjectDirectory(); >- >- recordProgress(_progressMonitor, 1); >- >- helper.setSuspendValidation(true); >- >- File webContentDir = copyTemplate(_targetDirectory); >- recordProgress(_progressMonitor, 1); >- >- File descriptorFile = new File( >- webContentDir, >- Axis2ProjectizerConstants.DESCRIPTOR_FILE); >- >- File javaSourceDir = new File( >- _targetDirectory, >- Axis2ProjectizerConstants.JAVA_SRC_DIR); >- >- createJavaSources(javaSourceDir, _filesMaps); >- recordProgress(_progressMonitor, 1); >- >- File wsdldir = new File( >- webContentDir, >- Axis2ProjectizerConstants.WSDL_DIR); >- >- File routerEntriesDir = new File(webContentDir,Axis2ProjectizerConstants.ROUTER_ENTRIES_DIR); >- >- ServicesDescriptorHelper servicesHelper = new ServicesDescriptorHelper(); >- >- createBuildFile(_targetDirectory, EclipseAxis2ProjectizerConstants.BUILD_FILE_RESOURCE, EclipseAxis2ProjectizerConstants.BUILD_FILE); >- recordProgress(_progressMonitor, 1); >- >- for(int i=0; i < _capabilitiesList.length; i++) { >- Map capabilities = _capabilitiesList[i]; >- Document wsdl = _wsdls[i]; >- createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, i); >- MetadataDescriptor rmd = _metadatas[i]; >- createRMDFile(rmd, wsdl, wsdldir); >- createWSDLFile(wsdl, wsdldir); >- if(_instances == null) { >- createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]); >- } >- updateServicesDescriptor(servicesHelper, wsdl, capabilities); >- } >- >- if(_instances != null) { >- createRouterEntries(routerEntriesDir, _instances); >- } >- recordProgress(_progressMonitor, 4); >- >- File servicesFile = new File(webContentDir, Axis2ProjectizerConstants.SERVICES_FILE); >- createServicesDescriptor(servicesHelper, servicesFile); >- recordProgress(_progressMonitor, 1); >- >- helper.refreshProject(); >- recordProgress(_progressMonitor, 1); >- >- helper.setSuspendValidation(false); >- } finally { >- finishProgressMonitor(_progressMonitor); >- } >- } >- >- private void finishProgressMonitor(IProgressMonitor monitor) { >- if(monitor != null) { >- monitor.done(); >- } >- } >- >- private void recordProgress(IProgressMonitor monitor, int i) { >- if(monitor != null) { >- monitor.worked(1); >- } >- } >- >- private void startProgressMonitor(IProgressMonitor monitor, int i) { >- if(monitor != null) { >- monitor.beginTask("Running Projectizer", 9); >- } >- } >- >- protected void loadParameters(ConfigurationData data) { >- super.loadParameters(data); >- >- _additionalJars = (File[])data.getParameter(EclipseConfigurationData.ADDITIONAL_JARS); >- _instances = (Object[][])data.getParameter(EclipseConfigurationData.INSTANCES); >- _progressMonitor = (IProgressMonitor)data.getParameter(EclipseConfigurationData.PROGRESS_MONITOR); >- _filesToCopy = (TargetedFileList[])data.getParameter(EclipseConfigurationData.AXIS2_FILES); >- _projectName = (String)data.getParameter(EclipseConfigurationData.PROJECT_NAME); >- _projectLocation = (String)data.getParameter(EclipseConfigurationData.PROJECT_LOCATION); >- } >- >- private WebProjectHelper createProject() throws Exception { >- WebProjectHelper helper = new WebProjectHelper(_projectName, _projectLocation, EclipseAxis2ProjectizerConstants.JAVA_BIN_DIR, Axis2ProjectizerConstants.JAVA_SRC_DIR); >- >- return helper; >- } >- >- protected void createRouterEntries(File routerEntriesDir,Object[][] instances) throws Exception { >- routerEntriesDir.mkdirs(); >- >- for (int i = 0; i < _instances.length; i++) { >- Object[] instancePair = _instances[i]; >- >- // >- // This is really tacky, but it's the only real way to do this >- // since there are no pairs. The File use is to get the last element >- // of the path in a nice, non-hack way. >- // >- String path = (String) instancePair[0]; >- String resourcePathName = new File(path).getName(); >- >- Element instanceElement = (Element) instancePair[1]; >- >- File serviceDir = new File(routerEntriesDir, resourcePathName); >- File routerEntryFile = new File(serviceDir, getResourceFileName()); >- >- writeToFileCheck(instanceElement, routerEntryFile); >- } >- } >- >- protected String getResourceFileName() { >- return Axis2ProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(_resourceCounter++)); >- } >- >- protected File copyTemplate(File destination) throws Exception { >- URL url = Platform.getBundle(Activator.PLUGIN_ID).getEntry(EclipseAxis2ProjectizerConstants.WEBCONTENT_DIR_RESOURCE); >- url = FileLocator.toFileURL(url); >- >- File source = toFile(url); >- FileUtils.copyDirectory(source, destination); >- >- File webContentDir = new File(destination, source.getName()); >- File webContentDestination = new File(webContentDir, "WEB-INF"); //$NON-NLS-1$ >- >- for (int i=0; i < LIB_BUNDLE_IDS.length; i++) { >- url = Platform.getBundle(LIB_BUNDLE_IDS[i]).getEntry(EclipseAxis2ProjectizerConstants.PROJECT_LIB_DIR_RESOURCE); >- url = FileLocator.toFileURL(url); >- >- File libSource = toFile(url); >- FileUtils.copyDirectory(libSource, webContentDestination); >- } >- >- for (int i=0; i < MODULE_BUNDLE_IDS.length; i++) { >- url = Platform.getBundle(MODULE_BUNDLE_IDS[i]).getEntry(EclipseAxis2ProjectizerConstants.PROJECT_MODULE_DIR_RESOURCE); >- url = FileLocator.toFileURL(url); >- >- File libSource = toFile(url); >- FileUtils.copyDirectory(libSource, webContentDestination); >- } >- >- // >- //TODO: Hack to copy axis2-platform >- //this should be done in some cleaner way >- // >- >- url = Platform.getBundle(MODULE_BUNDLE_IDS[0]).getEntry("/lib/muse-platform-axis2-2.2.0.jar"); >- url = FileLocator.toFileURL(url); >- >- File libSource = toFile(url); >- FileUtils.copyFile(libSource, webContentDestination); >- >- File libDestination = new File(webContentDestination, "lib"); >- >- if(_additionalJars != null) { >- for (int i=0; i < _additionalJars.length; i++) { >- if(!_additionalJars[i].exists()) { >- throw new FileNotFoundException(_additionalJars[i].getAbsolutePath()); >- } >- >- FileUtils.copyFile(_additionalJars[i], libDestination); >- } >- } >- >- for (int i=0; i < _filesToCopy.length; i++) { >- String dest = _filesToCopy[i].getRelativePath(); >- File destDir = new File(webContentDir, dest); >- String[] files = _filesToCopy[i].getFiles(); >- >- for (int j=0; j < files.length; j++) { >- File file = new File(files[j]); >- if(!file.exists()) { >- throw new FileNotFoundException(file.getAbsolutePath()); >- } >- >- FileUtils.copyFile(file, destDir); >- } >- } >- >- return webContentDir; >- } >- private File toFile(URL url) throws Exception{ >- >- return new File(url.getFile()); >- } >-} >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2ProjectizerConstants.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2ProjectizerConstants.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2ProjectizerConstants.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2ProjectizerConstants.java 16 Mar 2007 15:53:15 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * Balan Subramanian (bsubram@us.ibm.com) >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >- >- >-public interface EclipseAxis2ProjectizerConstants { >- >- String RESOURCES_DIR = "/resources/axis2/"; //$NON-NLS-1$ >- >- String BUILD_FILE_RESOURCE = RESOURCES_DIR + "build.xml"; //$NON-NLS-1$ >- >- String BUILD_FILE = "build.xml"; //$NON-NLS-1$ >- >- String LAUNCH_FILE_RESOURCE = RESOURCES_DIR + ".externalToolBuilders/jarBuilder.launch"; //$NON-NLS-1$ >- >- String WEBCONTENT_DIR_RESOURCE = RESOURCES_DIR + "WebContent"; //$NON-NLS-1$ >- >- String PROJECT_LIB_DIR_RESOURCE = "/lib"; //$NON-NLS-1$ >- >- String PROJECT_MODULE_DIR_RESOURCE = "/modules"; //$NON-NLS-1$ >- >- String JAVA_BIN_DIR = "bin"; //$NON-NLS-1$ >- >-} >Index: src/org/eclipse/tptp/wsdm/tooling/internal/util/WebProjectHelper.java >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration.j2ee/src/org/eclipse/tptp/wsdm/tooling/internal/util/WebProjectHelper.java,v >retrieving revision 1.2 >diff -u -r1.2 WebProjectHelper.java >--- src/org/eclipse/tptp/wsdm/tooling/internal/util/WebProjectHelper.java 25 Apr 2007 18:35:58 -0000 1.2 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/util/WebProjectHelper.java 25 May 2007 02:04:49 -0000 >@@ -14,16 +14,9 @@ > > > import java.io.File; >-import java.net.URI; > >-import org.eclipse.core.filesystem.URIUtil; > import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.NullProgressMonitor; >-import org.eclipse.core.runtime.Path; > import org.eclipse.jst.common.project.facet.IJavaFacetInstallDataModelProperties; > import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants; > import org.eclipse.jst.j2ee.web.project.facet.IWebFacetInstallDataModelProperties; >@@ -40,7 +33,7 @@ > private IProject _project; > > public WebProjectHelper(String name, String location, String binDir, String sourceDir) throws Exception { >- _project = getProject(location, name); >+ _project = getProject(location, name, null, false); > > IDataModel dataModel = DataModelFactory.createDataModel(IWebFacetInstallDataModelProperties.class); > dataModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, name); >@@ -61,7 +54,7 @@ > return _project; > } > >- public void setSuspendValidation(boolean shouldSuspend) { >+ public void setSuspendValidation(boolean shouldSuspend) { > ValidatorManager.getManager().suspendValidation(getProject(), shouldSuspend); > } > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/monitoring/org.eclipse.tptp.wsdm.tooling.codegeneration.j2ee/plugin.xml,v >retrieving revision 1.2 >diff -u -r1.2 plugin.xml >--- plugin.xml 1 May 2007 16:40:37 -0000 1.2 >+++ plugin.xml 25 May 2007 02:04:49 -0000 >@@ -7,7 +7,7 @@ > container="Axis2" > platform="J2EE"/> > <projectizer >- class="org.eclipse.tptp.wsdm.tooling.internal.projectizer.EclipseAxis2Projectizer" >+ class="org.eclipse.tptp.wsdm.tooling.internal.projectizer.EclipseJ2EEAxis2Projectizer" > name="Axis2 J2EE" > servicePath="/services" > servicePort="8080"/> >@@ -16,4 +16,16 @@ > point="org.eclipse.ui.startup"> > <startup class="org.eclipse.tptp.wsdm.tooling.internal.codegeneration.Activator"/> > </extension> >+ <extension >+ point="org.eclipse.tptp.wsdm.editor.codeGeneration"> >+ <description >+ container="Mini" >+ platform="J2EE"> >+ </description> >+ <projectizer >+ class="org.eclipse.tptp.wsdm.tooling.internal.projectizer.EclipseJ2EEMiniProjectizer" >+ name="J2EE Mini" >+ servicePort="8080"> >+ </projectizer> >+ </extension> > </plugin> >Index: resources/mini/build.xml >=================================================================== >RCS file: resources/mini/build.xml >diff -N resources/mini/build.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ resources/mini/build.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+<?xml version="1.0"?> >+<project name="project" default="default"> >+ <target name="default"> >+ <jar destfile="${basedir}/WebContent/WEB-INF/lib/capability.jar"> >+ <fileset dir="bin"> >+ <include name="**/*.class"/> >+ </fileset> >+ </jar> >+ </target> >+</project> >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2Projectizer.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2Projectizer.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2Projectizer.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2Projectizer.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,251 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Balan Subramanian (bsubram@us.ibm.com) >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >+ >+ >+import java.io.File; >+import java.io.FileNotFoundException; >+import java.net.URL; >+import java.util.Map; >+ >+import org.apache.muse.tools.generator.projectizer.Axis2ProjectizerConstants; >+import org.apache.muse.tools.generator.projectizer.J2EEAxis2Projectizer; >+import org.apache.muse.tools.generator.util.ConfigurationData; >+import org.apache.muse.tools.generator.util.ServicesDescriptorHelper; >+import org.apache.muse.util.FileUtils; >+import org.apache.muse.ws.resource.metadata.MetadataDescriptor; >+import org.apache.muse.ws.wsdl.WsdlUtils; >+import org.eclipse.core.runtime.FileLocator; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional.EclipseConfigurationData; >+import org.eclipse.tptp.wsdm.tooling.codegen.mrt.provisional.TargetedFileList; >+import org.eclipse.tptp.wsdm.tooling.internal.codegeneration.Activator; >+import org.eclipse.tptp.wsdm.tooling.internal.util.WebProjectHelper; >+import org.eclipse.tptp.wsdm.tooling.provisional.util.ProgressMonitorHelper; >+import org.eclipse.tptp.wsdm.tooling.provisional.util.ProjectHelper; >+import org.w3c.dom.Document; >+import org.w3c.dom.Element; >+ >+/** >+ * Construct the projectizer for code generation >+ */ >+public class EclipseJ2EEAxis2Projectizer extends J2EEAxis2Projectizer { >+ >+ >+ private static final String CONTAINER_BUNDLE = "org.apache.muse.tools";//$NON-NLS-1$ >+ private static final String CONTAINER_RESOURCE = "/containers/muse-platform-axis2-2.2.0.jar";//$NON-NLS-1$ >+ >+ >+ private static final String[] LIB_BUNDLE_IDS = { >+ "org.apache.muse.api", //$NON-NLS-1$ >+ "org.apache.muse.impl", //$NON-NLS-1$ >+ "org.apache.muse.core", //$NON-NLS-1$ >+ "org.apache.muse.tools", //$NON-NLS-1$ >+ "org.apache.muse.utils" //$NON-NLS-1$ >+ }; >+ >+ private static final String[] MODULE_BUNDLE_IDS = { >+ "org.apache.muse.tools", //$NON-NLS-1$ >+ }; >+ >+ private File[] _additionalJars; >+ private Object[][] _instances; >+ private IProgressMonitor _progressMonitor; >+ private TargetedFileList[] _filesToCopy; >+ >+ private int _resourceCounter = 0; >+ >+ private String _projectName; >+ >+ private String _projectLocation; >+ >+ public void projectize(ConfigurationData configuration) throws Exception { >+ >+ ConfigurationData.checkConfiguration(this, configuration); >+ loadParameters(configuration); >+ ProgressMonitorHelper progressHelper = new ProgressMonitorHelper(_progressMonitor); >+ try { >+ >+ progressHelper.startProgressMonitor(10); >+ >+ WebProjectHelper helper = createProject(); >+ >+ _targetDirectory = helper.getProjectDirectory(); >+ >+ progressHelper.recordProgress(); >+ >+ helper.setSuspendValidation(true); >+ >+ File webContentDir = copyTemplate(_targetDirectory); >+ progressHelper.recordProgress(); >+ >+ File descriptorFile = new File( >+ webContentDir, >+ Axis2ProjectizerConstants.DESCRIPTOR_FILE); >+ >+ File javaSourceDir = new File( >+ _targetDirectory, >+ Axis2ProjectizerConstants.JAVA_SRC_DIR); >+ >+ createJavaSources(javaSourceDir, _filesMaps); >+ progressHelper.recordProgress(); >+ >+ File wsdldir = new File( >+ webContentDir, >+ Axis2ProjectizerConstants.WSDL_DIR); >+ >+ File routerEntriesDir = new File(webContentDir,Axis2ProjectizerConstants.ROUTER_ENTRIES_DIR); >+ >+ ServicesDescriptorHelper servicesHelper = new ServicesDescriptorHelper(); >+ >+ createBuildFile(_targetDirectory, EclipseJ2EEAxis2ProjectizerConstants.BUILD_FILE_RESOURCE, EclipseJ2EEAxis2ProjectizerConstants.BUILD_FILE); >+ progressHelper.recordProgress(); >+ >+ for(int i=0; i < _capabilitiesList.length; i++) { >+ Map capabilities = _capabilitiesList[i]; >+ Document wsdl = _wsdls[i]; >+ createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, i); >+ MetadataDescriptor rmd = _metadatas[i]; >+ createRMDFile(rmd, wsdl, wsdldir); >+ createWSDLFile(wsdl, wsdldir); >+ if(_instances == null) { >+ createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]); >+ } >+ updateServicesDescriptor(servicesHelper, wsdl, capabilities); >+ } >+ >+ if(_instances != null) { >+ createRouterEntries(routerEntriesDir, _instances); >+ } >+ progressHelper.recordProgress(4); >+ >+ File servicesFile = new File(webContentDir, Axis2ProjectizerConstants.SERVICES_FILE); >+ createServicesDescriptor(servicesHelper, servicesFile); >+ progressHelper.recordProgress(); >+ >+ helper.refreshProject(); >+ progressHelper.recordProgress(); >+ >+ helper.setSuspendValidation(false); >+ } finally { >+ progressHelper.finishProgressMonitor(); >+ } >+ } >+ >+ protected void loadParameters(ConfigurationData data) { >+ super.loadParameters(data); >+ >+ _additionalJars = (File[])data.getParameter(EclipseConfigurationData.ADDITIONAL_JARS); >+ _instances = (Object[][])data.getParameter(EclipseConfigurationData.INSTANCES); >+ _progressMonitor = (IProgressMonitor)data.getParameter(EclipseConfigurationData.PROGRESS_MONITOR); >+ _filesToCopy = (TargetedFileList[])data.getParameter(EclipseConfigurationData.AXIS2_FILES); >+ _projectName = (String)data.getParameter(EclipseConfigurationData.PROJECT_NAME); >+ _projectLocation = (String)data.getParameter(EclipseConfigurationData.PROJECT_LOCATION); >+ } >+ >+ private WebProjectHelper createProject() throws Exception { >+ WebProjectHelper helper = new WebProjectHelper(_projectName, _projectLocation, EclipseJ2EEAxis2ProjectizerConstants.JAVA_BIN_DIR, Axis2ProjectizerConstants.JAVA_SRC_DIR); >+ >+ return helper; >+ } >+ >+ protected void createRouterEntries(File routerEntriesDir,Object[][] instances) throws Exception { >+ routerEntriesDir.mkdirs(); >+ >+ for (int i = 0; i < _instances.length; i++) { >+ Object[] instancePair = _instances[i]; >+ >+ // >+ // This is really tacky, but it's the only real way to do this >+ // since there are no pairs. The File use is to get the last element >+ // of the path in a nice, non-hack way. >+ // >+ String path = (String) instancePair[0]; >+ String resourcePathName = new File(path).getName(); >+ >+ Element instanceElement = (Element) instancePair[1]; >+ >+ File serviceDir = new File(routerEntriesDir, resourcePathName); >+ File routerEntryFile = new File(serviceDir, getResourceFileName()); >+ >+ writeToFileCheck(instanceElement, routerEntryFile); >+ } >+ } >+ >+ protected String getResourceFileName() { >+ return Axis2ProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(_resourceCounter++)); >+ } >+ >+ protected File copyTemplate(File destination) throws Exception { >+ URL url = Platform.getBundle(Activator.PLUGIN_ID).getEntry(EclipseJ2EEAxis2ProjectizerConstants.WEBCONTENT_DIR_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File source = ProjectHelper.toFile(url); >+ FileUtils.copyDirectory(source, destination); >+ >+ File webContentDir = new File(destination, source.getName()); >+ File webContentDestination = new File(webContentDir, "WEB-INF"); //$NON-NLS-1$ >+ >+ for (int i=0; i < LIB_BUNDLE_IDS.length; i++) { >+ url = Platform.getBundle(LIB_BUNDLE_IDS[i]).getEntry(EclipseJ2EEAxis2ProjectizerConstants.PROJECT_LIB_DIR_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File libSource = ProjectHelper.toFile(url); >+ FileUtils.copyDirectory(libSource, webContentDestination); >+ } >+ >+ for (int i=0; i < MODULE_BUNDLE_IDS.length; i++) { >+ url = Platform.getBundle(MODULE_BUNDLE_IDS[i]).getEntry(EclipseJ2EEAxis2ProjectizerConstants.PROJECT_MODULE_DIR_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File libSource = ProjectHelper.toFile(url); >+ FileUtils.copyDirectory(libSource, webContentDestination); >+ } >+ >+ File libDestination = new File(webContentDestination, "lib"); >+ >+ url = Platform.getBundle(CONTAINER_BUNDLE).getEntry(CONTAINER_RESOURCE); >+ url = FileLocator.toFileURL(url); >+ >+ File libSource = ProjectHelper.toFile(url); >+ FileUtils.copy(libSource, libDestination); >+ >+ if(_additionalJars != null) { >+ for (int i=0; i < _additionalJars.length; i++) { >+ if(!_additionalJars[i].exists()) { >+ throw new FileNotFoundException(_additionalJars[i].getAbsolutePath()); >+ } >+ >+ FileUtils.copyFile(_additionalJars[i], libDestination); >+ } >+ } >+ >+ for (int i=0; i < _filesToCopy.length; i++) { >+ String dest = _filesToCopy[i].getRelativePath(); >+ File destDir = new File(webContentDir, dest); >+ String[] files = _filesToCopy[i].getFiles(); >+ >+ for (int j=0; j < files.length; j++) { >+ File file = new File(files[j]); >+ if(!file.exists()) { >+ throw new FileNotFoundException(file.getAbsolutePath()); >+ } >+ >+ FileUtils.copyFile(file, destDir); >+ } >+ } >+ >+ return webContentDir; >+ } >+} >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2ProjectizerConstants.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2ProjectizerConstants.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2ProjectizerConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEAxis2ProjectizerConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Balan Subramanian (bsubram@us.ibm.com) >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >+ >+ >+public interface EclipseJ2EEAxis2ProjectizerConstants { >+ >+ String RESOURCES_DIR = "/resources/axis2/"; //$NON-NLS-1$ >+ >+ String BUILD_FILE_RESOURCE = RESOURCES_DIR + "build.xml"; //$NON-NLS-1$ >+ >+ String BUILD_FILE = "build.xml"; //$NON-NLS-1$ >+ >+ String LAUNCH_FILE_RESOURCE = RESOURCES_DIR + ".externalToolBuilders/jarBuilder.launch"; //$NON-NLS-1$ >+ >+ String WEBCONTENT_DIR_RESOURCE = RESOURCES_DIR + "WebContent"; //$NON-NLS-1$ >+ >+ String PROJECT_LIB_DIR_RESOURCE = "/lib"; //$NON-NLS-1$ >+ >+ String PROJECT_MODULE_DIR_RESOURCE = "/modules"; //$NON-NLS-1$ >+ >+ String JAVA_BIN_DIR = "bin"; //$NON-NLS-1$ >+ >+} >Index: resources/mini/web.xml >=================================================================== >RCS file: resources/mini/web.xml >diff -N resources/mini/web.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ resources/mini/web.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> >+ <display-name>Apache Muse Servlet</display-name> >+ <servlet> >+ <display-name>Apache Muse Servlet</display-name> >+ <servlet-name>ApacheMuseServlet</servlet-name> >+ <servlet-class>org.apache.muse.core.platform.mini.MiniServlet</servlet-class> >+ </servlet> >+ <servlet-mapping> >+ <servlet-name>ApacheMuseServlet</servlet-name> >+ <url-pattern>/*</url-pattern> >+ </servlet-mapping> >+</web-app> >Index: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizerConstants.java >=================================================================== >RCS file: src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizerConstants.java >diff -N src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizerConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseJ2EEMiniProjectizerConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Andrew Eberbach (aeberbac@us.ibm.com) >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.tptp.wsdm.tooling.internal.projectizer; >+ >+public interface EclipseJ2EEMiniProjectizerConstants { >+ >+ String RESOURCE_FILE = "resource-instance-XXX.xml";//$NON-NLS-1$ >+ String WSDL_RELATIVE_PATH = "/wsdl/";//$NON-NLS-1$ >+ >+ String JAVA_SRC_DIR = "JavaSource/";//$NON-NLS-1$ >+ String WEBCONTENT_DIR = "WebContent/";//$NON-NLS-1$ >+ String WEBINF_DIR = WEBCONTENT_DIR + "WEB-INF/";//$NON-NLS-1$ >+ >+ String JAVA_BIN_DIR = "/bin";//$NON-NLS-1$ >+ String JAVA_CLASSES_DIR = WEBINF_DIR + "classes/";//$NON-NLS-1$ >+ String DESCRIPTOR_FILE = JAVA_CLASSES_DIR + "muse.xml";//$NON-NLS-1$ >+ String WSDL_DIR = JAVA_CLASSES_DIR + "wsdl/";//$NON-NLS-1$ >+ String ROUTER_ENTRIES_DIR = JAVA_CLASSES_DIR + "router-entries/";//$NON-NLS-1$ >+ >+ String RESOURCES_DIR = "/resources/mini/";//$NON-NLS-1$ >+ String WEBXML_RESOURCE = RESOURCES_DIR + "web.xml";//$NON-NLS-1$ >+ String WEBXML_FILE = "web.xml";//$NON-NLS-1$ >+ String PROJECT_LIB_DIR_RESOURCE = "/lib/";//$NON-NLS-1$ >+ String WEBINFLIB_DIR = WEBINF_DIR + "lib/";//$NON-NLS-1$ >+ String BUILD_FILE_RESOURCE = RESOURCES_DIR + "build.xml"; //$NON-NLS-1$; >+ String BUILD_FILE = "build.xml"; >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 179329
:
61985
|
68705
|
69193
|
69345