Search in sources :

Example 11 with AxisService

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();
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisServiceTracker(org.apache.axis2.transport.base.tracker.AxisServiceTracker) AxisServiceFilter(org.apache.axis2.transport.base.tracker.AxisServiceFilter) AxisServiceTrackerListener(org.apache.axis2.transport.base.tracker.AxisServiceTrackerListener)

Example 12 with AxisService

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;
}
Also used : AxisService(org.apache.axis2.description.AxisService)

Example 13 with AxisService

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();
    }
}
Also used : AxisService(org.apache.axis2.description.AxisService)

Example 14 with AxisService

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;
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisOperation(org.apache.axis2.description.AxisOperation) QName(javax.xml.namespace.QName)

Example 15 with AxisService

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 + ".");
        }
    }
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) AxisOperation(org.apache.axis2.description.AxisOperation) QName(javax.xml.namespace.QName) AxisService(org.apache.axis2.description.AxisService) AxisModule(org.apache.axis2.description.AxisModule)

Aggregations

AxisService (org.apache.axis2.description.AxisService)19 AxisFault (org.apache.axis2.AxisFault)11 AxisOperation (org.apache.axis2.description.AxisOperation)7 Parameter (org.apache.axis2.description.Parameter)6 EndpointReference (org.apache.axis2.addressing.EndpointReference)5 QName (javax.xml.namespace.QName)4 Map (java.util.Map)3 OMElement (org.apache.axiom.om.OMElement)3 MessageContext (org.apache.axis2.context.MessageContext)3 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)3 SocketException (java.net.SocketException)2 HashMap (java.util.HashMap)2 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)2 Options (org.apache.axis2.client.Options)2 ServiceClient (org.apache.axis2.client.ServiceClient)2 MultipleEntryHashMap (org.apache.axis2.util.MultipleEntryHashMap)2 InputStream (java.io.InputStream)1 PrintWriter (java.io.PrintWriter)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1