[wsas-java-dev] svn commit r3489 - in trunk/wsas/java/modules:
admin/src/org/wso2/wsas/admin/service core/src/org/wso2/wsas
servlet-edition/conf standalone-edition/conf
standalone-edition/src/org/wso2/wsas
standalone-edition/test-resources
svn at wso2.org
svn at wso2.org
Mon Jun 4 04:21:55 PDT 2007
Author: azeez
Date: Mon Jun 4 04:21:18 2007
New Revision: 3489
Modified:
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerInitializer.java
trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerManager.java
trunk/wsas/java/modules/servlet-edition/conf/server.xml
trunk/wsas/java/modules/standalone-edition/conf/server.xml
trunk/wsas/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java
trunk/wsas/java/modules/standalone-edition/test-resources/server.xml
Log:
Simplifying server initializer code
Some changes for handling modules with same name
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 Mon Jun 4 04:21:18 2007
@@ -672,11 +672,29 @@
try {
axisService.engageModule(axisModule);
} catch (AxisFault e) {
- String msg = "System does not allow to engage module " + moduleId + moduleVersion;
+ String msg = "Cannot engage module " + moduleId +
+ (moduleVersion != null ? "-" + moduleVersion : "") +
+ ". You may be trying to engage an older version of an already engaged " +
+ "module. Please disengage the newer version of the module and retry. ";
log.warn(msg, e);
return msg;
}
+ ServiceDO serviceDO = pm.getService(serviceId, serviceVersion);
+ for (Iterator iter = serviceDO.getEngagedModules().iterator();
+ iter.hasNext();) {
+ ModuleDO oldModuleDO = (ModuleDO) iter.next();
+ if (oldModuleDO.getModuleIdentifierDO().getName().equals(moduleId)) {
+ serviceDO.getEngagedModules().remove(oldModuleDO);
+ try {
+ pm.updateService(serviceDO);
+ pm.updateModule(oldModuleDO);
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+ }
+
// persist the service-module engagement
pm.addEngagedServiceToModule(moduleId, moduleVersion,
pm.getService(serviceId,
Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerInitializer.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerInitializer.java (original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerInitializer.java Mon Jun 4 04:21:18 2007
@@ -15,8 +15,8 @@
*/
package org.wso2.wsas;
-import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
import org.wso2.utils.ServerException;
/*
*
@@ -25,12 +25,13 @@
public interface ServerInitializer {
/**
- * Intialize the Server logics
+ * Intialize the Server instance
+ *
* @param configurationContext
* @throws AxisFault
* @throws ServerException
*/
- public void init(ConfigurationContext configurationContext) throws AxisFault, ServerException ;
+ public void init(ConfigurationContext configurationContext) throws AxisFault, ServerException;
}
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 Mon Jun 4 04:21:18 2007
@@ -15,7 +15,6 @@
*/
package org.wso2.wsas;
-import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.clustering.ClusterManager;
import org.apache.axis2.context.ConfigurationContext;
@@ -29,9 +28,7 @@
import org.wso2.wsas.util.Monitor;
import org.wso2.wsas.util.Utils;
-import javax.xml.namespace.QName;
import java.net.SocketException;
-import java.util.Iterator;
/**
* The delegate used by WSAS standalone edition & servlet edition and contains the
@@ -144,53 +141,23 @@
}
private void startServerIntializer() throws ServerException {
- //TODO better pattern will be the builder
- OMElement documentEle = this.serverConfig.getDocumentElement();
- OMElement serverInitEle = documentEle.getFirstChildWithName(
- new QName(ServerConstants.WSO2WSAS_XML_NAMESPACE, "ServerInitializer"));
- if (serverInitEle == null) {
- String message =
- ServerManager.class.getName() +
- " mandatory element ServerInitializer can not be found";
- log.error(message);
- throw new ServerException(message);
- }
-
- for (Iterator iterator = serverInitEle.getChildrenWithName(
- new QName(ServerConstants.WSO2WSAS_XML_NAMESPACE, "Initialize"));
- iterator.hasNext();) {
- OMElement e = (OMElement) iterator.next();
-
- String clazzName = e.getText();
+ String[] initializers =
+ serverConfig.getProperties("ServerInitializer.Initializer");
+ for (int i = 0; i < initializers.length; i ++) {
+ String clazzName = initializers[i];
if (clazzName == null) {
String message = ServerManager.class.getName() + " intializer couldn't be found.";
log.error(message);
throw new ServerException(message);
}
-
try {
Class clazz = Class.forName(clazzName);
-
- ServerInitializer serverInitObj = (ServerInitializer) clazz.newInstance();
- log.info("Using ServerInitializer " + ServerInitializer.class.getName());
- serverInitObj.init(configContext);
-
- } catch (ClassNotFoundException e1) {
- log.error(e1);
- throw new ServerException(e1);
- } catch (IllegalAccessException e1) {
- log.error(e1);
- throw new ServerException(e1);
- } catch (InstantiationException e1) {
- log.error(e1);
- throw new ServerException(e1);
- } catch (AxisFault e1) {
- log.error(e1);
- throw new ServerException(e1);
+ ServerInitializer intializer = (ServerInitializer) clazz.newInstance();
+ intializer.init(configContext);
+ } catch (Exception e) {
+ throw new ServerException(e);
}
-
}
-
}
}
Modified: trunk/wsas/java/modules/servlet-edition/conf/server.xml
==============================================================================
--- trunk/wsas/java/modules/servlet-edition/conf/server.xml (original)
+++ trunk/wsas/java/modules/servlet-edition/conf/server.xml Mon Jun 4 04:21:18 2007
@@ -283,6 +283,6 @@
Use <Initialize/> elements to add new intializers.
-->
<ServerInitializer>
- <Initialize>org.wso2.wsas.DefaultServerInitializer</Initialize>
+ <Initializer>org.wso2.wsas.DefaultServerInitializer</Initializer>
</ServerInitializer>
</Server>
Modified: trunk/wsas/java/modules/standalone-edition/conf/server.xml
==============================================================================
--- trunk/wsas/java/modules/standalone-edition/conf/server.xml (original)
+++ trunk/wsas/java/modules/standalone-edition/conf/server.xml Mon Jun 4 04:21:18 2007
@@ -266,10 +266,10 @@
<!--
Server intializing code. DefaultServerInitializer will intialize the WSAS specific
Configurations. It should be the first. All other intializers should come after that.
- Use <Initialize/> elements to add new intializers.
+ Use <Initializer/> elements to add new intializers.
-->
<ServerInitializer>
- <Initialize>org.wso2.wsas.DefaultServerInitializer</Initialize>
+ <Initializer>org.wso2.wsas.DefaultServerInitializer</Initializer>
</ServerInitializer>
</Server>
Modified: trunk/wsas/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java
==============================================================================
--- trunk/wsas/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java (original)
+++ trunk/wsas/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java Mon Jun 4 04:21:18 2007
@@ -63,11 +63,6 @@
Host defaultHost = embedded.createHost(NetworkUtils.getLocalHostname(), webappsDir);
engine.addChild(defaultHost);
- /**
- * TODO doc base need to absolute. Otherwise it will create a massive mess in 5.5.15
- * TODO This has been fixed in 5.5.17 and prior.
- */
-
Context docsContext = embedded.createContext("/docs", new File(docsDir).getAbsolutePath());
defaultHost.addChild(docsContext);
Modified: trunk/wsas/java/modules/standalone-edition/test-resources/server.xml
==============================================================================
--- trunk/wsas/java/modules/standalone-edition/test-resources/server.xml (original)
+++ trunk/wsas/java/modules/standalone-edition/test-resources/server.xml Mon Jun 4 04:21:18 2007
@@ -187,6 +187,6 @@
Use <Initialize/> elements to add new intializers.
-->
<ServerInitializer>
- <Initialize>org.wso2.wsas.DefaultServerInitializer</Initialize>
+ <Initializer>org.wso2.wsas.DefaultServerInitializer</Initializer>
</ServerInitializer>
</Server>
\ No newline at end of file
More information about the Wsas-java-dev
mailing list