[wsas-java-dev] svn commit r9622 - in
branches/wsas/java/2.1/wsas/java/modules:
admin/src/org/wso2/wsas/admin/service
admin/src/org/wso2/wsas/admin/service/META-INF
admin/src/org/wso2/wsas/admin/service/util core/conf
core/src/org/wso2/wsas/deployment core/src/org/wso2/wsas/feed
core/src/org/wso2/wsas/transport/http
core/src/org/wso2/wsas/transport/util
core/src/org/wso2/wsas/util integration/test/org/wso2/admin
integration/test/org/wso2/admin/service
svn at wso2.org
svn at wso2.org
Fri Nov 9 02:43:35 PST 2007
Author: azeez
Date: Fri Nov 9 02:43:11 2007
New Revision: 9622
Added:
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/SystemFilter.java
- copied, changed from r9533, branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/AdminFilter.java
branches/wsas/java/2.1/wsas/java/modules/integration/test/org/wso2/admin/
branches/wsas/java/2.1/wsas/java/modules/integration/test/org/wso2/admin/service/
branches/wsas/java/2.1/wsas/java/modules/integration/test/org/wso2/admin/service/ServerAdminT.java
Removed:
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/AdminFilter.java
Modified:
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/META-INF/services.xml
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java
branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java
branches/wsas/java/2.1/wsas/java/modules/core/conf/server.xml
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedListener.java
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpTransportListener.java
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java
branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java
Log:
1. Imporvements to service & module filtering
2. Ability to disable transports
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/META-INF/services.xml
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/META-INF/services.xml (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/META-INF/services.xml Fri Nov 9 02:43:11 2007
@@ -18,7 +18,7 @@
<!--
Engage Admin module to all Admin Services
-->
- <module ref="wso2wsas-admin"/>
+ <!--<module ref="wso2wsas-admin"/>-->
<!-- Disabling MTOM for admin services. If MTOM is enabled globally
this will case an adverse effect on these services when calling
@@ -28,9 +28,9 @@
<service name="ServerAdmin" scope="transportsession">
<schema schemaNamespace="http://org.apache.axis2/xsd" elementFormDefaultQualified="false"/>
- <transports>
+ <!--<transports>
<transport>https</transport>
- </transports>
+ </transports>-->
<description>
This service will give server status.
</description>
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ModuleAdmin.java Fri Nov 9 02:43:11 2007
@@ -56,7 +56,7 @@
import org.wso2.wsas.persistence.exception.ModulePolicyNotFoundException;
import org.wso2.wsas.security.RahasUtil;
import org.wso2.wsas.security.ServerCrypto;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import org.wso2.wsas.util.ParameterUtil;
import org.wso2.wsas.util.PolicyUtil;
import org.wso2.wsas.util.WsasUtils;
@@ -104,7 +104,7 @@
moduleIter.hasNext();) {
AxisModule axisModule = (AxisModule) moduleIter.next();
- if (AdminFilter.isFilteredOutModule(axisModule.getName())) {
+ if (SystemFilter.isFilteredOutModule(axisModule.getName())) {
continue;
}
@@ -148,7 +148,7 @@
AxisModule axisModule = (AxisModule) engagedModules.next();
String name = axisModule.getName();
- if (!AdminFilter.isFilteredOutModule(name)) {
+ if (!SystemFilter.isFilteredOutModule(name)) {
emodules.add(new ModuleMetaData(name, axisModule.getVersion()));
}
}
@@ -173,7 +173,7 @@
AxisModule module = (AxisModule) engagedModulesIter.next();
if (!(getAxisConfig().isEngaged(module) || service.getParent().isEngaged(module))) {
- if (!AdminFilter.isFilteredOutModule(module.getName())) {
+ if (!SystemFilter.isFilteredOutModule(module.getName())) {
engageModules.add(new ModuleMetaData(module.getName(), module.getVersion()));
}
}
@@ -198,7 +198,7 @@
for (Iterator iterator = asg.getEngagedModules().iterator(); iterator.hasNext();) {
AxisModule axisModule = (AxisModule) iterator.next();
if (!getAxisConfig().isEngaged(axisModule)) {
- if (!AdminFilter.isFilteredOutModule(axisModule.getName())) {
+ if (!SystemFilter.isFilteredOutModule(axisModule.getName())) {
engagedModules.add(new ModuleMetaData(axisModule.getName(),
axisModule.getVersion()));
}
@@ -234,7 +234,7 @@
if (!(service.isEngaged(module) ||
service.getParent().isEngaged(module) ||
getAxisConfig().isEngaged(module))) {
- if (!AdminFilter.isFilteredOutModule(module.getName())) {
+ if (!SystemFilter.isFilteredOutModule(module.getName())) {
emodules.add(new ModuleMetaData(module.getName(), module.getVersion()));
}
}
@@ -378,6 +378,11 @@
if (statSG != null) {
statSG.disengageModule(axisModule);
}
+ AxisServiceGroup tracerSG =
+ axisConfig.getServiceGroup(ServerConstants.TRACER_SERVICE_GROUP);
+ if (tracerSG != null) {
+ tracerSG.disengageModule(axisModule);
+ }
}
}
@@ -1324,7 +1329,7 @@
if (!getAxisConfig().isEngaged(module) &&
service.getParent().isEngaged(module)) {
- if (!AdminFilter.isFilteredOutModule(module.getName())) {
+ if (!SystemFilter.isFilteredOutModule(module.getName())) {
emodules.add(new ModuleMetaData(module.getName(), module.getVersion()));
}
}
@@ -1364,7 +1369,7 @@
if (service.getParent().isEngaged(module) &&
!getAxisConfig().isEngaged(module)) {
- if (!AdminFilter.isFilteredOutModule(module.getName())) {
+ if (!SystemFilter.isFilteredOutModule(module.getName())) {
emodules.add(new ModuleMetaData(module.getName(), module.getVersion()));
}
}
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServerAdmin.java Fri Nov 9 02:43:11 2007
@@ -19,6 +19,9 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.TransportListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.utils.ServerException;
@@ -27,6 +30,9 @@
import org.wso2.wsas.admin.service.util.ServerStatus;
import org.wso2.wsas.util.Controllable;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
/**
* Admin service to manage server related operations
@@ -60,4 +66,23 @@
}
}
+ public String enterMaintenance() throws AxisFault {
+ AxisConfiguration axisConfig =
+ MessageContext.getCurrentMessageContext().getRootContext().getAxisConfiguration();
+ for (Iterator iter = axisConfig.getTransportsIn().values().iterator(); iter.hasNext();){
+ TransportInDescription tinDesc = (TransportInDescription) iter.next();
+ TransportListener transport = tinDesc.getReceiver();
+ try {
+ Method method = transport.getClass().getMethod("pause", new Class[0]);
+ if (method != null) {
+ method.invoke(transport, null);
+ }
+ } catch (Exception e) {
+ String msg = "Cannot invoke pause() on " + transport;
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
+ }
+ }
+ return "Entered maintenance mode";
+ }
}
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceGroupAdmin.java Fri Nov 9 02:43:11 2007
@@ -39,7 +39,7 @@
import org.wso2.wsas.persistence.dataobject.ServiceGroupParameterDO;
import org.wso2.wsas.persistence.dataobject.ServiceParameterDO;
import org.wso2.wsas.persistence.exception.DuplicateEntityException;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import org.wso2.wsas.util.ParameterUtil;
import org.wso2.wsas.util.PolicyUtil;
import org.wso2.wsas.util.WsasUtils;
@@ -231,7 +231,7 @@
AxisServiceGroup axisServiceGroup = (AxisServiceGroup) sgs.next();
String sgName = axisServiceGroup.getServiceGroupName();
- if (AdminFilter.isFilteredOutService(sgName)) {
+ if (SystemFilter.isFilteredOutService(sgName)) {
// No need to display Admin Service Groups
continue;
}
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServerStatus.java Fri Nov 9 02:43:11 2007
@@ -24,7 +24,7 @@
import org.wso2.utils.ServerConfiguration;
import org.wso2.wsas.ServerConstants;
import org.wso2.wsas.admin.service.StatisticsClient;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -94,7 +94,7 @@
AxisService axisService = (AxisService) services.next();
AxisServiceGroup asGroup = (AxisServiceGroup) axisService.getParent();
if (!axisService.isActive() || axisService.isClientSide() ||
- AdminFilter.isFilteredOutService(asGroup.getServiceGroupName())) {
+ SystemFilter.isFilteredOutService(asGroup.getServiceGroupName())) {
continue;
}
activeServices++;
Modified: branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/util/ServiceArchiveCreator.java Fri Nov 9 02:43:11 2007
@@ -50,16 +50,14 @@
import org.wso2.utils.WSO2Constants;
import org.wso2.ws.dataservice.DBConstants;
import org.wso2.wsas.ServerConstants;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import org.wso2.wsas.util.PolicyUtil;
import org.wso2.wsas.util.WsasUtils;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.FileFilter;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.util.ArrayList;
@@ -549,7 +547,7 @@
for (Iterator iterator = moduleCollection.iterator(); iterator.hasNext();) {
AxisModule axisModule = (AxisModule) iterator.next();
String moduleName = axisModule.getName();
- if (AdminFilter.isFilteredOutModule(moduleName) ||
+ if (SystemFilter.isFilteredOutModule(moduleName) ||
axisDesc.getParent().isEngaged(axisModule)) {
continue;
}
Modified: branches/wsas/java/2.1/wsas/java/modules/core/conf/server.xml
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/conf/server.xml (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/conf/server.xml Fri Nov 9 02:43:11 2007
@@ -306,15 +306,24 @@
</ServerInitializers>
<!--
- Admin services filterd from Admin service view if listered.
+ Services and modules which should be filtered out by WSAS.
+ These services & modules will not be persisted or shown in the WSAS console.
-->
- <AdminFilter>
- <ServiceGropus>
+ <SystemFilter>
+ <ServiceGroups>
<Name>archive-validator</Name>
<Name>wsdlconverter</Name>
<Name>wsdlview</Name>
- </ServiceGropus>
- </AdminFilter>
+ <Name>wso2wsas-administration</Name>
+ <Name>wso2codegen</Name>
+ <Name>TryItMockServiceGroup</Name>
+ </ServiceGroups>
+ <Modules>
+ <Name>wso2wsas-admin</Name>
+ <Name>wso2statistics</Name>
+ <Name>wso2tracer</Name>
+ </Modules>
+ </SystemFilter>
<!--List of EJB Application servers, used for EJB Provider configuration -->
<EJBApplicationServers>
@@ -343,48 +352,49 @@
<JNDIContextClass></JNDIContextClass>
</Server>
</EJBApplicationServers>
-
- <!-- JDBC URL/Driver list of popular database servers. Used for Data Services. -->
+
+ <!-- JDBC URL/Driver list of popular database servers. Used for Data Services. -->
<DatabaseServers>
- <Server>
- <Id>MySQL</Id>
- <JdbcURL>jdbc:mysql://[machine-name/ip]:[port]/[database-name]</JdbcURL>
- <DriverClass>com.mysql.jdbc.Driver</DriverClass>
- </Server>
- <Server>
- <Id>Apache Derby</Id>
- <JdbcURL>jdbc:derby:[path-to-data-file]</JdbcURL>
- <DriverClass>org.apache.derby.jdbc.EmbeddedDriver</DriverClass>
- </Server>
- <Server>
- <Id>Microsoft SQL Server</Id>
- <JdbcURL>jdbc:microsoft:sqlserver://[HOST]:[PORT][;DatabaseName=[DB]]</JdbcURL>
- <DriverClass>com.microsoft.jdbc.sqlserver.SQLServerDriver</DriverClass>
- </Server>
- <Server>
- <Id>Oracle</Id>
- <JdbcURL>jdbc:oracle:[drivertype]:[username/password]@[database]</JdbcURL>
- <DriverClass>oracle.jdbc.driver.OracleDriver</DriverClass>
- </Server>
- <Server>
- <Id>IBM DB2</Id>
- <JdbcURL>jdbc:db2:[database]</JdbcURL>
- <DriverClass>COM.ibm.db2.jdbc.app.DB2Driver</DriverClass>
- </Server>
- <Server>
- <Id>HSQLDB</Id>
- <JdbcURL>jdbc:hsqldb:[path]</JdbcURL>
- <DriverClass>org.hsqldb.jdbcDriver</DriverClass>
- </Server>
- <Server>
- <Id>Informix</Id>
- <JdbcURL>jdbc:informix-sqli://[HOST]:[PORT]/[database]:INFORMIXSERVER=[server-name]</JdbcURL>
- <DriverClass>COM.ibm.db2.jdbc.app.DB2Driver</DriverClass>
- </Server>
- <Server>
- <Id>Generic</Id>
- <JdbcURL>Generic</JdbcURL>
- <DriverClass>Generic</DriverClass>
- </Server>
- </DatabaseServers>
+ <Server>
+ <Id>MySQL</Id>
+ <JdbcURL>jdbc:mysql://[machine-name/ip]:[port]/[database-name]</JdbcURL>
+ <DriverClass>com.mysql.jdbc.Driver</DriverClass>
+ </Server>
+ <Server>
+ <Id>Apache Derby</Id>
+ <JdbcURL>jdbc:derby:[path-to-data-file]</JdbcURL>
+ <DriverClass>org.apache.derby.jdbc.EmbeddedDriver</DriverClass>
+ </Server>
+ <Server>
+ <Id>Microsoft SQL Server</Id>
+ <JdbcURL>jdbc:microsoft:sqlserver://[HOST]:[PORT][;DatabaseName=[DB]]</JdbcURL>
+ <DriverClass>com.microsoft.jdbc.sqlserver.SQLServerDriver</DriverClass>
+ </Server>
+ <Server>
+ <Id>Oracle</Id>
+ <JdbcURL>jdbc:oracle:[drivertype]:[username/password]@[database]</JdbcURL>
+ <DriverClass>oracle.jdbc.driver.OracleDriver</DriverClass>
+ </Server>
+ <Server>
+ <Id>IBM DB2</Id>
+ <JdbcURL>jdbc:db2:[database]</JdbcURL>
+ <DriverClass>COM.ibm.db2.jdbc.app.DB2Driver</DriverClass>
+ </Server>
+ <Server>
+ <Id>HSQLDB</Id>
+ <JdbcURL>jdbc:hsqldb:[path]</JdbcURL>
+ <DriverClass>org.hsqldb.jdbcDriver</DriverClass>
+ </Server>
+ <Server>
+ <Id>Informix</Id>
+ <JdbcURL>jdbc:informix-sqli://[HOST]:[PORT]/[database]:INFORMIXSERVER=[server-name]
+ </JdbcURL>
+ <DriverClass>COM.ibm.db2.jdbc.app.DB2Driver</DriverClass>
+ </Server>
+ <Server>
+ <Id>Generic</Id>
+ <JdbcURL>Generic</JdbcURL>
+ <DriverClass>Generic</DriverClass>
+ </Server>
+ </DatabaseServers>
</Server>
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/deployment/DeploymentInterceptor.java Fri Nov 9 02:43:11 2007
@@ -43,7 +43,7 @@
import org.wso2.wsas.persistence.exception.ServiceNotFoundException;
import org.wso2.wsas.security.ServerCrypto;
import org.wso2.wsas.security.util.RampartConfigUtil;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import org.wso2.wsas.util.WsasUtils;
import java.util.ArrayList;
@@ -73,7 +73,7 @@
public void serviceGroupUpdate(AxisEvent axisEvent, AxisServiceGroup axisServiceGroup) {
// We do not persist Admin service events
- if (AdminFilter.isFilteredOutService(axisServiceGroup.getServiceGroupName())) {
+ if (SystemFilter.isFilteredOutService(axisServiceGroup.getServiceGroupName())) {
return;
}
@@ -132,7 +132,7 @@
public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {
// We do not persist Admin service events
- if (AdminFilter.
+ if (SystemFilter.
isFilteredOutService(((AxisServiceGroup) axisService.getParent()).getServiceGroupName())) {
return;
}
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedListener.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedListener.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/feed/FeedListener.java Fri Nov 9 02:43:11 2007
@@ -24,7 +24,7 @@
import org.apache.axis2.engine.AxisObserver;
import org.wso2.wsas.feed.atom.AtomFeedBuilder;
import org.wso2.wsas.feed.rss.RSSFeedBuilder;
-import org.wso2.wsas.util.AdminFilter;
+import org.wso2.wsas.util.SystemFilter;
import java.util.ArrayList;
@@ -50,7 +50,7 @@
if (getParameter(FeedConstants.ITEM_URL_KEY) != null) {
itemHome = getParameter(FeedConstants.ITEM_URL_KEY).getValue().toString();
}
- if (AdminFilter.isFilteredOutService(axisServiceGroup.getServiceGroupName())) {
+ if (SystemFilter.isFilteredOutService(axisServiceGroup.getServiceGroupName())) {
return;
}
if (services.contains(service)) {
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpTransportListener.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpTransportListener.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpTransportListener.java Fri Nov 9 02:43:11 2007
@@ -21,6 +21,9 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Embedded;
+import org.apache.catalina.LifecycleException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.wso2.utils.NetworkUtils;
import org.wso2.utils.transport.AbstractTransportListener;
import org.wso2.utils.transport.ProxyCache;
@@ -36,6 +39,9 @@
*
*/
public class HttpTransportListener extends AbstractTransportListener {
+ private static Log log = LogFactory.getLog(HttpTransportListener.class);
+
+ private Connector httpConnector;
public EndpointReference getEPRForService(String serviceName,
String ip) throws AxisFault {
@@ -50,7 +56,7 @@
public void start() throws AxisFault {
try {
Embedded embedded = TomcatServerCache.getEmbedded();
- Connector httpConnector =
+ httpConnector =
embedded.createConnector((InetAddress) null, port, false);
httpConnector.setEnableLookups(true);
ArrayList parameters = tInDescription.getParameters();
@@ -67,4 +73,19 @@
throw AxisFault.makeFault(e);
}
}
+
+ public void pause() throws AxisFault {
+ System.err.println("######## pausing HTTP Transport");
+ try {
+ httpConnector.stop();
+ } catch (LifecycleException e) {
+ String msg = "Cannot stop Tomcat HTTP connector";
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
+ }
+ }
+
+ public void resume() throws AxisFault {
+ start();
+ }
}
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/http/HttpsTransportListener.java Fri Nov 9 02:43:11 2007
@@ -22,6 +22,7 @@
import org.apache.axis2.addressing.EndpointReference;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Embedded;
+import org.apache.catalina.LifecycleException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tomcat.util.IntrospectionUtils;
@@ -42,6 +43,8 @@
public class HttpsTransportListener extends AbstractTransportListener {
private static Log log = LogFactory.getLog(HttpsTransportListener.class);
+ private Connector sslConnector;
+
public EndpointReference getEPRForService(String serviceName,
String ip) throws AxisFault {
return getEPR(ServerConstants.HTTPS_TRANSPORT, serviceName, ip);
@@ -81,7 +84,7 @@
Embedded embedded = TomcatServerCache.getEmbedded();
// SSLConnector
- Connector sslConnector =
+ sslConnector =
embedded.createConnector((InetAddress) null, port, true);
sslConnector.setScheme(ServerConstants.HTTPS_TRANSPORT);
ArrayList parameters = tInDescription.getParameters();
@@ -121,8 +124,9 @@
}
ProxyCache.getInstance().setHttpsPort(proxyPort);
} catch (Exception e) {
- log.error("Exception occurred while starting the Tomcat SSL connector", e);
- throw AxisFault.makeFault(e);
+ String msg = "Exception occurred while starting the Tomcat SSL connector";
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
}
// Persist the SSL Key Store
@@ -144,4 +148,19 @@
}
}*/
}
+
+ public void pause() throws AxisFault{
+ System.err.println("######## pausing HTTPS Transport");
+ try {
+ sslConnector.stop();
+ } catch (LifecycleException e) {
+ String msg = "Cannot stop Tomcat SSL connector";
+ log.error(msg, e);
+ throw new AxisFault(msg, e);
+ }
+ }
+
+ public void resume() throws AxisFault{
+ start();
+ }
}
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/transport/util/ServiceHTMLProcessor.java Fri Nov 9 02:43:11 2007
@@ -22,7 +22,7 @@
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
import org.apache.axis2.engine.AxisConfiguration;
-import org.wso2.wsas.ServerConstants;
+import org.wso2.wsas.util.SystemFilter;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -47,7 +47,7 @@
temp.append("<h2>" + "Deployed services" + "</h2>");
while (serviceGroupsItr.hasNext()) {
AxisServiceGroup axisServiceGroup = (AxisServiceGroup) serviceGroupsItr.next();
- if (!ServerConstants.ADMIN_SERVICE_GROUP.equals(axisServiceGroup.getServiceGroupName())) {
+ if (!SystemFilter.isFilteredOutService(axisServiceGroup.getServiceGroupName())) {
status = true;
for (Iterator serviceItr = axisServiceGroup.getServices();
serviceItr.hasNext();) {
Copied: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/SystemFilter.java (from r9533, branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/AdminFilter.java)
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/AdminFilter.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/SystemFilter.java Fri Nov 9 02:43:11 2007
@@ -26,23 +26,21 @@
* This class will filter admin services and modules. WSAS specific services are hard
* coded and rest is plugable via services.xml.
*/
-public class AdminFilter {
+public class SystemFilter {
private static ServerConfiguration serverConfig = ServerConfiguration.getInstance();
public static boolean isFilteredOutService(String serviceGroupName) {
- boolean stat1 = ServerConstants.ADMIN_SERVICE_GROUP.equals(serviceGroupName) ||
- serviceGroupName.endsWith(ServerConstants.STATISTICS_SERVICE_GROUP) ||
- serviceGroupName.endsWith(ServerConstants.TRACER_SERVICE_GROUP) ||
- serviceGroupName.startsWith(ServerConstants.CODEGEN_SERVICE_GROUP);
- String[] strings = serverConfig.getProperties("AdminFilter.ServiceGropus.Name");
+ String[] strings = serverConfig.getProperties("SystemFilter.ServiceGroups.Name");
List list = Arrays.asList(strings);
- return stat1 || list.contains(serviceGroupName);
+ return list.contains(serviceGroupName) ||
+ serviceGroupName.endsWith(ServerConstants.TRACER_SERVICE_GROUP) ||
+ serviceGroupName.endsWith(ServerConstants.STATISTICS_SERVICE_GROUP);
}
public static boolean isFilteredOutModule(String moduleName) {
- return (moduleName.indexOf(ServerConstants.ADMIN_MODULE) == 0) ||
- (moduleName.indexOf(ServerConstants.STATISTICS_MODULE) == 0) ||
- (moduleName.indexOf(ServerConstants.TRACER_MODULE) == 0);
+ String[] strings = serverConfig.getProperties("SystemFilter.Modules.Name");
+ List list = Arrays.asList(strings);
+ return list.contains(moduleName);
}
}
Modified: branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java
==============================================================================
--- branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java (original)
+++ branches/wsas/java/2.1/wsas/java/modules/core/src/org/wso2/wsas/util/TraceFilterImpl.java Fri Nov 9 02:43:11 2007
@@ -39,7 +39,7 @@
}
String serviceGroupName =
((AxisServiceGroup) msgContext.getAxisService().getParent()).getServiceGroupName();
- if (AdminFilter.isFilteredOutService(serviceGroupName)) {
+ if (SystemFilter.isFilteredOutService(serviceGroupName)) {
return true;
}
Added: branches/wsas/java/2.1/wsas/java/modules/integration/test/org/wso2/admin/service/ServerAdminT.java
==============================================================================
--- (empty file)
+++ branches/wsas/java/2.1/wsas/java/modules/integration/test/org/wso2/admin/service/ServerAdminT.java Fri Nov 9 02:43:11 2007
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.wso2.admin.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AxisCallback;
+import org.apache.axis2.context.MessageContext;
+import org.wso2.wsas.AbstractTestCase;
+import org.wso2.wsas.ServerConstants;
+import org.wso2.wsas.TestConstants;
+import org.wso2.wsas.util.ServerUtils;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ */
+public class ServerAdminT extends AbstractTestCase {
+
+ protected void setUp() throws Exception {
+ System.setProperty(ServerConstants.DERBY_HOME, "conf");
+ System.setProperty(ServerConstants.WSO2WSAS_ADMIN_PASSWORD, "abc");
+ System.setProperty(ServerConstants.WSO2WSAS_HOME, "target/tomcat_test");
+ System.setProperty(ServerConstants.WSO2WSAS_SERVER_XML,
+ "target/tomcat_test/conf/server.xml");
+
+ ServerUtils serverUtils = new ServerUtils();
+ System.err.println("###### Gonna start server");
+ serverUtils.startServer();
+ System.err.println("####### Started server");
+ }
+
+ public void testSuspendConnector() throws Exception {
+ EndpointReference versionEPR =
+ new EndpointReference("http://127.0.0.1" + ":"
+ + (TestConstants.TESTING_PORT)
+ + "/" + ServerConstants.SERVICE_PATH +
+ "/version/getVersion");
+ EndpointReference serverAdminEPR =
+ new EndpointReference("http://127.0.0.1" + ":"
+ + (TestConstants.TESTING_PORT)
+ + "/" + ServerConstants.SERVICE_PATH +
+ "/ServerAdmin/enterMaintenance");
+
+ testConnect(versionEPR);
+ System.err.println("########## Connected");
+
+ removeProperties();
+
+ {
+ ServiceClient serviceAdminSender = new ServiceClient();
+ Options options = new Options();
+ options.setTo(serverAdminEPR);
+ options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ options.setUseSeparateListener(false);
+ serviceAdminSender.setOptions(options);
+ options.setAction("enterMaintenance");
+
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ QName requtestQName =
+ new QName("http://service.admin.wsas.wso2.org", "enterMaintenanceRequest");
+
+ OMNamespace ns =
+ fac.createOMNamespace(requtestQName.getNamespaceURI(), "ns");
+ OMElement omElement = serviceAdminSender.sendReceive(fac.createOMElement(requtestQName.getLocalPart(), ns));
+ System.out.println(omElement);
+ }
+
+
+ AxisCallback callback = new AxisCallback() {
+
+ public void onMessage(MessageContext messageContext) {
+ System.out.println("Response received");
+
+ }
+
+ public void onFault(MessageContext messageContext) {
+ System.out.println("Fault occurred");
+ }
+
+ public void onError(Exception e) {
+ System.out.println("Errro occurred " + e);
+ }
+
+ public void onComplete() {
+ System.out.println("Completed");
+ }
+ };
+ ServiceClient versionSender = new ServiceClient();
+ Options options = new Options();
+ options.setTo(versionEPR);
+ options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ options.setUseSeparateListener(false);
+ versionSender.setOptions(options);
+ options.setAction("getVersion");
+ versionSender.sendReceiveNonBlocking(getTestPayload(), callback);
+ }
+}
More information about the Wsas-java-dev
mailing list