Search in sources :

Example 1 with AxisEvent

use of org.apache.axis2.engine.AxisEvent in project wso2-synapse by wso2.

the class ThrottleObserver method serviceUpdate.

public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {
    log.debug("ThrottleObserver notified for a serviceUpdate.");
    AxisDescription axisDescription = axisEvent.getAxisDescription();
    if (axisDescription.isEngaged(axisService.getAxisConfiguration().getModule(ThrottleConstants.THROTTLE_MODULE_NAME))) {
        if (axisEvent.getEventType() == AxisEvent.POLICY_ADDED) {
            try {
                ThrottleEnguageUtils.enguage(axisDescription, configctx, defautThrottle);
            } catch (AxisFault axisFault) {
                log.error("Error while re-engaging throttling", axisFault);
            }
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisDescription(org.apache.axis2.description.AxisDescription)

Example 2 with AxisEvent

use of org.apache.axis2.engine.AxisEvent in project wso2-synapse by wso2.

the class ProxyService method start.

/**
 * Start the proxy service
 * @param synCfg the synapse configuration
 */
public void start(SynapseConfiguration synCfg) {
    AxisConfiguration axisConfig = synCfg.getAxisConfiguration();
    if (axisConfig != null) {
        Parameter param = axisConfig.getParameter(SynapseConstants.SYNAPSE_ENV);
        if (param != null && param.getValue() instanceof SynapseEnvironment) {
            SynapseEnvironment env = (SynapseEnvironment) param.getValue();
            if (targetInLineInSequence != null) {
                targetInLineInSequence.init(env);
            }
            if (targetInLineOutSequence != null) {
                targetInLineOutSequence.init(env);
            }
            if (targetInLineFaultSequence != null) {
                targetInLineFaultSequence.init(env);
            }
        } else {
            auditWarn("Unable to find the SynapseEnvironment. " + "Components of the proxy service may not be initialized");
        }
        AxisService as = axisConfig.getServiceForActivation(this.getName());
        as.setActive(true);
        axisConfig.notifyObservers(new AxisEvent(AxisEvent.SERVICE_START, as), as);
        this.setRunning(true);
        auditInfo("Started the proxy service : " + name);
    } else {
        auditWarn("Unable to start proxy service : " + name + ". Couldn't access Axis configuration");
    }
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) AxisEvent(org.apache.axis2.engine.AxisEvent) SynapseEnvironment(org.apache.synapse.core.SynapseEnvironment)

Example 3 with AxisEvent

use of org.apache.axis2.engine.AxisEvent in project wso2-synapse by wso2.

the class ProxyService method stop.

/**
 * Stop the proxy service
 * @param synCfg the synapse configuration
 */
public void stop(SynapseConfiguration synCfg) {
    AxisConfiguration axisConfig = synCfg.getAxisConfiguration();
    if (axisConfig != null) {
        AxisService as = axisConfig.getServiceForActivation(this.getName());
        // If an active AxisService is found
        if (as != null) {
            if (as.isActive()) {
                as.setActive(false);
            }
            axisConfig.notifyObservers(new AxisEvent(AxisEvent.SERVICE_STOP, as), as);
        }
        this.setRunning(false);
        auditInfo("Stopped the proxy service : " + name);
    } else {
        auditWarn("Unable to stop proxy service : " + name + ". Couldn't access Axis configuration");
    }
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) AxisEvent(org.apache.axis2.engine.AxisEvent)

Aggregations

AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)2 AxisEvent (org.apache.axis2.engine.AxisEvent)2 AxisFault (org.apache.axis2.AxisFault)1 AxisDescription (org.apache.axis2.description.AxisDescription)1 SynapseEnvironment (org.apache.synapse.core.SynapseEnvironment)1