use of org.apache.axis2.description.AxisService in project wso2-axis2-transports by wso2.
the class AbstractTransportListener method init.
/**
* Initialize the generic transport. Sets up the transport and the thread pool to be used
* for message processing. Also creates an AxisObserver that gets notified of service
* life cycle events for the transport to act on
* @param cfgCtx the axis configuration context
* @param transportIn the transport-in description
* @throws AxisFault on error
*/
public void init(ConfigurationContext cfgCtx, TransportInDescription transportIn) throws AxisFault {
this.cfgCtx = cfgCtx;
this.transportIn = transportIn;
this.transportOut = cfgCtx.getAxisConfiguration().getTransportOut(getTransportName());
this.config = TransportConfiguration.getConfiguration(getTransportName());
if (useAxis2ThreadPool) {
// this.workerPool = cfgCtx.getThreadPool(); not yet implemented
throw new AxisFault("Unsupported thread pool for task execution - Axis2 thread pool");
} else {
if (this.workerPool == null) {
// FIXME <-- workaround for AXIS2-4552
this.workerPool = WorkerPoolFactory.getWorkerPool(config.getServerCoreThreads(), config.getServerMaxThreads(), config.getServerKeepalive(), config.getServerQueueLen(), getTransportName() + "Server Worker thread group", getTransportName() + "-Worker");
}
}
// register to receive updates on services for lifetime management
serviceTracker = new AxisServiceTracker(cfgCtx.getAxisConfiguration(), new AxisServiceFilter() {
public boolean matches(AxisService service) {
return // these are "private" services
!service.getName().startsWith("__") && BaseUtils.isUsingTransport(service, getTransportName());
}
}, new AxisServiceTrackerListener() {
public void serviceAdded(AxisService service) {
internalStartListeningForService(service);
}
public void serviceRemoved(AxisService service) {
internalStopListeningForService(service);
}
});
// register with JMX
if (mbeanSupport == null) {
// FIXME <-- workaround for AXIS2-4552
mbeanSupport = new TransportMBeanSupport(this, getTransportName());
mbeanSupport.register();
}
}
use of org.apache.axis2.description.AxisService in project wso2-axis2-transports by wso2.
the class AxisServiceTracker method stop.
/**
* Stop the tracker.
*
* @throws IllegalStateException if the tracker is not started
*/
public void stop() {
if (services == null) {
throw new IllegalStateException();
}
config.removeObserver(observer);
for (AxisService service : services) {
listener.serviceRemoved(service);
}
services = null;
}
use of org.apache.axis2.description.AxisService in project wso2-axis2-transports by wso2.
the class AxisServiceTracker method start.
/**
* Start the tracker.
*
* @throws IllegalStateException if the tracker has already been started
*/
public void start() {
if (services != null) {
throw new IllegalStateException();
}
synchronized (lock) {
pendingActions = new LinkedList<Runnable>();
config.addObservers(observer);
services = new HashSet<AxisService>();
}
for (AxisService service : config.getServices().values()) {
if (service.isActive() && filter.matches(service)) {
serviceAdded(service);
}
}
while (true) {
Runnable action;
synchronized (lock) {
action = pendingActions.poll();
if (action == null) {
pendingActions = null;
break;
}
}
action.run();
}
}
use of org.apache.axis2.description.AxisService in project MassBank-web by MassBank.
the class AdminActions method doEngageToOperation.
@Action(name = "doEngageToOperation", post = true)
public Redirect doEngageToOperation(HttpServletRequest request) {
String moduleName = request.getParameter("module");
String serviceName = request.getParameter("service");
String operationName = request.getParameter("axisOperation");
Redirect redirect = new Redirect(ENGAGE_TO_OPERATION).withParameter("axisService", serviceName);
try {
AxisOperation od = configContext.getAxisConfiguration().getService(serviceName).getOperation(new QName(operationName));
od.engageModule(configContext.getAxisConfiguration().getModule(moduleName));
redirect.withStatus(true, moduleName + " module engaged to the operation successfully");
} catch (AxisFault axisFault) {
redirect.withStatus(false, axisFault.getMessage());
}
return redirect;
}
use of org.apache.axis2.description.AxisService in project MassBank-web by MassBank.
the class AdminActions method processdisengageModule.
@Action(name = "disengageModule", post = true)
public Redirect processdisengageModule(HttpServletRequest req) throws AxisFault {
String type = req.getParameter("type");
String serviceName = req.getParameter("serviceName");
String moduleName = req.getParameter("module");
AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
AxisService service = axisConfiguration.getService(serviceName);
AxisModule module = axisConfiguration.getModule(moduleName);
if (type.equals("operation")) {
if (service.isEngaged(module.getName()) || axisConfiguration.isEngaged(module.getName())) {
return new Redirect(LIST_SERVICES).withStatus(false, "Can not disengage module " + moduleName + ". This module is engaged at a higher level.");
} else {
String opName = req.getParameter("operation");
AxisOperation op = service.getOperation(new QName(opName));
op.disengageModule(module);
return new Redirect(LIST_SERVICES).withStatus(true, "Module " + moduleName + " was disengaged from " + "operation " + opName + " in service " + serviceName + ".");
}
} else {
if (axisConfiguration.isEngaged(module.getName())) {
return new Redirect(LIST_SERVICES).withStatus(false, "Can not disengage module " + moduleName + ". " + "This module is engaged at a higher level.");
} else {
service.disengageModule(axisConfiguration.getModule(moduleName));
return new Redirect(LIST_SERVICES).withStatus(true, "Module " + moduleName + " was disengaged from" + " service " + serviceName + ".");
}
}
}
Aggregations