[183147] DBCS3.3: Axis2 runtime isn't restored if the path contains DBCS.
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterContext.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterContext.java
new file mode 100644
index 0000000..be9ab2e
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterContext.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 WSO2 Inc 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:
+ * WSO2 Inc - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
+ *******************************************************************************/
+package org.eclipse.jst.ws.axis2.core.context;
+
+public interface Axis2EmitterContext {
+
+ /**
+ * This constant string is used to lookup the runtime location general
+ * preference from the plugins local preferences store.
+ */
+ public static final String PREFERENCE_AXIS2_RUNTIME_LOCATION = "axis2RuntimeLocation";
+
+ /**
+ * @param selection set the axis2 runtime location.
+ */
+ public void setAxis2RuntimeLocation(String runtimeLocation);
+
+ /**
+ * @param returns the axis2 runtime location.
+ */
+ public String getAxis2RuntimeLocation();
+
+}
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterDefaults.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterDefaults.java
new file mode 100644
index 0000000..48b50f8
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/Axis2EmitterDefaults.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2007 WSO2 Inc 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:
+ * WSO2 Inc - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
+ *******************************************************************************/
+package org.eclipse.jst.ws.axis2.core.context;
+
+public class Axis2EmitterDefaults {
+
+ public static final String PREFERENCE_AXIS2_RUNTIME_LOCATION_DEFAULT = "";
+
+ /**
+ * @return returns the default setting for runtime location.
+ */
+ public static String getAxis2RuntimeLocation() {
+ return PREFERENCE_AXIS2_RUNTIME_LOCATION_DEFAULT;
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/PersistentAxis2EmitterContext.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/PersistentAxis2EmitterContext.java
new file mode 100644
index 0000000..5ddb52b
--- /dev/null
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/context/PersistentAxis2EmitterContext.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 WSO2 Inc 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:
+ * WSO2 Inc - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
+ *******************************************************************************/
+package org.eclipse.jst.ws.axis2.core.context;
+
+import org.eclipse.jst.ws.axis2.core.plugin.WebServiceAxis2CorePlugin;
+import org.eclipse.wst.command.internal.env.context.PersistentContext;
+
+public class PersistentAxis2EmitterContext extends PersistentContext implements
+ Axis2EmitterContext {
+
+ private static PersistentAxis2EmitterContext context_ = null;
+
+ public static PersistentAxis2EmitterContext getInstance()
+ {
+ if (context_ == null) {
+ context_ = new PersistentAxis2EmitterContext();
+ context_.load();
+ }
+ return context_;
+ }
+
+ public void load(){
+ setDefault(PREFERENCE_AXIS2_RUNTIME_LOCATION, Axis2EmitterDefaults.getAxis2RuntimeLocation());
+ }
+
+ private PersistentAxis2EmitterContext() {
+ super(WebServiceAxis2CorePlugin.getInstance());
+ }
+
+ public String getAxis2RuntimeLocation() {
+ return getValueAsString(PREFERENCE_AXIS2_RUNTIME_LOCATION);
+ }
+
+ public void setAxis2RuntimeLocation(String runtimeLocation) {
+ setValue(PREFERENCE_AXIS2_RUNTIME_LOCATION, runtimeLocation);
+ }
+
+}
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/plugin/WebServiceAxis2CorePlugin.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/plugin/WebServiceAxis2CorePlugin.java
index 5c77ed7..5b3adee 100644
--- a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/plugin/WebServiceAxis2CorePlugin.java
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/core/plugin/WebServiceAxis2CorePlugin.java
@@ -12,10 +12,13 @@
* 20070130 168762 sandakith@wso2.com - Lahiru Sandakith, Initial code to introduse the Axis2
* runtime to the framework for 168762
* 20070426 183046 sandakith@wso2.com - Lahiru Sandakith
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
*******************************************************************************/
package org.eclipse.jst.ws.axis2.core.plugin;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jst.ws.axis2.core.context.Axis2EmitterContext;
+import org.eclipse.jst.ws.axis2.core.context.PersistentAxis2EmitterContext;
import org.osgi.framework.BundleContext;
/**
@@ -27,15 +30,27 @@
public static final String PLUGIN_ID = "org.eclipse.jst.ws.axis2.core";
// The shared instance
- private static WebServiceAxis2CorePlugin plugin;
+ private static WebServiceAxis2CorePlugin instance_;
+
+
+ private PersistentAxis2EmitterContext axis2EmitterContext_;
/**
* The constructor
*/
public WebServiceAxis2CorePlugin() {
- plugin = this;
+ super();
+ if (instance_ == null) {
+ instance_ = this;
+ }
}
+
+ public Axis2EmitterContext getAxisEmitterContext(){
+ if (axis2EmitterContext_ == null)
+ axis2EmitterContext_ = PersistentAxis2EmitterContext.getInstance();
+ return axis2EmitterContext_;
+ }
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
@@ -49,7 +64,7 @@
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
- plugin = null;
+ instance_ = null;
super.stop(context);
}
@@ -59,7 +74,22 @@
* @return the shared instance
*/
public static WebServiceAxis2CorePlugin getDefault() {
- return plugin;
+ return instance_;
}
+
+ // This method is needed to keep the logging from blowing up.
+ public String toString()
+ {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Returns the singleton instance of this plugin. Equivalent to calling
+ * (WebServiceWasConsumptionPlugin)Platform.getPlugin("org.eclipse.jst.ws.was.v5.tp");
+ * @return The WebServiceAxisConsumptionCorePlugin singleton.
+ */
+ static public WebServiceAxis2CorePlugin getInstance() {
+ return instance_;
+ }
}
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2RuntimeUtils.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2RuntimeUtils.java
index 1c01722..f71457c 100644
--- a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2RuntimeUtils.java
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2RuntimeUtils.java
@@ -13,6 +13,7 @@
* facet to the framework for 168766
* 20070426 183046 sandakith@wso2.com - Lahiru Sandakith
* 20070501 180284 sandakith@wso2.com - Lahiru Sandakith
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
*******************************************************************************/
package org.eclipse.jst.ws.axis2.facet.utils;
@@ -24,13 +25,14 @@
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.util.Enumeration;
-import java.util.Properties;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.ws.axis2.core.context.Axis2EmitterContext;
+import org.eclipse.jst.ws.axis2.core.plugin.WebServiceAxis2CorePlugin;
import org.eclipse.jst.ws.axis2.core.plugin.data.ServerModel;
import org.eclipse.jst.ws.axis2.core.plugin.messages.Axis2CoreUIMessages;
import org.eclipse.jst.ws.axis2.core.utils.Axis2CoreUtils;
@@ -64,15 +66,18 @@
tempWarLocation,
Axis2CoreUIMessages.FILE_AXIS2_WAR);
new File(tempWarFile).createNewFile();
- Properties properties = new Properties();
- properties.load(new FileInputStream(Axis2CoreUtils.tempAxis2WebappFileLocation()));
- if (properties.containsKey(Axis2CoreUIMessages.PROPERTY_KEY_PATH)){
+ String axis2RuntimrLocation = null;
+ if(ServerModel.getAxis2ServerPath()!=null){
+ axis2RuntimrLocation = ServerModel.getAxis2ServerPath();
+ }else{
+ Axis2EmitterContext context = WebServiceAxis2CorePlugin
+ .getDefault().getAxisEmitterContext();
+ axis2RuntimrLocation = context.getAxis2RuntimeLocation();
+
+ }
String axis2WarFile = Axis2CoreUtils.addAnotherNodeToPath(
- (ServerModel.getAxis2ServerPath()!=null)
- ?ServerModel.getAxis2ServerPath()
- :properties.getProperty(
- Axis2CoreUIMessages.PROPERTY_KEY_PATH),
- Axis2CoreUIMessages.FILE_AXIS2_WAR);
+ axis2RuntimrLocation,
+ Axis2CoreUIMessages.FILE_AXIS2_WAR);
FileChannel srcChannel = new FileInputStream(axis2WarFile).getChannel();
FileChannel dstChannel = new FileOutputStream(tempWarFile).getChannel();
// Copy file contents from source to destination
@@ -92,9 +97,9 @@
}
- } else {
+ //} else {
//Throws an error message
- }
+ //}
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
diff --git a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2WebappUtils.java b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2WebappUtils.java
index 3b19342..b099f90 100644
--- a/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2WebappUtils.java
+++ b/bundles/org.eclipse.jst.ws.axis2.core/src/org/eclipse/jst/ws/axis2/facet/utils/Axis2WebappUtils.java
@@ -14,16 +14,17 @@
* 20070426 183046 sandakith@wso2.com - Lahiru Sandakith
* 20070501 180284 sandakith@wso2.com - Lahiru Sandakith
* 20070507 185686 sandakith@wso2.com - Lahiru Sandakith
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
*******************************************************************************/
package org.eclipse.jst.ws.axis2.facet.utils;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.Properties;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jst.ws.axis2.core.context.Axis2EmitterContext;
+import org.eclipse.jst.ws.axis2.core.plugin.WebServiceAxis2CorePlugin;
import org.eclipse.jst.ws.axis2.core.plugin.data.ServerModel;
import org.eclipse.jst.ws.axis2.core.plugin.messages.Axis2CoreUIMessages;
import org.eclipse.jst.ws.axis2.core.utils.Axis2CoreUtils;
@@ -50,12 +51,17 @@
FileUtils.deleteDirectories(tempWarLocationFile);
}
tempWarLocationFile.mkdirs();
- Properties properties = new Properties();
- properties.load(new FileInputStream(Axis2CoreUtils.tempAxis2WebappFileLocation()));
- if (properties.containsKey(Axis2CoreUIMessages.PROPERTY_KEY_PATH)){
- String axis2HomeLocation = (ServerModel.getAxis2ServerPath()!=null)
- ?ServerModel.getAxis2ServerPath()
- :properties.getProperty(Axis2CoreUIMessages.PROPERTY_KEY_PATH);
+
+ String axis2HomeLocation = null;
+ if(ServerModel.getAxis2ServerPath()!=null){
+ axis2HomeLocation = ServerModel.getAxis2ServerPath();
+ }else{
+ Axis2EmitterContext context = WebServiceAxis2CorePlugin
+ .getDefault().getAxisEmitterContext();
+ axis2HomeLocation = context.getAxis2RuntimeLocation();
+
+ }
+
String axis2WebappLocation = Axis2CoreUtils.addAnotherNodeToPath(
axis2HomeLocation,
"webapp");
@@ -97,10 +103,6 @@
alreadyWarExist= true;
}
- } else {
- alreadyWarExist = false;
- //Throws an error message
- }
}
return tempWarLocation;
}
diff --git a/bundles/org.eclipse.jst.ws.axis2.ui/src/org/eclipse/jst/ws/internal/axis2/consumption/ui/preferences/Axis2RuntimePreferencePage.java b/bundles/org.eclipse.jst.ws.axis2.ui/src/org/eclipse/jst/ws/internal/axis2/consumption/ui/preferences/Axis2RuntimePreferencePage.java
index ec934e4..096acc6 100644
--- a/bundles/org.eclipse.jst.ws.axis2.ui/src/org/eclipse/jst/ws/internal/axis2/consumption/ui/preferences/Axis2RuntimePreferencePage.java
+++ b/bundles/org.eclipse.jst.ws.axis2.ui/src/org/eclipse/jst/ws/internal/axis2/consumption/ui/preferences/Axis2RuntimePreferencePage.java
@@ -16,6 +16,7 @@
* 20070511 186440 sandakith@wso2.com - Lahiru Sandakith fix 186440
* 20070513 186430 sandakith@wso2.com - Lahiru Sandakith, fix for 186430
* Text not accessible on AXIS2 wizard pages.
+ * 20070516 183147 sandakith@wso2.com - Lahiru Sandakith Fix for the persisting DBCS paths
*******************************************************************************/
package org.eclipse.jst.ws.internal.axis2.consumption.ui.preferences;
@@ -24,6 +25,8 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jst.ws.axis2.core.context.Axis2EmitterContext;
+import org.eclipse.jst.ws.axis2.core.plugin.WebServiceAxis2CorePlugin;
import org.eclipse.jst.ws.axis2.core.plugin.data.ServerModel;
import org.eclipse.jst.ws.axis2.core.plugin.messages.Axis2CoreUIMessages;
import org.eclipse.jst.ws.axis2.core.utils.Axis2CoreUtils;
@@ -58,6 +61,7 @@
private boolean webappExist = false;
private boolean isWar = false;
private String statusBanner = null;
+ Axis2EmitterContext context;
@@ -85,10 +89,11 @@
axis2Path = new Text( runtimeGroup, SWT.BORDER );
String serverPath = null;
if (ServerModel.getAxis2ServerPath()==null||ServerModel.getAxis2ServerPath().equals("")){
- serverPath = (RuntimePropertyUtils.getServerPathFromPropertiesFile() == null) ? ""
- : RuntimePropertyUtils.getServerPathFromPropertiesFile();
- axis2Path.setText(serverPath);
- ServerModel.setAxis2ServerPath( serverPath );
+ Axis2EmitterContext context = WebServiceAxis2CorePlugin
+ .getDefault().getAxisEmitterContext();
+ serverPath = context.getAxis2RuntimeLocation();
+ axis2Path.setText(serverPath);
+ ServerModel.setAxis2ServerPath( serverPath );
}else{
axis2Path.setText(ServerModel.getAxis2ServerPath());
serverPath = ServerModel.getAxis2ServerPath();
@@ -106,6 +111,7 @@
public void modifyText(ModifyEvent e){
ServerModel.setAxis2ServerPath( axis2Path.getText() );
webappExist =runtimeExist(axis2Path.getText());
+ storeValues();
status = RuntimePropertyUtils.writeServerPathToPropertiesFile(
axis2Path.getText());
if (webappExist) {
@@ -138,7 +144,7 @@
}
- Text statusLabel = new Text(runtimeGroup,SWT.BACKGROUND | SWT.READ_ONLY | SWT.CENTER | SWT.WRAP);
+ statusLabel = new Text(runtimeGroup,SWT.BACKGROUND | SWT.READ_ONLY | SWT.CENTER);
statusLabel.setLocation(20,100);
statusLabel.setSize(560,40);
@@ -458,4 +464,11 @@
RuntimePropertyUtils.writeWarStausToPropertiesFile(status);
}
+ private void storeValues(){
+ // get the persistent context from the plugin
+ Axis2EmitterContext context = WebServiceAxis2CorePlugin.getInstance()
+ .getAxisEmitterContext();
+ context.setAxis2RuntimeLocation( axis2Path.getText() );
+ }
+
}