Author: Grid.Qian
Date: 2008-04-18 06:29:41 -0400 (Fri, 18 Apr 2008)
New Revision: 7606
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessage.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/Activator.java
Log:
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-04-18 09:39:24 UTC
(rev 7605)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/META-INF/MANIFEST.MF 2008-04-18 10:29:41 UTC
(rev 7606)
@@ -7,6 +7,8 @@
Bundle-Activator: org.jboss.tools.ws.core.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.wst.common.project.facet.core
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.core.resources
Eclipse-LazyStart: true
Bundle-Vendor: %PLUGIN_PROVIDER
Modified: trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-04-18 09:39:24 UTC (rev
7605)
+++ trunk/ws/plugins/org.jboss.tools.ws.core/plugin.xml 2008-04-18 10:29:41 UTC (rev
7606)
@@ -17,7 +17,7 @@
<requires facet="jst.web" version="2.2,2.3,2.4,2.5"/>
</constraint>
<action type="INSTALL">
- <delegate class=""/>
+ <delegate
class="org.jboss.tools.ws.core.facet.delegate.JbossWSInstallRuntimeDelegate"/>
</action>
<!--
<action type="UNINSTALL">
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/Activator.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/Activator.java 2008-04-18
09:39:24 UTC (rev 7605)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/Activator.java 2008-04-18
10:29:41 UTC (rev 7606)
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
package org.jboss.tools.ws.core;
import org.eclipse.ui.plugin.AbstractUIPlugin;
Added: trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCore 2008-04-18
10:29:41 UTC (rev 7606)
@@ -0,0 +1 @@
+PROGRESS_INSTALL_JBOSSWS_RUNTIME=JBoss Web Service Runtime
\ No newline at end of file
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessage.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/JbossWSCoreMessage.java 2008-04-18
10:29:41 UTC (rev 7606)
@@ -0,0 +1,19 @@
+package org.jboss.tools.ws.core;
+
+import org.eclipse.osgi.util.NLS;
+
+public class JbossWSCoreMessage {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.ws.ui.JbossWSCore";
//$NON-NLS-1$
+
+ private JbossWSCoreMessage() {
+ // Do not instantiate
+ }
+
+ public static String PROGRESS_INSTALL_JBOSSWS_RUNTIME;
+
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, JbossWSCoreMessage.class);
+ }
+}
\ No newline at end of file
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/command/JbossWSRuntimeCommand.java 2008-04-18
10:29:41 UTC (rev 7606)
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.core.command;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.preference.PreferenceStore;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+
+
+public class JbossWSRuntimeCommand extends
+AbstractDataModelOperation {
+
+ IProject project;
+ String runtimelocation;
+
+ public JbossWSRuntimeCommand(IProject project){
+ PreferenceStore ps = new PreferenceStore("jbosswsui.properties");
+ try {
+ ps.load();
+ } catch (IOException e) {
+ // Ignore
+ }
+ runtimelocation = ps.getString("jbosswsruntimelocation");
+ this.project = project;
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ public IStatus executeOverride(IProgressMonitor monitor) {
+ // Copy the axis2 facet in to this project
+ IStatus status =null;
+// String runtimeLocation = null;
+// ContentCopyUtils contentCopyUtils = new ContentCopyUtils();
+// try {
+// if(context.isAxis2ServerPathRepresentsWar()
+// || RuntimePropertyUtils.getWarStatusFromPropertiesFile()){
+// runtimeLocation = Axis2RuntimeUtils.copyAxis2War(
+// monitor,
+// Axis2Constants.PROPERTY_KEY_PATH);
+// }else{
+//
+// runtimeLocation = Axis2WebappUtils.copyAxis2War(
+// monitor,
+// Axis2Constants.PROPERTY_KEY_PATH);
+// }
+// } catch (FileNotFoundException e) {
+// return handleExceptionStatus(e);
+// } catch (IOException e) {
+// return handleExceptionStatus(e);
+// } catch (Exception e) {
+// return handleExceptionStatus(e);
+// }
+//
+// // First Setting the libs folder as ignored and then copy the content of
+// // the runtime
+// IPath libPath = new Path(runtimeLocation);
+// libPath = libPath.append(Axis2Constants.DIR_WEB_INF);
+// libPath = libPath.append(Axis2Constants.DIR_LIB);
+// List<String> ignoreList = new ArrayList<String>();
+// ignoreList.add(libPath.toOSString());
+// contentCopyUtils.updateCheckList(ignoreList);
+//
+// status = contentCopyUtils.copyDirectoryRecursivelyIntoWorkspace(
+// runtimeLocation,
+// FacetContainerUtils.pathToWebProjectContainer(project.toString()),
+// monitor,
+// false
+// );
+//
+// // After that copy the nesessery set of libraries to the project again
+// List<String> includeList = new ArrayList<String>();
+// contentCopyUtils.updateCheckList(loadIncludeListWithAxis2Libs(libPath.toOSString(),
+// includeList));
+// String[] nodes = {Axis2Constants.DIR_WEB_INF,Axis2Constants.DIR_LIB};
+// status = contentCopyUtils.copyDirectoryRecursivelyIntoWorkspace(
+// libPath.toOSString(),
+// FileUtils.addNodesToPath(
+// FacetContainerUtils.pathToWebProjectContainer(project.toString()),
+// nodes),
+// monitor,
+// true
+// );
+//
+// // Merge web.xml Files
+// MergeWEBXMLCommand mergeWebXMLCommand = new MergeWEBXMLCommand();
+// mergeWebXMLCommand.setExtraAxis2TagsAdded(false);
+// mergeWebXMLCommand.setServerProject(project);
+// mergeWebXMLCommand.exexuteOverride(monitor);
+//
+// // clean up tempery files
+// File tempFacetDirectory = new File(runtimeLocation);
+// if (tempFacetDirectory.exists() && context.isAxis2ServerPathRepresentsWar())
{
+// FileUtils.deleteDir(tempFacetDirectory);
+// }
+// status = Status.OK_STATUS;
+ return status;
+ }
+
+ private void cleanupIfFacetStatusFailed(String runtimeLocation){
+// File tempFacetDirectory = new File(runtimeLocation);
+// if (tempFacetDirectory.exists()) {
+// FileUtils.deleteDir(tempFacetDirectory);
+// }
+ }
+
+ private IStatus handleExceptionStatus(Exception e){
+ IStatus status = null;
+// status = new
Status(1,project.toString(),1,Axis2CoreUIMessages.ERROR_SERVER_IS_NOT_SET,e);
+// cleanupIfFacetStatusFailed(Axis2CoreUtils.tempAxis2Directory());
+ return status;
+ }
+
+ /**
+ * Load the exact libraries list from the axis2 jars with the correct
+ * versions to the <code>path</code>. Doing it this way introduce the
+ * scalability to the solution where the need comes in the future releases
+ * to include additional libraries and if needed filter out some libraries.
+ *
+ * @param runtimeLocation
+ * @param includeList
+ * @return loaded list
+ */
+ private List loadIncludeListWithAxis2Libs(String path, List includeList){
+// for (int i = 0; i < Axis2Constants.AXIS2_LIB_PREFIXES.length; i++) {
+// File[] jarFileList = FileUtils.getMatchingFiles(path,
+// Axis2Constants.AXIS2_LIB_PREFIXES[i],
+// Axis2Constants.JAR);
+// for (int j = 0; j < jarFileList.length; j++) {
+// includeList.add(jarFileList[j].getAbsolutePath());
+// }
+// // Fix for the 205972
+// File[] licenseFileList = FileUtils.getMatchingFiles(path,
+// Axis2Constants.AXIS2_LIB_PREFIXES[i],
+// Axis2Constants.TXT);
+// for (int k = 0; k < licenseFileList.length; k++) {
+// includeList.add(licenseFileList[k].getAbsolutePath());
+// }
+// }
+ return includeList;
+ }
+}
\ No newline at end of file
Added:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/facet/delegate/JbossWSInstallRuntimeDelegate.java 2008-04-18
10:29:41 UTC (rev 7606)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.ws.core.facet.delegate;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.project.facet.core.IDelegate;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.ws.core.JbossWSCoreMessage;
+import org.jboss.tools.ws.core.command.JbossWSRuntimeCommand;
+
+public class JbossWSInstallRuntimeDelegate implements IDelegate {
+
+ private IStatus status;
+
+ public void execute(IProject project, IProjectFacetVersion arg1, Object arg2,
+ IProgressMonitor monitor) throws CoreException {
+ monitor.beginTask(JbossWSCoreMessage.PROGRESS_INSTALL_JBOSSWS_RUNTIME, 2 );
+
+ JbossWSRuntimeCommand command = new JbossWSRuntimeCommand(project);
+ status = command.executeOverride(monitor);
+// if (status.getCode() == Status.OK_STATUS.getCode() ){
+// RuntimePropertyUtils.writeServerStausToPropertiesFile(
+// Axis2Constants.SERVER_STATUS_PASS);
+// }else{
+// RuntimePropertyUtils.writeServerStausToPropertiesFile(
+// Axis2Constants.SERVER_STATUS_FAIL);
+// throw new CoreException(status);
+// }
+ monitor.worked( 1 );
+ monitor.done();
+ }
+
+}