[wsas-java-dev] svn commit r6119 - in trunk/wsas/java: .
modules/admin/src/org/wso2/wsas/admin/service
modules/admin/src/org/wso2/wsas/admin/service/util
modules/clustering/src/org/wso2/wsas/clustering/configuration
modules/clustering/src/org/wso2/wsas/clustering/configuration/commands
modules/core modules/core/bin modules/core/src/org/wso2/wsas
modules/core/src/org/wso2/wsas/deployment
modules/core/src/org/wso2/wsas/feed
modules/core/src/org/wso2/wsas/feed/atom
modules/core/src/org/wso2/wsas/feed/rss
modules/core/src/org/wso2/wsas/installer
modules/core/src/org/wso2/wsas/security/pox
modules/core/src/org/wso2/wsas/security/util
modules/core/src/org/wso2/wsas/transport
modules/core/src/org/wso2/wsas/transport/fileupload
modules/core/src/org/wso2/wsas/transport/http
modules/core/src/org/wso2/wsas/transport/util
modules/core/src/org/wso2/wsas/util
modules/core/test-resources modules/core/test/org/wso2/wsas
modules/integration/test/org/wso2
modules/integration/test/org/wso2/wsas/rest
modules/integration/test/org/wso2/wsas/sample/commodityquote
modules/samples/Chad/src/org/wso2/wsas/sample/chad
modules/samples/Chad/src/org/wso2/wsas/sample/chad/data
modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client
modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/services
modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/services/util
modules/samples/FlickrClient/src/org/wso2/wsas/sample/flickr/client
modules/samples/Trader/src/org/wso2/wsas/sample/exchange
modules/samples/Trader/src/org/wso2/wsas/sample/trader
modules/samples/Trader/src/org/wso2/wsas/sample/trader/client
svn at wso2.org
svn at wso2.org
Sun Aug 5 23:18:56 PDT 2007
Author: azeez
Date: Sun Aug 5 23:17:33 2007
New Revision: 6119
Modified:
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/CryptoAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/DataServiceAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/UserAdmin.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/Phases.java
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/WSASConfigurationManagerListener.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/AbstractConfigurationCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/ApplyServicePolicyCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/LoadServiceGroupsCommand.java
trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/UnloadServiceGroupsCommand.java
trunk/wsas/java/modules/core/bin/wso2wsas.bat
trunk/wsas/java/modules/core/bin/wso2wsas.sh
trunk/wsas/java/modules/core/pom.xml
trunk/wsas/java/modules/core/src/org/wso2/wsas/Main.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/MainServlet.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/TomcatRepositoryListener.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/AbstractFeed.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedConstants.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/atom/AtomElement.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/RSSElement.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/ServiceElement.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/GeronimoInstaller.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/JBossInstaller.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/security/pox/POXSecurityHandler.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/security/util/RampartConfigUtil.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/RequestRedirectionFilter.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/UIInitializerServlet.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/AbstractFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/EJBInterfaceFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ModuleFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/POJOFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ServiceFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/WSDDFileUploadExecutor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpTransportListener.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpsTransportListener.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/PolicyProcessor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/XsdProcessor.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/util/KeyStoreUtil.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/util/PasswordUpdater.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/util/ServerController.java
trunk/wsas/java/modules/core/test-resources/wso2wsas.hibernate.cfg.xml
trunk/wsas/java/modules/core/test/org/wso2/wsas/AbstractTestCase.java
trunk/wsas/java/modules/core/test/org/wso2/wsas/TomcatServerTest.java
trunk/wsas/java/modules/integration/test/org/wso2/IntegrationTestSuite.java
trunk/wsas/java/modules/integration/test/org/wso2/wsas/rest/RestWithSchemasTest.java
trunk/wsas/java/modules/integration/test/org/wso2/wsas/sample/commodityquote/CommodityQuoteServiceIntegrationTest.java
trunk/wsas/java/modules/samples/Chad/src/org/wso2/wsas/sample/chad/Chad.java
trunk/wsas/java/modules/samples/Chad/src/org/wso2/wsas/sample/chad/ChadChoiceComparator.java
trunk/wsas/java/modules/samples/Chad/src/org/wso2/wsas/sample/chad/data/DatabaseChadDataProvider.java
trunk/wsas/java/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/client/Client.java
trunk/wsas/java/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/services/CommodityQuoteUtil.java
trunk/wsas/java/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/services/util/SymbolTable.java
trunk/wsas/java/modules/samples/CommodityQuote/src/org/wso2/wsas/sample/commodityquote/services/util/Utils.java
trunk/wsas/java/modules/samples/FlickrClient/src/org/wso2/wsas/sample/flickr/client/FlickrServiceFrame.java
trunk/wsas/java/modules/samples/Trader/src/org/wso2/wsas/sample/exchange/Exchange.java
trunk/wsas/java/modules/samples/Trader/src/org/wso2/wsas/sample/trader/Client.java
trunk/wsas/java/modules/samples/Trader/src/org/wso2/wsas/sample/trader/ClientDetails.java
trunk/wsas/java/modules/samples/Trader/src/org/wso2/wsas/sample/trader/Trader.java
trunk/wsas/java/modules/samples/Trader/src/org/wso2/wsas/sample/trader/client/TraderClientSkeleton.java
trunk/wsas/java/pom.xml
Log:
1. Fixing bugs reported by Findbugs
2. Timeout if a test case cannot connect to a WSAS instance after 30secs.
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/CryptoAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/CryptoAdmin.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/CryptoAdmin.java Sun Aug 5 23:17:33 2007
@@ -40,6 +40,7 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
+import java.io.IOException;
import java.security.KeyStore;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateFactory;
@@ -72,10 +73,12 @@
String keyStoreType) throws AxisFault {
Collection pvtKeys = new ArrayList();
String filePath = getFilePathFromFileId(keyStoreFileId);
-
+ FileInputStream in = null;
+ BufferedInputStream ksbufin = null;
try {
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
- BufferedInputStream ksbufin = new BufferedInputStream(new FileInputStream(filePath));
+ in = new FileInputStream(filePath);
+ ksbufin = new BufferedInputStream(in);
keyStore.load(ksbufin, storePass.toCharArray()); //Populate the keystore
Enumeration enumeration = keyStore.aliases();
while (enumeration.hasMoreElements()) {
@@ -88,6 +91,17 @@
String msg = "Could not read private keys from keystore file. ";
log.error(msg, e);
throw new AxisFault(msg + e.getMessage());
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ if (ksbufin != null) {
+ ksbufin.close();
+ }
+ } catch (IOException e) {
+ log.error(e);
+ }
}
return (String[]) pvtKeys.toArray(new String[pvtKeys.size()]);
}
@@ -133,6 +147,9 @@
// Move the KS file from work to WSO2WSAS_HOME/conf/keystores, if there is more than
// 1 Kpr, delete all Kpr which are not equal to pvtKeyAlias
+ FileInputStream in = null;
+ BufferedInputStream ksbufin = null;
+ OutputStream os = null;
try {
// mkdir keystore
@@ -148,8 +165,8 @@
}
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
- FileInputStream in = new FileInputStream(ksFilePath);
- BufferedInputStream ksbufin = new BufferedInputStream(in);
+ in = new FileInputStream(ksFilePath);
+ ksbufin = new BufferedInputStream(in);
keyStore.load(ksbufin, ksPassword.toCharArray()); //Populate the keystore
if (!keyStore.isKeyEntry(pvtKeyAlias)) {
@@ -168,7 +185,7 @@
}
// Move the KS file to WSO2WSAS_HOME/conf/keystores
- OutputStream os = new FileOutputStream(ksFile);
+ os = new FileOutputStream(ksFile);
keyStore.store(os, ksPassword.toCharArray());
in.close();
os.flush();
@@ -182,6 +199,20 @@
String msg = "Could not add new keystore. ";
log.error(msg, e);
throw new AxisFault(msg + e.getMessage());
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ if (ksbufin != null) {
+ ksbufin.close();
+ }
+ if (os != null) {
+ os.close();
+ }
+ } catch (IOException e) {
+ log.error(e);
+ }
}
// Store the KS entry in the database
@@ -208,11 +239,14 @@
public String importCertificate(String keyStoreName,
String certificatePathId) throws AxisFault {
String msg;
+ FileInputStream ksIn = null;
+ BufferedInputStream ksbufin = null;
+ OutputStream os = null;
try {
KeyStoreDO keyStoreDO = pm.getKeyStore(keyStoreName);
KeyStore keyStore = KeyStore.getInstance(keyStoreDO.getKeyStoreType());
- FileInputStream ksIn = new FileInputStream(keyStoreDO.getFilePath());
- BufferedInputStream ksbufin = new BufferedInputStream(ksIn);
+ ksIn = new FileInputStream(keyStoreDO.getFilePath());
+ ksbufin = new BufferedInputStream(ksIn);
String storePassword = keyStoreDO.getStorePassword();
ServerConfiguration config = ServerConfiguration.getInstance();
@@ -234,7 +268,7 @@
keyStore.setCertificateEntry(UUIDGenerator.getUUID(),
CertificateFactory.getInstance("X.509").
generateCertificate(certIn));
- OutputStream os = new FileOutputStream(new File(keyStoreDO.getFilePath()));
+ os = new FileOutputStream(new File(keyStoreDO.getFilePath()));
keyStore.store(os, decryptedStorePass);
os.flush();
os.close();
@@ -242,6 +276,20 @@
msg = "Could not import certificate. Certificate may be invalid. ";
log.error(msg, e);
return msg;
+ } finally {
+ try {
+ if (ksIn != null) {
+ ksIn.close();
+ }
+ if (ksbufin != null) {
+ ksbufin.close();
+ }
+ if (os != null) {
+ os.close();
+ }
+ } catch (IOException e) {
+ log.error(e);
+ }
}
msg = "Certificate imported successfully";
return msg;
@@ -319,11 +367,13 @@
// Check whether we can delete this KS
Set trustStoreServices = keyStore.getTrustStoreServices();
if (!trustStoreServices.isEmpty()) {
- String trustedServices = "";
- int i = 0;
+ int i = 1;
+ StringBuffer trustedServices = new StringBuffer();
for (Iterator iterator = trustStoreServices.iterator(); iterator.hasNext();) {
ServiceDO s = (ServiceDO) iterator.next();
- trustedServices += ++i + ". " + s.getServiceIdentifierDO().getServiceId() + "<br/>";
+ trustedServices.append(i).append(". ").
+ append(s.getServiceIdentifierDO().getServiceId()).append("<br/>");
+ i++;
}
throw new AxisFault("Cannot delete keystore since the following services" +
" have been associated with a security scenario using this keystore" +
@@ -332,11 +382,13 @@
}
Set pkStoreServices = keyStore.getPkStoreServices();
if (!pkStoreServices.isEmpty()) {
- String pkServices = "";
+ StringBuffer pkServices = new StringBuffer();
int i = 1;
for (Iterator iterator = pkStoreServices.iterator(); iterator.hasNext();) {
ServiceDO s = (ServiceDO) iterator.next();
- pkServices += ++i + ". " + s.getServiceIdentifierDO().getServiceId() + ",";
+ pkServices.append(i).append(". ").
+ append(s.getServiceIdentifierDO().getServiceId()).append("<br/");
+ i++;
}
throw new AxisFault("Cannot delete keystore since the following services" +
" have been associated with a security scenario using this keystore" +
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/DataServiceAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/DataServiceAdmin.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/DataServiceAdmin.java Sun Aug 5 23:17:33 2007
@@ -16,20 +16,6 @@
package org.wso2.wsas.admin.service;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
@@ -38,23 +24,29 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.wso2.utils.ServerConfiguration;
import org.wso2.ws.dataservice.DBConstants;
import org.wso2.wsas.ServerConstants;
import org.wso2.wsas.admin.service.util.DBServerData;
-import org.wso2.wsas.persistence.PersistenceManager;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
/**
* Admin service to manage operations related to modules
*/
public class DataServiceAdmin extends AbstractAdmin {
- private static Log log = LogFactory.getLog(DataServiceAdmin.class);
-
- private PersistenceManager pm = new PersistenceManager();
-
public DataServiceAdmin() {
}
@@ -63,17 +55,16 @@
this.axisConfig = configCtx.getAxisConfiguration();
}
- // list all the available modules
public OMElement getDataServiceContents(String serviceId) throws AxisFault {
AxisService axisService = getAxisConfig().getService(serviceId);
String fileParth =
(String) axisService.getParameter(DBConstants.DB_SERVICE_CONFIG_FILE).getValue();
- String fileContents = "";
+ StringBuffer fileContents = new StringBuffer();
try {
BufferedReader in = new BufferedReader(new FileReader(fileParth));
String str;
while ((str = in.readLine()) != null) {
- fileContents += str;
+ fileContents.append(str);
}
in.close();
} catch (IOException e) {
@@ -82,11 +73,10 @@
+ serviceId, e);
}
- OMElement returnEle = null;
+ OMElement returnEle;
try {
XMLStreamReader xmlSR =
- StAXUtils.createXMLStreamReader(new ByteArrayInputStream(fileContents
- .getBytes()));
+ StAXUtils.createXMLStreamReader(new ByteArrayInputStream(fileContents.toString().getBytes()));
returnEle = new StAXOMBuilder(xmlSR).getDocumentElement();
// new BufferedReader(new InputStreamReader(
@@ -98,9 +88,8 @@
return returnEle;
}
- // list all the available modules
public void saveDataServiceContents(String serviceId, String configContents) throws AxisFault {
- OMElement configEle = null;
+ OMElement configEle;
try {
XMLStreamReader xmlSR =
StAXUtils.createXMLStreamReader(new ByteArrayInputStream(configContents
@@ -152,7 +141,7 @@
}
}
- String dataServiceFilePath = null;
+ String dataServiceFilePath;
AxisService axisService = getAxisConfig().getService(serviceId);
if (axisService == null) {
// New service
@@ -205,7 +194,7 @@
public OMElement echoDataElement(String dataElement) throws AxisFault {
- OMElement returnEle = null;
+ OMElement returnEle;
String axis2Repo = ServerConfiguration.getInstance().
getFirstProperty(ServerConfiguration.AXIS2_CONFIG_REPO_LOCATION);
if (org.wso2.wsas.util.Utils.isURL(axis2Repo)) {
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java Sun Aug 5 23:17:33 2007
@@ -763,15 +763,15 @@
cryptoProps.setProperty(ServerCrypto.PROP_ID_DEFAULT_ALIAS,
pkStore.getPrivateKeyAlias());
}
- String trustStores = "";
+ StringBuffer trustStores = new StringBuffer();
for (Iterator tsIter = serviceDO.getTrustedCertStores().iterator();
tsIter.hasNext();) {
KeyStoreDO trustStore = (KeyStoreDO) tsIter.next();
- trustStores += trustStore.getFilePath() + ",";
+ trustStores.append(trustStore.getFilePath()).append(",");
}
ServiceAdmin serviceAdmin = new ServiceAdmin(configCtx);
- cryptoProps.setProperty(ServerCrypto.PROP_ID_TRUST_STORES, trustStores);
+ cryptoProps.setProperty(ServerCrypto.PROP_ID_TRUST_STORES, trustStores.toString());
try {
serviceAdmin.
setServiceParameter2(serviceId,
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java Sun Aug 5 23:17:33 2007
@@ -82,7 +82,7 @@
String serviceGroupName) throws AxisFault {
AxisServiceGroup serviceGroup = getAxisConfig().getServiceGroup(serviceGroupName);
if (serviceGroup == null) {
- throw new AxisFault("Service group " + serviceGroup + "cannnot be found.");
+ throw new AxisFault("Service group " + serviceGroupName + "cannnot be found!");
}
// get the declared parameters
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/StatisticsClient.java Sun Aug 5 23:17:33 2007
@@ -23,7 +23,7 @@
*/
public class StatisticsClient {
- private static StatisticsService statService;
+ private StatisticsService statService;
public StatisticsClient() throws Exception {
statService = new StatisticsService();
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/UserAdmin.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/UserAdmin.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/UserAdmin.java Sun Aug 5 23:17:33 2007
@@ -191,9 +191,9 @@
/**
* Assign a role to an existing user
*
- * @param username
- * @param role
- * @throws AxisFault
+ * @param username The username of the user to whom the role is to be assigned
+ * @param role The role to be assigned
+ * @throws AxisFault If role assignment fails
*/
public void assignRoleToUser(String username, String role) throws AxisFault {
try {
@@ -370,7 +370,7 @@
ServiceUserDO[] userDOs = pm.getUsers();
//Need not to check null because admin is a trivial super user
- String usersWithRole = "";
+ StringBuffer usersWithRole = new StringBuffer();
for (int i = 0; i < userDOs.length; i++) {
ServiceUserDO userDO = userDOs[i];
@@ -378,16 +378,15 @@
if (roleDOs.length == 1) {
if (roleDOs[0].getRole().equalsIgnoreCase(role.trim())) {
- usersWithRole += (userDO.getUsername() + ",");
+ usersWithRole.append(userDO.getUsername()).append(",");
}
}
}
if (usersWithRole.length() != 0) {
- return getDeleteMsg(false, usersWithRole, role);
+ return getDeleteMsg(false, usersWithRole.toString(), role);
}
} catch (Exception e) {
- // e.printStackTrace();
throw AxisFault.makeFault(e);
}
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/Phases.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/Phases.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/Phases.java Sun Aug 5 23:17:33 2007
@@ -49,13 +49,14 @@
}
public String toString() {
- String str = "flowType:" + flowType + " " + global + "\n";
+ StringBuffer str =
+ new StringBuffer("flowType:").append(flowType).append(" ").append(global).append("\n");
for (int i = 0; i < phase.size(); i++) {
Object o = phase.get(i);
- str = str + o + "\n";
+ str.append(o).append("\n");
}
- return str;
+ return str.toString();
}
}
Modified: trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java
==============================================================================
--- trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java (original)
+++ trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java Sun Aug 5 23:17:33 2007
@@ -64,15 +64,13 @@
String uuid = String.valueOf(System.currentTimeMillis() + Math.random());
AxisServiceGroup axisServiceGroup =
configurationContext.getAxisConfiguration().getServiceGroup(serviceGroupName);
- if (serviceGroupName == null) {
- String error = ServiceArchiveCreator.class.getName() + " AxisServiceGroup " +
- serviceGroupName +
- " couldn't be found";
+ if (axisServiceGroup == null) {
+ String error = "Service group " + serviceGroupName + " not found!";
log.error(error);
throw new AxisFault(error);
}
- //TODO until a perper way to find the service type from Axis2, follwoing workaround has
+ //TODO until a proper way to find the service type from Axis2, follwoing workaround has
// TODO been applied to JIRA - 378
if (serviceGroupName.indexOf(".jar") > -1 || serviceGroupName.indexOf(".class") > -1) {
String message = "WSO2 Web Services Application Server does not " +
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/WSASConfigurationManagerListener.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/WSASConfigurationManagerListener.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/WSASConfigurationManagerListener.java Sun Aug 5 23:17:33 2007
@@ -65,7 +65,7 @@
* The system waits for DEFAULT_COMMIT_TIMEOUT ms before reverting to the old configuration
* and continuing to service Web service requests
*/
- private final int DEFAULT_COMMIT_TIMEOUT = 50000;
+ private static final int DEFAULT_COMMIT_TIMEOUT = 50000;
/**
* Keeps track of whether a commit timer is currently running
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/AbstractConfigurationCommand.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/AbstractConfigurationCommand.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/AbstractConfigurationCommand.java Sun Aug 5 23:17:33 2007
@@ -33,7 +33,7 @@
*/
public abstract class AbstractConfigurationCommand extends ConfigurationClusteringCommand {
- protected static Log log = LogFactory.getLog(AbstractConfigurationCommand.class);
+ protected static final Log log = LogFactory.getLog(AbstractConfigurationCommand.class);
protected void addBlockAllRequestsParameter(AxisServiceGroup serviceGroup) {
if (serviceGroup == null) {
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/ApplyServicePolicyCommand.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/ApplyServicePolicyCommand.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/ApplyServicePolicyCommand.java Sun Aug 5 23:17:33 2007
@@ -110,7 +110,7 @@
this.serviceName = serviceName;
}
- private class ServicePolicy {
+ private static class ServicePolicy {
private AxisService axisService;
private Policy policy;
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/LoadServiceGroupsCommand.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/LoadServiceGroupsCommand.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/LoadServiceGroupsCommand.java Sun Aug 5 23:17:33 2007
@@ -43,6 +43,7 @@
private List axisServiceGroups = new ArrayList();
private String[] serviceGroupNames;
+ private static final Random RANDOM = new Random();
public synchronized void process(ConfigurationContext configCtx) throws Exception {
log.info("Going to load service groups...");
@@ -67,7 +68,7 @@
DataHandler dh = new DataHandler(new URL(axis2Repo + "services/" + sgName));
String tempDir =
serverConfig.getFirstProperty("WorkDirectory") + File.separator +
- (System.currentTimeMillis() + new Random().nextDouble());
+ (System.currentTimeMillis() + RANDOM.nextDouble());
new File(tempDir).mkdirs();
serviceArchive = new File(tempDir + File.separator + sgName);
FileOutputStream out = new FileOutputStream(serviceArchive);
Modified: trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/UnloadServiceGroupsCommand.java
==============================================================================
--- trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/UnloadServiceGroupsCommand.java (original)
+++ trunk/wsas/java/modules/clustering/src/org/wso2/wsas/clustering/configuration/commands/UnloadServiceGroupsCommand.java Sun Aug 5 23:17:33 2007
@@ -81,7 +81,7 @@
log.info("Rolled back " + this);
}
- public void setServiceGroupNames(String[] serviceGroupNames) {
+ public synchronized void setServiceGroupNames(String[] serviceGroupNames) {
this.serviceGroupNames = serviceGroupNames;
}
Modified: trunk/wsas/java/modules/core/bin/wso2wsas.bat
==============================================================================
--- trunk/wsas/java/modules/core/bin/wso2wsas.bat (original)
+++ trunk/wsas/java/modules/core/bin/wso2wsas.bat Sun Aug 5 23:17:33 2007
@@ -82,14 +82,6 @@
if ""%1""==""--start"" goto commandLifecycle
if ""%1""==""start"" goto commandLifecycle
-if ""%1""==""-run"" goto commandLifecycle
-if ""%1""==""--run"" goto commandLifecycle
-if ""%1""==""run"" goto commandLifecycle
-
-if ""%1""==""-restart"" goto commandLifecycle
-if ""%1""==""--restart"" goto commandLifecycle
-if ""%1""==""restart"" goto commandLifecycle
-
if ""%1""==""-stop"" goto commandLifecycle
if ""%1""==""--stop"" goto commandLifecycle
if ""%1""==""stop"" goto commandLifecycle
@@ -98,25 +90,25 @@
if ""%1""==""-debug"" goto commandDebug
if ""%1""==""--debug"" goto commandDebug
-if ""%1""==""version"" goto commandVersion
-if ""%1""==""-version"" goto commandVersion
-if ""%1""==""--version"" goto commandVersion
-
-if ""%1""==""help"" goto getHelp
-if ""%1""==""-help"" goto getHelp
-if ""%1""==""--help"" goto getHelp
-if ""%1""==""?"" goto getHelp
-if ""%1""==""-?"" goto getHelp
+for %%c in (%*)
+do
+ if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
+ CMD="--debug"
+ fi
+ if [ "$CMD" = "--debug" ]; then
+ PORT=$c
+ fi
+ if [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ]; then
+ CMD="--stop"
+ fi
+ if [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start" ]; then
+ CMD="--start"
+ fi
+done
shift
goto setupArgs
-rem ----- commandVersion -------------------------------------------------------
-:commandVersion
-shift
-echo WSO2 WSAS v 2.0
-goto end
-
rem ----- commandDebug ---------------------------------------------------------
:commandDebug
shift
@@ -132,21 +124,10 @@
rem ----- commandLifecycle -----------------------------------------------------
:commandLifecycle
+
set CMD=%1
goto findJdk
-rem ----- getHelp --------------------------------------------------------------
-:getHelp
- echo Usage: wso2wsas.bat [command]
- echo command:
- echo --start Start WSO2 WSAS as a background process
- echo --run Run WSO2 WSAS
- echo --restart Restart WSO2 WSAS
- echo --stop Stop WSO2 WSAS
- echo --debug Start WSO2 WSAS in remote debugging mode. You need to specify the debugging port after this argument.
- echo --version What version of WSO2 WSAS are you running?
-goto end
-
rem ----- doneStart ------------------------------------------------------------
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
@@ -174,20 +155,16 @@
goto jdk16
:unknownJdk
-echo Starting WSO2 Web Services Application Server v at wso2wsas_version@ (in unsupported JDK)
echo [ERROR] WSO2 WSAS is supported only on JDK 1.4 and higher
goto end
:jdk14
- echo Starting WSO2 Web Services Application Server v at wso2wsas_version@ (in JDK 1.4)
set WSO2WSAS_CLASSPATH="%WSO2WSAS_HOME%\lib\bcprov-jdk13-132.jar";%WSO2WSAS_CLASSPATH%
goto runServer
:jdk15
- echo Starting WSO2 Web Services Application Server v at wso2wsas_version@ (in JDK 1.5)
set WSO2WSAS_CLASSPATH="%WSO2WSAS_HOME%\lib\bcprov-jdk15-132.jar";%WSO2WSAS_CLASSPATH%
goto runServer
:jdk16
- echo Starting WSO2 Web Services Application Server v at wso2wsas_version@ (in JDK 1.6)
echo [WARNING] WSO2 WSAS has not been fully tested on JDK 1.6
set WSO2WSAS_CLASSPATH="%WSO2WSAS_HOME%\lib\bcprov-jdk15-132.jar";%WSO2WSAS_CLASSPATH%
goto runServer
@@ -207,14 +184,14 @@
if ""%1""==""--start"" goto startNewPrompt
if ""%1""==""start"" goto startNewPrompt
-"%JAVA_HOME%\bin\java" -classpath %WSO2WSAS_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dwso2wsas.home="%WSO2WSAS_HOME%" -Dwso2wsas.server.xml=%WSO2WSAS_HOME%\conf\server.xml org.wso2.wsas.Main %CMD%
+"%JAVA_HOME%\bin\java" -classpath %WSO2WSAS_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dwso2wsas.home="%WSO2WSAS_HOME%" -Dwso2wsas.server.xml=%WSO2WSAS_HOME%\conf\server.xml -Dserver.script=wso2wsas.bat org.wso2.wsas.Main %CMD%
:end
endlocal
:startNewPrompt
rem start "Web Services Application Server"
-"%JAVA_HOME%\bin\java" -classpath %WSO2WSAS_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dwso2wsas.home="%WSO2WSAS_HOME%" -Dwso2wsas.server.xml=%WSO2WSAS_HOME%\conf\server.xml org.wso2.wsas.Main %CMD%
+"%JAVA_HOME%\bin\java" -classpath %WSO2WSAS_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dwso2wsas.home="%WSO2WSAS_HOME%" -Dwso2wsas.server.xml=%WSO2WSAS_HOME%\conf\server.xml -Dserver.script=wso2wsas.bat org.wso2.wsas.Main %CMD%
if not "%curDrive%" == "%wsasDrive%" %curDrive%:
endlocal
Modified: trunk/wsas/java/modules/core/bin/wso2wsas.sh
==============================================================================
--- trunk/wsas/java/modules/core/bin/wso2wsas.sh (original)
+++ trunk/wsas/java/modules/core/bin/wso2wsas.sh Sun Aug 5 23:17:33 2007
@@ -149,41 +149,36 @@
JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
fi
-export SERVER_NAME="WSO2 Web Services Application Server, v at wso2wsas_version@"
-
# ----- Process the input command ----------------------------------------------
-if [ "$1" = "" ]; then
- CMD="RUN"
-elif [ "$1" = "-help" ] || [ "$1" = "--help" ] || [ "$1" = "help" ] || [ "$1" = "?" ]; then
- echo "Usage: wso2wsas.sh [command]"
- echo "command:"
- echo " --start Start WSO2 WSAS as a background process"
- echo " --run Run WSO2 WSAS"
- echo " --restart Restart WSO2 WSAS"
- echo " --stop Stop WSO2 WSAS"
- echo " --debug Start WSO2 WSAS in remote debugging mode.\
- You need to specify the debugging port after this argument."
- echo " -version What version of WSO2 WSAS are you running?"
- exit 1
-elif [ "$1" = "-version" ] || [ "$1" = "--version" ] || [ "$1" = "version" ]; then
- echo " WSO2 WSAS v at wso2wsas_version@"
- exit 0
-elif [ "$1" = "-stop" ] || [ "$1" = "--stop" ] || [ "$1" = "stop" ]; then
- sh "$WSO2WSAS_HOME"/bin/shutdown.sh
+for c in $*
+do
+ if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
+ CMD="--debug"
+ fi
+ if [ "$CMD" = "--debug" ]; then
+ PORT=$c
+ fi
+ if [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ]; then
+ CMD="--stop"
+ fi
+ if [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start" ]; then
+ CMD="--start"
+ fi
+done
+
+if [ "$CMD" = "--stop" ]; then
+ sh "$WSO2WSAS_HOME"/bin/shutdown.sh $*
exit 0
-elif [ "$1" = "-start" ] || [ "$1" = "--start" ] || [ "$1" = "start" ]; then
- sh "$WSO2WSAS_HOME"/bin/startup.sh
+elif [ "$CMD" = "--start" ]; then
+ sh "$WSO2WSAS_HOME"/bin/startup.sh $*
exit 0
-elif [ "$1" = "-debug" ] || [ "$1" = "--debug" ] || [ "$1" = "debug" ]; then
- echo " Starting $SERVER_NAME in debug mode"
- if [ "$2" = "" ]; then
+elif [ "$CMD" = "--debug" ]; then
+ if [ "$PORT" = "" ]; then
echo " Please specify the debug port after the --debug option"
exit 1
fi
CMD="RUN"
- JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$2"
-else
- CMD="$1"
+ JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$PORT"
fi
# ---------- Handle the SSL Issue with proper JDK version --------------------
@@ -192,17 +187,13 @@
jdk_14=`$JAVA_HOME/bin/java -version 2>&1 | grep 1.4`
if [ "$jdk_15" ]; then
- echo " Starting $SERVER_NAME (in JDK 1.5)"
WSO2WSAS_CLASSPATH="$WSO2WSAS_HOME/lib/bcprov-jdk15- at bcprov_jdk15_version@.jar":$WSO2WSAS_CLASSPATH
elif [ "$jdk_14" ]; then
- echo " Starting $SERVER_NAME (in JDK 1.4)"
WSO2WSAS_CLASSPATH="$WSO2WSAS_HOME/lib/bcprov-jdk13- at bcprov_jdk13_version@.jar":$WSO2WSAS_CLASSPATH
elif [ "$jdk_16" ]; then
- echo " Starting $SERVER_NAME (in JDK 1.6)"
echo " [WARNING] WSO2 WSAS has not been fully tested on JDK 1.6"
WSO2WSAS_CLASSPATH="$WSO2WSAS_HOME/lib/bcprov-jdk15- at bcprov_jdk15_version@.jar":$WSO2WSAS_CLASSPATH
else
- echo " Starting $SERVER_NAME (in unsupported JDK)"
echo " [ERROR] WSO2 WSAS is supported only on JDK 1.4 and higher"
exit 1
fi
@@ -212,12 +203,10 @@
# ----- Execute The Requested Command -----------------------------------------
cd "$WSO2WSAS_HOME"
-echo " Using WSO2WSAS_HOME: $WSO2WSAS_HOME"
-echo " Using JAVA_HOME: $JAVA_HOME"
exec "$JAVACMD" \
$JAVA_OPTS \
-classpath "$WSO2WSAS_CLASSPATH" \
-Djava.endorsed.dirs="$WSO2WSAS_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
--Dwso2wsas.home="$WSO2WSAS_HOME" -Dwso2wsas.server.xml="$WSO2WSAS_HOME/conf/server.xml" org.wso2.wsas.Main \
-$CMD
\ No newline at end of file
+-Dwso2wsas.home="$WSO2WSAS_HOME" -Dwso2wsas.server.xml="$WSO2WSAS_HOME/conf/server.xml" -Dserver.script=$0 \
+org.wso2.wsas.Main $*
\ No newline at end of file
Modified: trunk/wsas/java/modules/core/pom.xml
==============================================================================
--- trunk/wsas/java/modules/core/pom.xml (original)
+++ trunk/wsas/java/modules/core/pom.xml Sun Aug 5 23:17:33 2007
@@ -96,8 +96,8 @@
<skip>false</skip>
<excludes>
<exclude>**/*Abstract*.java</exclude>
- <exclude>**/TomcatServerTest.java</exclude>
<exclude>**/*CryptoUtilTest*.java</exclude>
+ <exclude>**/TomcatServerTest.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
@@ -216,6 +216,7 @@
-+ tomcat_test
-+ docs
<nothing>
+ -+ samples
-+ conf
server.xml
wso2wsas.jks
@@ -237,6 +238,7 @@
<property name="tomcat_repository"
value="${tomcat_test}/repository"/>
<property name="tomcat_docs" value="${tomcat_test}/docs"/>
+ <property name="tomcat_samples" value="${tomcat_test}/samples"/>
<property name="tomcat_test_conf" value="${tomcat_test}/conf"/>
<property name="tomcat_root"
value="${tomcat_test}/lib/tomcat/webapps/ROOT/WEB-INF"/>
@@ -246,6 +248,7 @@
<mkdir dir="${tomcat_root}"/>
<mkdir dir="${tomcat_repository}"/>
<mkdir dir="${tomcat_docs}"/>
+ <mkdir dir="${tomcat_samples}"/>
<copy todir="${tomcat_conf}">
<fileset dir="lib/appservers/tomcat/embedded">
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/Main.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/Main.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/Main.java Sun Aug 5 23:17:33 2007
@@ -42,7 +42,8 @@
public static final String COMMAND_STOP = "STOP";
public static final String COMMAND_RUN = "RUN";
public static final String COMMAND_STATUS = "STATUS";
- public static final String COMMAND_HELP = "HELP";
+ public static final String COMMAND_VERSION = "VERSION";
+ public static final String COMMAND_DEBUG = "DEBUG";
public static Thread shutdownHookThread;
@@ -67,22 +68,22 @@
} catch (ServerConfigurationException e) {
throw new RuntimeException(e);
}
- System.setProperty(ServerConstants.DERBY_HOME,
- serverConfig.getFirstProperty("Database.Home"));
+ if (System.getProperty(ServerConstants.DERBY_HOME) == null) {
+ System.setProperty(ServerConstants.DERBY_HOME,
+ serverConfig.getFirstProperty("Database.Home"));
+ }
}
public void startServer() {
- startListeners();
- }
-
- private void startListeners() {
+ System.err.println("###### Gonna start listeners");
try {
webServer = new TomcatServer();
webServer.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
+ System.err.println("######DONE");
}
public void stop() throws IOException, ServerException {
@@ -102,18 +103,52 @@
public static void main(String[] args) {
System.setProperty(ServerConstants.WSO2WSAS_START_TIME,
String.valueOf(System.currentTimeMillis()));
- String cmd;
- if (args.length >= 1) {
- cmd = args[0];
- } else {
- printUsages();
- return;
+ String cmd = null;
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ if (arg.startsWith("-D")) {
+ int indexOfEq = arg.indexOf("=");
+ String property;
+ String value;
+ if (indexOfEq != -1) {
+ property = arg.substring(2, indexOfEq);
+ value = arg.substring(indexOfEq + 1);
+ } else {
+ property = arg.substring(2);
+ value = "true";
+ }
+ System.setProperty(property, value);
+ } else {
+ if (cmd == null) {
+ cmd = arg;
+ } else if (!cmd.toUpperCase().endsWith(COMMAND_DEBUG)) {
+ printUsages();
+ return;
+ }
+ }
+ }
+
+ if (cmd == null) {
+ cmd = COMMAND_RUN;
}
final Main main = new Main();
String serverName = serverConfig.getFirstProperty("Name");
- if (cmd.toUpperCase().endsWith(COMMAND_START) || cmd.toUpperCase().endsWith(COMMAND_RUN)) {
+ if (cmd.toUpperCase().endsWith(COMMAND_START) ||
+ cmd.toUpperCase().endsWith(COMMAND_RUN) ||
+ cmd.toUpperCase().endsWith(COMMAND_DEBUG)) {
+ if (cmd.toUpperCase().endsWith(COMMAND_DEBUG)) {
+ log.info("Starting " + serverName + " " +
+ serverConfig.getFirstProperty("Version") + " in debug mode");
+ } else {
+ log.info("Starting " + serverName + " " +
+ serverConfig.getFirstProperty("Version"));
+ }
+ log.info("Using Java Home : " + System.getProperty("java.home"));
+ log.info("Using Java Version : " + System.getProperty("java.version"));
+ log.info("Using " + serverName + " Home : " + System.getProperty("wso2wsas.home"));
+
main.startServer();
} else if (cmd.toUpperCase().endsWith(COMMAND_RESTART)) {
try {
@@ -139,6 +174,8 @@
String msg = "Cannot stop " + serverName;
log.error(msg, e);
}
+ } else if (cmd.toUpperCase().endsWith(COMMAND_VERSION)) {
+ System.out.println(serverName + " version: " + serverConfig.getFirstProperty("Version"));
} else if (cmd.toUpperCase().endsWith(COMMAND_STATUS)) {
try {
main.status();
@@ -146,27 +183,22 @@
String msg = "Cannot get status of " + serverName;
log.error(msg, e);
}
- } else if (cmd.toUpperCase().endsWith(COMMAND_HELP)) {
- printUsages();
} else {
printUsages();
}
}
private static void printUsages() {
- System.out.println("======================================================");
- System.out.println("= WSO2 WSAS Help =");
- System.out.println("======================================================");
- System.out.println();
- System.out.println(" Usage : WSO2WSAS <action>");
- System.out.println();
- System.out.println("<action> \t\t : Current actions supported - " +
- COMMAND_START + ", " +
- COMMAND_RUN + ", " +
- COMMAND_RESTART + ", " +
- COMMAND_STATUS + ", " +
- COMMAND_STOP + ", " +
- COMMAND_HELP);
+ String serverName = serverConfig.getFirstProperty("Name");
+ System.out.println("Usage: " + System.getProperty("server.script") + " [command]");
+ System.out.println("command:");
+ System.out.println("\t--start\t\tStart " + serverName + " as a background process");
+ System.out.println("\t--run\t\tRun " + serverName);
+ System.out.println("\t--restart\tRestart " + serverName);
+ System.out.println("\t--stop\t\tStop " + serverName);
+ System.out.println("\t--debug <port> \tStart " + serverName + " in remote debugging mode." +
+ "\n\t\t\tport: The remote debugging port.");
+ System.out.println("\t--version\tWhat version of " + serverName + " are you running?");
System.out.println();
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/MainServlet.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/MainServlet.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/MainServlet.java Sun Aug 5 23:17:33 2007
@@ -117,7 +117,6 @@
}
}
- log.info("Using WSO2 WSAS Home = " + wso2wsasHome);
System.setProperty(ServerConstants.AXIS2_HOME, wso2wsasHome);
System.setProperty(ServerConstants.WSO2WSAS_HOME, wso2wsasHome);
@@ -147,7 +146,7 @@
// ServerInfo class
String serverInfoImplClass = props.getProperty(ServerPropertyKeys.APPSERVER_INFO_IMPL);
- log.info("Using Server Info Class = " + serverInfoImplClass);
+ log.info("Using Server Info Class: " + serverInfoImplClass);
serverInfo = (ServerInfo) Class.forName(serverInfoImplClass).newInstance();
serverInfo.setProperties(props);
is.close();
@@ -164,8 +163,8 @@
try {
start(servletConfig);
serverInfo.process();
- ServerManager.httpPort = serverInfo.getHttpPort();
- ServerManager.httpsPort = serverInfo.getHttpsPort();
+ ServerManager.getInstance().setHttpPort(serverInfo.getHttpPort());
+ ServerManager.getInstance().setHttpsPort(serverInfo.getHttpsPort());
initAdminUIServletFilter(servletConfig);
@@ -228,8 +227,8 @@
adminUIServletFilter.
init((Map) configCtx.getProperty(ServerConstants.GENERATED_PAGES),
Utils.isAdminConsoleEnabled(),
- ServerManager.httpsPort,
- ServerManager.httpPort,
+ ServerManager.getInstance().getHttpsPort(),
+ ServerManager.getInstance().getHttpPort(),
configCtx.getServicePath());
}
@@ -238,8 +237,11 @@
private void printInfo(long startTime) {
log.info("Using Repository " + serverManager.axis2RepoLocation);
log.info("");
- log.info("Listening for HTTP on ----> " + ServerManager.httpPort);
- log.info("Listening for HTTPS on ----> " + ServerManager.httpsPort);
+ log.info("Listening for HTTP on ----> " +
+ ServerManager.getInstance().getHttpPort());
+ log.info("Listening for HTTPS on ----> " +
+ ServerManager.getInstance().getHttpsPort());
+ log.info("Management console is accessible only via the HTTPS URL");
log.info("");
// serverManager.printMgtConsoleURL();
log.info(serverName + " started in " + (System.currentTimeMillis() - startTime) + " ms");
@@ -382,8 +384,10 @@
AdminUIServletFilter adminUIServletFilter = (AdminUIServletFilter) attrib;
Map genPages = (Map) serverManager.configContext.
getProperty(ServerConstants.GENERATED_PAGES);
- adminUIServletFilter.init(genPages, Utils.isAdminConsoleEnabled(),
- ServerManager.httpsPort, ServerManager.httpPort,
+ adminUIServletFilter.init(genPages,
+ Utils.isAdminConsoleEnabled(),
+ ServerManager.getInstance().getHttpsPort(),
+ ServerManager.getInstance().getHttpPort(),
serverManager.configContext.getServicePath());
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java Sun Aug 5 23:17:33 2007
@@ -41,8 +41,7 @@
* during startup.
*/
public final class ServerManager {
- public static int httpPort = 10001;
- public static int httpsPort = 11001;
+ private static final Logger log = Logger.getLogger(ServerManager.class);
public String axis2RepoLocation;
public Monitor monitor;
@@ -50,11 +49,12 @@
public String serverWorkDir;
public String adminResourceBase;
- private static Logger log = Logger.getLogger(ServerManager.class);
private ServerConfiguration serverConfig;
private static ServerManager instance;
private ListenerManager listenerManager;
+ private int httpPort = 10001;
+ private int httpsPort = 11001;
public static ServerManager getInstance() {
if (instance == null) {
@@ -67,6 +67,22 @@
this.serverConfig = ServerConfiguration.getInstance();
}
+ public void setHttpPort(int httpPort) {
+ this.httpPort = httpPort;
+ }
+
+ public void setHttpsPort(int httpsPort) {
+ this.httpsPort = httpsPort;
+ }
+
+ public int getHttpPort() {
+ return httpPort;
+ }
+
+ public int getHttpsPort() {
+ return httpsPort;
+ }
+
public void start() throws ServerException {
try {
//Setting the codegen configuration properties for try it! functionality
@@ -135,7 +151,7 @@
}
}
}
-
+
public void status() {
}
@@ -165,7 +181,7 @@
public void startListenerManager() {
listenerManager = new ListenerManager();
listenerManager.startSystem(configContext);
- ListenerManager.defaultConfigurationContext = configContext;
+// ListenerManager.defaultConfigurationContext = configContext; //TODO: This is a misuse of a static field
}
public void stopListenerManager() throws AxisFault {
@@ -174,7 +190,7 @@
listenerManager.destroy();
}
//we need to call this method to clean the team fils we created.
- if (configContext !=null) {
+ if (configContext != null) {
configContext.terminate();
}
} catch (Exception ignored) {
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/TomcatRepositoryListener.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/TomcatRepositoryListener.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/TomcatRepositoryListener.java Sun Aug 5 23:17:33 2007
@@ -147,7 +147,7 @@
}
}
- private class WebContext {
+ private static class WebContext {
private long timestamp;
private Context context;
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java Sun Aug 5 23:17:33 2007
@@ -137,48 +137,50 @@
}
}
} else {
+
+ // STS specific configurations
if (axisService.getName().equals(ServerConstants.STS_NAME)
&& axisEvent.getEventType() == AxisEvent.SERVICE_DEPLOY) {
// Add the STS Service
ServerConfiguration config = ServerConfiguration.getInstance();
- String ksPath = new File(config.getFirstProperty("Security.KeyStore.Location")).getAbsolutePath();
KeyStoreDO[] keystores = persistenceMgr.getKeyStores();
KeyStoreDO sysKs = null;
for (int i = 0; i < keystores.length; i++) {
- if (keystores[i].getFilePath().equals(ksPath)) {
+ if (keystores[i].getIsPrimaryKeyStore()) {
sysKs = keystores[i];
break;
}
}
-
- String issuerName = config.getFirstProperty("HostName");
- if (issuerName == null) {
- //HostName not set :-( use wso2wsas-sts
- issuerName = ServerConstants.STS_NAME;
- }
- String cryptoProvider = ServerCrypto.class.getName();
- String ksId = sysKs.getKeyStoreName();
- Properties props = RampartConfigUtil.getServerCryptoProperties(
- new String[]{ksId}, ksId, sysKs.getPrivateKeyAlias());
-
- SAMLTokenIssuerConfig stsSamlConfig = new SAMLTokenIssuerConfig(
- issuerName, cryptoProvider, props);
- stsSamlConfig.setIssuerKeyAlias(config.getFirstProperty("Security.KeyStore.KeyAlias"));
- stsSamlConfig.setIssuerKeyPassword(config.getFirstProperty("Security.KeyStore.KeyPassword"));
- stsSamlConfig.setAddRequestedAttachedRef(true);
- stsSamlConfig.setAddRequestedUnattachedRef(true);
- stsSamlConfig.setKeyComputation(2);
- stsSamlConfig.setProofKeyType(TokenIssuerUtil.BINARY_SECRET);
- try {
- //remove param is exists
- Parameter param = axisService.getParameter(SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG.getLocalPart());
- if (param == null) {
- //Add new parameter
- axisService.addParameter(stsSamlConfig.getParameter());
+ if (sysKs != null) {
+ String issuerName = config.getFirstProperty("HostName"); //TODO: Is this correct?
+ if (issuerName == null) {
+ //HostName not set :-( use wso2wsas-sts
+ issuerName = ServerConstants.STS_NAME;
+ }
+ String cryptoProvider = ServerCrypto.class.getName();
+ String ksId = sysKs.getKeyStoreName();
+ Properties props = RampartConfigUtil.getServerCryptoProperties(
+ new String[]{ksId}, ksId, sysKs.getPrivateKeyAlias());
+
+ SAMLTokenIssuerConfig stsSamlConfig = new SAMLTokenIssuerConfig(
+ issuerName, cryptoProvider, props);
+ stsSamlConfig.setIssuerKeyAlias(config.getFirstProperty("Security.KeyStore.KeyAlias"));
+ stsSamlConfig.setIssuerKeyPassword(config.getFirstProperty("Security.KeyStore.KeyPassword"));
+ stsSamlConfig.setAddRequestedAttachedRef(true);
+ stsSamlConfig.setAddRequestedUnattachedRef(true);
+ stsSamlConfig.setKeyComputation(2);
+ stsSamlConfig.setProofKeyType(TokenIssuerUtil.BINARY_SECRET);
+ try {
+ //remove param is exists
+ Parameter param = axisService.getParameter(SAMLTokenIssuerConfig.SAML_ISSUER_CONFIG.getLocalPart());
+ if (param == null) {
+ //Add new parameter
+ axisService.addParameter(stsSamlConfig.getParameter());
+ }
+ } catch (AxisFault e) {
+ log.error("Error setting STS-SAML configuration parameter", e);
}
- } catch (AxisFault e) {
- log.error("Error setting STS-SAML configuration parameter", e);
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/deployment/ServerConfigurator.java Sun Aug 5 23:17:33 2007
@@ -52,7 +52,7 @@
private static Log log = LogFactory.getLog(ServerConfigurator.class);
- private static List globallyEngagedModules = new ArrayList();
+ private List globallyEngagedModules = new ArrayList();
private String axis2xml;
private String repoLocation;
private String webLocation;
@@ -214,11 +214,10 @@
if (axisConfig.
getTransportIn(transport.getTransportProtocol()) == null) {
if (!transport.getServices().isEmpty()) {
- log.fatal("Cannot remove the " + transport.getTransportProtocol() + " transport.\n" +
- "\t\t\t\tOne or more services are bound to this transport. \n" +
- "\t\t\t\tAdd this transport back to the axis2.xml file and restart the server.");
- log.fatal("WSO2 WSAS Server start failed.");
- System.exit(0);
+ String msg = "Cannot remove the " + transport.getTransportProtocol() + " transport.\n" +
+ "\t\t\t\tOne or more services are bound to this transport. \n" +
+ "\t\t\t\tAdd this transport back to the axis2.xml file and restart the server.";
+ throw new AxisFault(msg);
} else {
pm.deleteEntity(transport);
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/AbstractFeed.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/AbstractFeed.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/AbstractFeed.java Sun Aug 5 23:17:33 2007
@@ -35,8 +35,8 @@
* @throws SocketException
*/
protected String getUrl(String serviceName, String serviceContextPath) throws SocketException {
- return "http://" + NetworkUtils.getLocalHostname() + ":" + ServerManager.httpPort +
- serviceContextPath + "/" + serviceName;
+ return "http://" + NetworkUtils.getLocalHostname() + ":" +
+ ServerManager.getInstance().getHttpPort() + serviceContextPath + "/" + serviceName;
}
/**
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedConstants.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedConstants.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedConstants.java Sun Aug 5 23:17:33 2007
@@ -38,9 +38,8 @@
public static final String EVENTING_LISTENER = "eventingListener";
public static final String CHANNEL_URL_KEY = "FEED_CHANNEL_DEFAULT_URL";
public static final String ITEM_URL_KEY = "FEED_ITEM_DEFAULT_URL";
- public static String CHANNEL_URL_VALUE = "http://127.0.0.1:8080/axis2/";
- public static String ITEM_URL_VALUE = "http://127.0.0.1:8080/axis2/";
-
+ public static final String CHANNEL_URL_VALUE = "http://127.0.0.1:8080/axis2/";
+ public static final String ITEM_URL_VALUE = "http://127.0.0.1:8080/axis2/";
public static final String NAMESPASE_URL = "http://ws.apache.org/axis2/feed/atom/ns#";
public static final String NAMWSPACE_PREFIX = "axis2atom";
@@ -77,53 +76,4 @@
public static final String FEED_ELEMENT_NAME = "feed";
public static final String FEED_VERSION_ATTR = "version";
public static final String FEED_LANG_ATTR = "lang";
-
-
- String SOURCE_NAME = "source";
- String PUB_DATE_NAME = "pubDate";
- String LAST_BUILD_DATE_NAME = "lastBuildDate";
-
- String RSS_NAMESPACE_URI = "";
- String RSS_PREFIX = "";
- String RSS_NAME = "rss";
- String RSS_VERSION_ATTR = "version";
-
- String CHANNEL_NAME = "channel";
- String CHANNEL_TITLE_STRING = "title";
- String CHANNEL_LINK_STRING = "link";
- String CHANNEL_DESCRIPTON_STRING = "description";
-
- String ITEM_NAME = "item";
- String ITEM_TITLE_STRING = "title";
- String ITEM_LINK_STRING = "link";
- String ITEM_DESCRIPTON_STRING = "description";
-
- String CLOUD_NAME = "cloud";
- String CLOUD_DOMAIN_ATTR = "domain";
- String CLOUD_REGPRO_ATTR = "registerProcedure";
- String CLOUD_PORT_ATTR = "port";
- String CLOUD_PATH_ATTR = "path";
- String CLOUD_PROTOCOL_ATTR = "protocol";
-
- String GUID_ID_STRING = "guid";
- String GUID_ISPERMERLINK_ATTR = "isPermaLink";
-
- String CATEGORY_STRING = "category";
- String CATEGORY_DOMAIN_ATTR = "domain";
-
- String IMAGE_NAME = "image";
- String IMAGE_URL_STRING = "url";
- String IMAGE_LINK_STRING = "link";
- String IMAGE__DESCRIPTION_STRING = "description";
- String IMAGE_TITLE_STRING = "title";
- String IMAGE_HEIGHT_STRING = "height";
- String IMAGE_WIDTH_STRING = "width";
-
- String COPYRIGHT_ELEMNT_NAME = "copyright";
- String WEBMASTER_ELEMNT_NAME = "webMaster";
- String MANAGINGEDITOR_ELEMNT_NAME = "managingEditor";
- String LANGUAGE_ELEMNT_NAME = "language";
- String GENERATOR_ELEMT_NAME = "generator";
- String DOCS_ELEMENT_NAME = "docs";
- String TTL_ELEMENT_NAME = "ttl";
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/atom/AtomElement.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/atom/AtomElement.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/atom/AtomElement.java Sun Aug 5 23:17:33 2007
@@ -48,7 +48,7 @@
String ip = null;
try {
ip = NetworkUtils.getLocalHostname();
- ip = "http://" + ip + ":" + ServerManager.httpPort;
+ ip = "http://" + ip + ":" + ServerManager.getInstance().getHttpPort();
} catch (SocketException e) {
log.warn("NetworkUtils.getLocalHostname()");
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/RSSElement.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/RSSElement.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/RSSElement.java Sun Aug 5 23:17:33 2007
@@ -47,7 +47,7 @@
OMElement link = fac.createOMElement("link", null);
try {
String ip = NetworkUtils.getLocalHostname();
- ip = "http://" + ip + ":" + ServerManager.httpPort;
+ ip = "http://" + ip + ":" + ServerManager.getInstance().getHttpPort();
link.setText(ip);
} catch (SocketException e) {
log.warn("NetworkUtils.getLocalHostname()");
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/ServiceElement.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/ServiceElement.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/feed/rss/ServiceElement.java Sun Aug 5 23:17:33 2007
@@ -33,7 +33,7 @@
public static final int SERVICE_STOP = 3;
public static final int SERVICE_START = 4;
- private static final SimpleDateFormat DATE_FORMAT =
+ private static final SimpleDateFormat dateFormat =
new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");
private String name;
@@ -100,7 +100,7 @@
OMElement pubDate = fac.createOMElement("pubDate", null);
Date currentTime = Calendar.getInstance().getTime();
- pubDate.setText(DATE_FORMAT.format(currentTime));
+ pubDate.setText(dateFormat.format(currentTime));
item.addChild(pubDate);
OMElement guid = fac.createOMElement("guid", null);
@@ -125,7 +125,7 @@
OMElement pubDate = fac.createOMElement("pubDate", null);
Date currentTime = Calendar.getInstance().getTime();
- pubDate.setText(DATE_FORMAT.format(currentTime));
+ pubDate.setText(dateFormat.format(currentTime));
item.addChild(pubDate);
OMElement guid = fac.createOMElement("guid", null);
@@ -150,7 +150,7 @@
OMElement pubDate = fac.createOMElement("pubDate", null);
Date currentTime = Calendar.getInstance().getTime();
- pubDate.setText(DATE_FORMAT.format(currentTime));
+ pubDate.setText(dateFormat.format(currentTime));
item.addChild(pubDate);
OMElement guid = fac.createOMElement("guid", null);
@@ -160,7 +160,7 @@
return item;
}
- private OMElement getRSSServieElement(OMFactory fac) {
+ private OMElement getRSSServiceElement(OMFactory fac) {
OMElement item = fac.createOMElement("item", null);
OMElement title = fac.createOMElement("title", null);
if (!isUpdate()) {
@@ -183,7 +183,7 @@
OMElement pubDate = fac.createOMElement("pubDate", null);
Date currentTime = Calendar.getInstance().getTime();
- pubDate.setText(DATE_FORMAT.format(currentTime));
+ pubDate.setText(dateFormat.format(currentTime));
item.addChild(pubDate);
OMElement guid = fac.createOMElement("guid", null);
@@ -343,13 +343,13 @@
if (rssType) {
switch (eventType) {
case SERVICE_ADD: {
- return getRSSServieElement(fac);
+ return getRSSServiceElement(fac);
}
case SERVICE_REMOVE: {
return getServiceRemovedRSS(fac);
}
case SERVICE_UPDATE: {
- return getRSSServieElement(fac);
+ return getRSSServiceElement(fac);
}
case SERVICE_START: {
return startService(fac);
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/AbstractInstaller.java Sun Aug 5 23:17:33 2007
@@ -84,7 +84,7 @@
}
}
- private void serializeWsasProperties(String wso2wsasHome) {
+ private void serializeWsasProperties(String wso2wsasHome) throws InstallationException {
System.out.println("Creating " + InstallerConstants.WSO2WSAS_PROPERTIES + " file...");
File tmpDir = new File(InstallerConstants.TMP_DIR + File.separator + "lib" + File.separator +
"wso2wsas" + File.separator + "WEB-INF" + File.separator + "classes");
@@ -115,9 +115,9 @@
}
writer.flush();
} catch (IOException e) {
- System.err.println(" Could not create " + InstallerConstants.WSO2WSAS_PROPERTIES +
- " file :" + e);
- System.exit(1);
+ String msg = " Could not create " + InstallerConstants.WSO2WSAS_PROPERTIES +
+ " file :" + e;
+ throw new InstallationException(msg);
} finally {
if (writer != null) {
try {
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/GeronimoInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/GeronimoInstaller.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/GeronimoInstaller.java Sun Aug 5 23:17:33 2007
@@ -87,7 +87,7 @@
!(response.trim().length() == 0));
if (response.equalsIgnoreCase("n")) {
System.out.println("[INFO] Installation aborted.");
- System.exit(1);
+ return;
}
}
@@ -133,7 +133,7 @@
String deployPlanCmd = geronimoHomeDir.getAbsolutePath() + File.separator +
"bin" + File.separator + script + " --user " +
geronimoUsername + " --password " + geronimoPassword +
- " deploy " + planXml + " " + geronimoHomeDir.getAbsolutePath() + File.separator +
+ " deploy " + planXml + " " + geronimoHomeDir.getAbsolutePath() + File.separator +
"repository" + File.separator + "tranql" + File.separator + "tranql-connector" +
File.separator + "1.2" + File.separator + "tranql-connector-1.2.rar";
@@ -144,10 +144,10 @@
}
System.out.println("OK");
System.out.println("Deploying the wso2wsas.war file");
- String deployWarCmd = geronimoHomeDir.getAbsolutePath() + File.separator +
+ String deployWarCmd = geronimoHomeDir.getAbsolutePath() + File.separator +
"bin" + File.separator + script + " --user " +
geronimoUsername + " --password " + geronimoPassword +
- " deploy "+ InstallerConstants.WSO2WSAS_WAR;
+ " deploy " + InstallerConstants.WSO2WSAS_WAR;
Process deployWarProcess = Runtime.getRuntime().exec(deployWarCmd);
printOutput(deployWarProcess);
if (deployWarProcess.waitFor() != 0) {
@@ -181,10 +181,17 @@
}
private void printOutput(Process process) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
- String op;
- while ((op = reader.readLine()) != null) {
- System.err.println(op);
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ String op;
+ while ((op = reader.readLine()) != null) {
+ System.err.println(op);
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/JBossInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/JBossInstaller.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/JBossInstaller.java Sun Aug 5 23:17:33 2007
@@ -95,7 +95,7 @@
!(response.trim().length() == 0));
if (response.equalsIgnoreCase("n")) {
System.out.println("[INFO] Installation aborted.");
- System.exit(1);
+ return;
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/installer/TomcatInstaller.java Sun Aug 5 23:17:33 2007
@@ -106,7 +106,7 @@
!(response.trim().length() == 0));
if (response.equalsIgnoreCase("n")) {
System.out.println("[INFO] Installation aborted.");
- System.exit(1);
+ return;
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/security/pox/POXSecurityHandler.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/security/pox/POXSecurityHandler.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/security/pox/POXSecurityHandler.java Sun Aug 5 23:17:33 2007
@@ -114,8 +114,8 @@
try {
String requestURI = request.getRequestURI();
response.sendRedirect("https://" +
- NetworkUtils.getLocalHostname() + ":" + ServerManager.httpsPort +
- requestURI);
+ NetworkUtils.getLocalHostname() + ":" +
+ ServerManager.getInstance().getHttpsPort() + requestURI);
return InvocationResponse.ABORT;
} catch (IOException e) {
throw AxisFault.makeFault(e);
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/security/util/RampartConfigUtil.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/security/util/RampartConfigUtil.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/security/util/RampartConfigUtil.java Sun Aug 5 23:17:33 2007
@@ -24,21 +24,21 @@
* Utility methods to compute Rampart configuration
*/
public class RampartConfigUtil {
-
- public static Properties getServerCryptoProperties(
- String[] trustedCertStores, String privateKeyStore,
- String privKeyAlias) {
-
+
+ public static Properties getServerCryptoProperties(String[] trustedCertStores,
+ String privateKeyStore,
+ String privateKeyAlias) {
+
Properties props = new Properties();
- props.setProperty(ServerCrypto.PROP_ID_DEFAULT_ALIAS, privKeyAlias);
+ props.setProperty(ServerCrypto.PROP_ID_DEFAULT_ALIAS, privateKeyAlias);
props.setProperty(ServerCrypto.PROP_ID_KEY_STORE, privateKeyStore);
- String trustedCertStoresStr = "";
+ StringBuffer trustedCertStoresStr = new StringBuffer();
for (int i = 0; i < trustedCertStores.length; i++) {
- trustedCertStoresStr += trustedCertStores[i] + ",";
+ trustedCertStoresStr.append(trustedCertStores[i]).append(",");
}
if (trustedCertStores.length == 0 && trustedCertStores[0].equals(privateKeyStore)) {
- props.setProperty(ServerCrypto.PROP_ID_TRUST_STORES, trustedCertStoresStr);
+ props.setProperty(ServerCrypto.PROP_ID_TRUST_STORES, trustedCertStoresStr.toString());
}
return props;
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/RequestRedirectionFilter.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/RequestRedirectionFilter.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/RequestRedirectionFilter.java Sun Aug 5 23:17:33 2007
@@ -52,7 +52,8 @@
if (httpServletRequest.getRequestURL().toString()
.indexOf(NetworkUtils.getLocalHostname()) == -1) {
httpServletResponse.sendRedirect("https://" +
- NetworkUtils.getLocalHostname() + ":" + ServerManager.httpsPort +
+ NetworkUtils.getLocalHostname() + ":" +
+ ServerManager.getInstance().getHttpsPort() +
(contextRoot.equals("/") ? contextRoot : contextRoot + "/")); // set the redirection
} else {
filterChain.doFilter(request, response);
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/UIInitializerServlet.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/UIInitializerServlet.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/UIInitializerServlet.java Sun Aug 5 23:17:33 2007
@@ -158,7 +158,7 @@
}
}
- private class Axis2XMLInfo {
+ private static class Axis2XMLInfo {
private String servicePath;
private int httpsPort;
private int httpPort;
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/AbstractFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/AbstractFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/AbstractFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -49,8 +49,7 @@
public abstract class AbstractFileUploadExecutor implements FileUploadExecutor {
- protected static Log log =
- LogFactory.getLog(AbstractFileUploadExecutor.class);
+ protected static final Log log = LogFactory.getLog(AbstractFileUploadExecutor.class);
protected ConfigurationContext configurationContext;
@@ -58,6 +57,23 @@
this.configurationContext = configurationContext;
}
+ protected void checkServiceFileExtensionValidity(String fileExtension,
+ String[] allowedExtensions) throws Exception {
+ boolean isExtensionValid = false;
+ StringBuffer allowedExtensionsStr = new StringBuffer();
+ for (int i = 0; i < allowedExtensions.length; i++) {
+ allowedExtensionsStr.append(allowedExtensions[i]).append(",");
+ if (fileExtension.endsWith(allowedExtensions[i])) {
+ isExtensionValid = true;
+ break;
+ }
+ }
+ if (!isExtensionValid) {
+ throw new Exception(" Illegal file type." +
+ " Allowed file extensions are " + allowedExtensionsStr);
+ }
+ }
+
protected File uploadFile(HttpServletRequest request,
String repoDir,
HttpServletResponse response,
@@ -230,7 +246,7 @@
return false;
}
- String tmpDir = (String)configurationContext.getProperty(WSO2Constants.WORK_DIR);
+ String tmpDir = (String) configurationContext.getProperty(WSO2Constants.WORK_DIR);
String uuid = String.valueOf(System.currentTimeMillis() + Math.random());
tmpDir = tmpDir + File.separator + "artifacts" + File.separator + uuid + File.separator;
new File(tmpDir).mkdirs();
@@ -268,7 +284,7 @@
item.write(uploadedFile);
}
} else {
- File servicesDir = new File(tmpDir ,uploadDirName);
+ File servicesDir = new File(tmpDir, uploadDirName);
if (!servicesDir.exists()) {
servicesDir.mkdirs();
}
@@ -286,7 +302,7 @@
String parent = repo + File.separator + uploadDirName;
File mainDir = new File(tmpDir + File.separator + uploadDirName);
File libDir = new File(mainDir, "lib");
- File[] resourceLibFile = fm.getMatchingFiles(libDir.getAbsolutePath(),null,"jar");
+ File[] resourceLibFile = fm.getMatchingFiles(libDir.getAbsolutePath(), null, "jar");
for (int j = 0; j < resourceLibFile.length; j++) {
@@ -294,7 +310,7 @@
File src = resourceLibFile[j];
String[] files = libDir.list();
for (int i = 0; i < files.length; i++) {
- copyFile(src, new File(dst,files[i]) );
+ copyFile(src, new File(dst, files[i]));
}
}
@@ -316,7 +332,7 @@
out.write("<script language=\"javascript\">" +
"top.completeServiceFileUpload('Files have been uploaded " +
"successfully. This page will be auto refreshed shortly with " +
- "the status of the created "+ utilityString +" service ');" +
+ "the status of the created " + utilityString + " service ');" +
"</script>");
return true;
} catch (Exception e) {
@@ -334,7 +350,7 @@
String dstAbsPath = dst.getAbsolutePath();
String dstDir = dstAbsPath.substring(0, dstAbsPath.lastIndexOf(File.separator));
File dir = new File(dstDir);
- if(!dir.exists()){
+ if (!dir.exists()) {
dir.mkdirs();
}
DataHandler dh = new DataHandler(src.toURL());
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/EJBInterfaceFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/EJBInterfaceFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/EJBInterfaceFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -40,25 +40,22 @@
public class EJBInterfaceFileUploadExecutor extends AbstractFileUploadExecutor {
- private static final String[] ALLOWED_SERVICE_EXTENSIONS =
- new String[]{".jar",
- ".zip"};
+ private static final String[] ALLOWED_FILE_EXTENSIONS = new String[]{".jar", ".zip"};
public EJBInterfaceFileUploadExecutor(ConfigurationContext configurationContext) {
super(configurationContext);
}
-
public boolean execute(HttpServletRequest request,
HttpServletResponse response) throws ServerException, IOException {
PrintWriter out = response.getWriter();
- String axis2Repo = ServerConfiguration.getInstance().
+ String axis2Repo = ServerConfiguration.getInstance().
getFirstProperty(ServerConfiguration.AXIS2_CONFIG_REPO_LOCATION);
if (Utils.isURL(axis2Repo)) {
out.write("<script language=\"javascript\">" +
- "top.wso2.wsf.Util.alertWarning('You are not permitted to upload services to URL repository " +
- axis2Repo + "');" +
- "</script>");
+ "top.wso2.wsf.Util.alertWarning('You are not permitted to upload services to URL repository " +
+ axis2Repo + "');" +
+ "</script>");
out.flush();
return false;
}
@@ -80,56 +77,41 @@
fileExtension = fileExtension.toLowerCase();
// check whether extension is valid
- checkServiceFileExtensionValidity(fileExtension);
+ checkServiceFileExtensionValidity(fileExtension, ALLOWED_FILE_EXTENSIONS);
String fileNameOnly = getFileName(fileName);
File uploadedFile;
- if (fileExtension.endsWith(".aar")) {
-// String repo =
-// configurationContext.getAxisConfiguration().
-// getRepository().getPath();
-// File servicesDir = new File(repo, "services");
-// if (!servicesDir.exists()) {
-// servicesDir.mkdir();
-// }
-// uploadedFile = new File(servicesDir, fileNameOnly);
-// item.write(uploadedFile);
-// out.write("<script language=\"javascript\">" +
-// "top.completeServiceFileUpload();" +
-// "</script>");
- } else { // .jar or .zip file
- String uuid = String.valueOf(
- System.currentTimeMillis() + Math.random());
- String serviceUploadDir =
- configurationContext
- .getProperty(ServerConstants.WORK_DIR) +
- File.separator +
- "services" + File
- .separator +
- uuid + File.separator;
- File servicesDir = new File(serviceUploadDir);
- servicesDir.mkdirs();
- uploadedFile = new File(servicesDir, fileNameOnly);
-
- Map fileResourceMap =
- (Map) configurationContext.getProperty(
- ServerConstants.FILE_RESOURCE_MAP);
- if (fileResourceMap == null) {
- fileResourceMap = new TreeBidiMap();
- configurationContext.setProperty(
- ServerConstants.FILE_RESOURCE_MAP,
- fileResourceMap);
- }
- fileResourceMap
- .put(uuid, uploadedFile.getAbsolutePath());
- item.write(uploadedFile);
-
- // call the javascript which will in turn call the relevant web service
- out.write("<script language=\"javascript\">" +
- "top.getEJBRemoteInterfaceClassListFromArchive('" + uuid +
- "');" +
- "</script>");
+ String uuid = String.valueOf(
+ System.currentTimeMillis() + Math.random());
+ String serviceUploadDir =
+ configurationContext
+ .getProperty(ServerConstants.WORK_DIR) +
+ File.separator +
+ "services" + File
+ .separator +
+ uuid + File.separator;
+ File servicesDir = new File(serviceUploadDir);
+ servicesDir.mkdirs();
+ uploadedFile = new File(servicesDir, fileNameOnly);
+
+ Map fileResourceMap =
+ (Map) configurationContext.getProperty(
+ ServerConstants.FILE_RESOURCE_MAP);
+ if (fileResourceMap == null) {
+ fileResourceMap = new TreeBidiMap();
+ configurationContext.setProperty(
+ ServerConstants.FILE_RESOURCE_MAP,
+ fileResourceMap);
}
+ fileResourceMap
+ .put(uuid, uploadedFile.getAbsolutePath());
+ item.write(uploadedFile);
+
+ // call the javascript which will in turn call the relevant web service
+ out.write("<script language=\"javascript\">" +
+ "top.getEJBRemoteInterfaceClassListFromArchive('" + uuid +
+ "');" +
+ "</script>");
}
}
return true;
@@ -137,30 +119,10 @@
log.error("File upload failed", e);
out.write("<script language=\"javascript\">" +
"top.wso2.wsf.Util.alertWarning('EJB remote and home interface upload FAILED. " +
- "Reason : "+e.getMessage() + "');" +
+ "Reason : " + e.getMessage() + "');" +
"</script>");
}
}
return false;
-
- }
-
- private void checkServiceFileExtensionValidity(String fileExtension)
- throws Exception {
- boolean isExtensionValid = false;
- String allowedExtensions = "";
- for (int i = 0; i < ALLOWED_SERVICE_EXTENSIONS.length; i++) {
- allowedExtensions += ALLOWED_SERVICE_EXTENSIONS[i] + ",";
- if (fileExtension.endsWith(ALLOWED_SERVICE_EXTENSIONS[i])) {
- isExtensionValid = true;
- break;
- }
- }
- if (!isExtensionValid) {
- throw new Exception(" Illegal file type." +
- " Allowed file extensions are " + allowedExtensions);
- }
}
-
-
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ModuleFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ModuleFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ModuleFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -46,9 +46,9 @@
PrintWriter out = response.getWriter();
if (Utils.isURL(axis2Repo)) {
out.write("<script language=\"javascript\">" +
- "top.wso2.wsf.Util.alertWarning('You are not permitted to upload modules to URL repository " +
- axis2Repo + "');" +
- "</script>");
+ "top.wso2.wsf.Util.alertWarning('You are not permitted to upload modules to URL repository " +
+ axis2Repo + "');" +
+ "</script>");
out.flush();
return false;
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/POJOFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/POJOFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/POJOFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -31,9 +31,12 @@
super(configurationContext);
}
- public boolean execute(HttpServletRequest request, HttpServletResponse response)
- throws ServerException, IOException {
- return uploadArtifacts(request, response, "pojoservices", new String[]{"jar", "class"},
+ public boolean execute(HttpServletRequest request,
+ HttpServletResponse response) throws ServerException, IOException {
+ return uploadArtifacts(request,
+ response,
+ "pojoservices",
+ new String[]{"jar", "class"},
"Axis2");
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ServiceFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ServiceFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/ServiceFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -40,7 +40,7 @@
public class ServiceFileUploadExecutor extends AbstractFileUploadExecutor {
- private static final String[] ALLOWED_SERVICE_EXTENSIONS =
+ private static final String[] ALLOWED_FILE_EXTENSIONS =
new String[]{".aar", ".jar", ".zip", ".dbs"};
public ServiceFileUploadExecutor(ConfigurationContext configurationContext) {
@@ -79,7 +79,7 @@
fileExtension = fileExtension.toLowerCase();
// check whether extension is valid
- checkServiceFileExtensionValidity(fileExtension);
+ checkServiceFileExtensionValidity(fileExtension, ALLOWED_FILE_EXTENSIONS);
String fileNameOnly = getFileName(fileName);
File uploadedFile;
@@ -91,11 +91,11 @@
String finalFolderName;
if (fileExtension.endsWith(".aar")) {
finalFolderName = "services";
- } else if (fileExtension.endsWith(".dbs")) {
+ } else if (fileExtension.endsWith(".dbs")) {
finalFolderName = "dataservices";
} else {
throw new ServerException(
- "File with extension " + fileExtension + " does not support");
+ "File with extension " + fileExtension + " is not supported!");
}
File servicesDir = new File(repo, finalFolderName);
@@ -154,23 +154,4 @@
return false;
}
-
- private void checkServiceFileExtensionValidity(String fileExtension)
- throws Exception {
- boolean isExtensionValid = false;
- String allowedExtensions = "";
- for (int i = 0; i < ALLOWED_SERVICE_EXTENSIONS.length; i++) {
- allowedExtensions += ALLOWED_SERVICE_EXTENSIONS[i] + ",";
- if (fileExtension.endsWith(ALLOWED_SERVICE_EXTENSIONS[i])) {
- isExtensionValid = true;
- break;
- }
- }
- if (!isExtensionValid) {
- throw new Exception(" Illegal Service file type." +
- " Allowed file extensions are " + allowedExtensions);
- }
- }
-
-
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/WSDDFileUploadExecutor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/WSDDFileUploadExecutor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/fileupload/WSDDFileUploadExecutor.java Sun Aug 5 23:17:33 2007
@@ -32,8 +32,8 @@
super(configurationContext);
}
- public boolean execute(HttpServletRequest request, HttpServletResponse response)
- throws ServerException, IOException {
+ public boolean execute(HttpServletRequest request,
+ HttpServletResponse response) throws ServerException, IOException {
return uploadArtifacts(request, response, "axis1services", new String[]{"wsdd"}, "Axis1");
}
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpTransportListener.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpTransportListener.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpTransportListener.java Sun Aug 5 23:17:33 2007
@@ -50,7 +50,8 @@
this.configurationContext = configContext;
Parameter portParam = transportIn.getParameter("port");
if (portParam != null) {
- ServerManager.httpPort = Integer.parseInt(portParam.getValue().toString().trim());
+ ServerManager.getInstance().
+ setHttpPort(Integer.parseInt(portParam.getValue().toString().trim()));
}
}
@@ -69,7 +70,7 @@
throw new AxisFault(GenericHttpsTransportListener.class.getName() +
" Service Context path cannot be null");
}
- return new EndpointReference("http://" + ip + ":" + ServerManager.httpPort +
+ return new EndpointReference("http://" + ip + ":" + ServerManager.getInstance().getHttpPort() +
serviceContextPath + "/" + serviceName);
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpsTransportListener.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpsTransportListener.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/GenericHttpsTransportListener.java Sun Aug 5 23:17:33 2007
@@ -49,7 +49,8 @@
this.configurationContext = configContext;
Parameter portParam = transportIn.getParameter("port");
if (portParam != null) {
- ServerManager.httpsPort = Integer.parseInt(portParam.getValue().toString().trim());
+ ServerManager.getInstance().
+ setHttpsPort(Integer.parseInt(portParam.getValue().toString().trim()));
}
}
@@ -68,7 +69,8 @@
throw new AxisFault(org.wso2.utils.transport.http.GenericHttpsTransportListener.class.getName() +
" Service Context path cannot be null");
}
- return new EndpointReference("https://" + ip + ":" + ServerManager.httpsPort +
+ return new EndpointReference("https://" + ip + ":" +
+ ServerManager.getInstance().getHttpsPort() +
serviceContextPath + "/" + serviceName);
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java Sun Aug 5 23:17:33 2007
@@ -57,7 +57,7 @@
}
public void start() throws AxisFault {
- ServerManager.httpsPort = port;
+ ServerManager.getInstance().setHttpsPort(port);
/*
This method processes the following block in the axis2.xml
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/PolicyProcessor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/PolicyProcessor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/PolicyProcessor.java Sun Aug 5 23:17:33 2007
@@ -135,7 +135,7 @@
outputStream.write("<h4>Policy not found!</h4>".getBytes());
} else {
String ipAddress = "http://" + NetworkUtils.getLocalHostname() + ":" +
- ServerManager.httpPort;
+ ServerManager.getInstance().getHttpPort();
ServerConfiguration serverCofig = ServerConfiguration.getInstance();
outputStream.write(("<html><head>" +
"<title>WSO2 Web Services Application Server v" +
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java Sun Aug 5 23:17:33 2007
@@ -35,15 +35,16 @@
* This can be delegated to another Class as well
* where it will handle more options of GET messages.
*
- * @return Returns String.
+ * @param configContext The ConfigurationContext
+ * @return The services list as an HTML string
*/
public static String getServicesHTML(ConfigurationContext configContext) {
- String temp = "";
+ StringBuffer temp = new StringBuffer();
Iterator serviceGroupsItr = configContext.getAxisConfiguration().getServiceGroups();
boolean status = false;
if (serviceGroupsItr.hasNext()) {
status = true;
- temp += "<h2>" + "Deployed services" + "</h2>";
+ temp.append("<h2>" + "Deployed services" + "</h2>");
while (serviceGroupsItr.hasNext()) {
AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroupsItr.next();
if (!ServerConstants.ADMIN_SERVICE_GROUP.equals(axisServiceGroup.getServiceGroupName())) {
@@ -51,8 +52,8 @@
for (Iterator serviceItr = axisServiceGroup.getServices();
serviceItr.hasNext();) {
AxisService axisService = (AxisService) serviceItr.next();
- temp += "<h3><a href=\"" + axisService.getName() + "?info\">" +
- axisService.getName() + "</a></h3>";
+ temp.append("<h3><a href=\"").append(axisService.getName()).append("?info\">").
+ append(axisService.getName()).append("</a></h3>");
}
}
}
@@ -61,66 +62,63 @@
configContext.getAxisConfiguration().getFaultyServices();
if ((erroneousServices != null) && !erroneousServices.isEmpty()) {
- temp += "<hr><h2><font color=\"blue\">Faulty Services</font></h2>";
+ temp.append("<hr><h2><font color=\"blue\">Faulty Services</font></h2>");
status = true;
Enumeration faultyservices = erroneousServices.keys();
while (faultyservices.hasMoreElements()) {
String faultyserviceName = (String) faultyservices.nextElement();
- temp += "<h3><font color=\"blue\">" + faultyserviceName + "</font></h3>";
+ temp.append("<h3><font color=\"blue\">").append(faultyserviceName).
+ append("</font></h3>");
}
}
if (!status) {
- temp = "<h2>There are no services deployed</h2>";
+ temp.append("<h2>There are no services deployed</h2>");
}
- temp = "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+ return "<html><head><title>Axis2: Services</title></head>" + "<body>" + temp
+ "</body></html>";
-
- return temp;
}
public static String printServiceHTML(String serviceName,
ConfigurationContext configurationContext) {
- String temp = "";
+ StringBuffer temp = new StringBuffer();
try {
AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
AxisService axisService = axisConfig.getService(serviceName);
if (axisService != null) {
if (!axisService.isActive()) {
- temp += "<b>Service " + serviceName +
- " is inactive. Cannot display service information.</b>";
+ temp.append("<b>Service ").append(serviceName).
+ append(" is inactive. Cannot display service information.</b>");
} else {
- temp += "<h3>" + axisService.getName() + "</h3>";
- temp += "<a href=\"" + axisService.getName() + "?wsdl\">wsdl</a> : ";
- temp += "<a href=\"" + axisService.getName() + "?xsd\">schema</a> : ";
- temp += "<a href=\"" + axisService.getName() + "?policy\">policy</a><br/>";
- temp += "<i>Service Description : " +
- axisService.getDocumentation() + "</i><br/><br/>";
- Iterator pubOpIter = axisService.getPublishedOperations().iterator();
- if (pubOpIter.hasNext()) {
- temp += "Published operations <ul>";
+ temp.append("<h3>").append(axisService.getName()).append("</h3>");
+ temp.append("<a href=\"").append(axisService.getName()).append("?wsdl\">wsdl</a> : ");
+ temp.append("<a href=\"").append(axisService.getName()).append("?xsd\">schema</a> : ");
+ temp.append("<a href=\"").append(axisService.getName()).append("?policy\">policy</a><br/>");
+ temp.append("<i>Service Description : ").
+ append(axisService.getDocumentation()).append("</i><br/><br/>");
+
+ for (Iterator pubOpIter = axisService.getPublishedOperations().iterator();
+ pubOpIter.hasNext();) {
+ temp.append("Published operations <ul>");
for (; pubOpIter.hasNext();) {
AxisOperation axisOperation = (AxisOperation) pubOpIter.next();
- temp += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
+ temp.append("<li>").
+ append(axisOperation.getName().getLocalPart()).append("</li>");
}
- temp += "</ul>";
- } else {
- temp += "No operations specified for this service";
+ temp.append("</ul>");
}
}
} else {
- temp += "<b>Service " + serviceName +
- " not found. Cannot display service information.</b>";
+ temp.append("<b>Service ").append(serviceName).
+ append(" not found. Cannot display service information.</b>");
}
- temp = "<html><head><title>Service Information</title></head>" + "<body>" + temp
+ return "<html><head><title>Service Information</title></head>" + "<body>" + temp
+ "</body></html>";
}
catch (AxisFault axisFault) {
- temp = "<html><head><title>Service has a fualt</title></head>" + "<body>"
+ return "<html><head><title>Error Occurred</title></head>" + "<body>"
+ "<hr><h2><font color=\"blue\">" + axisFault.getMessage() + "</font></h2></body></html>";
}
- return temp;
}
-
}
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/XsdProcessor.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/XsdProcessor.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/transport/util/XsdProcesso