Java Code Examples for org.apache.axis2.engine.AxisEvent#SERVICE_DEPLOY

The following examples show how to use org.apache.axis2.engine.AxisEvent#SERVICE_DEPLOY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TenantSTSObserver.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public void serviceUpdate(AxisEvent axisEvent, AxisService service) {
    int eventType = axisEvent.getEventType();
    if (eventType == AxisEvent.SERVICE_DEPLOY) {
        try {
            if (ServerConstants.STS_NAME.equals(service.getName())) {
                if (log.isDebugEnabled()) {
                    log.debug("Configuring the STS service for tenant: " +
                              PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain() +
                              "[" + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId() + "]");
                }
                STSConfigAdmin.configureGenericSTS(service.getAxisConfiguration());
            }
        } catch (IdentityProviderException e) {
            log.error("Failed to configure STS service for tenant: " +
                      PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId() +
                      " - " + PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(), e);
        }
    }
}
 
Example 2
Source File: STSObserver.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
public void serviceUpdate(AxisEvent axisEvent, AxisService service) {
    int eventType = axisEvent.getEventType();
    if (eventType == AxisEvent.SERVICE_DEPLOY) {
        try {
            STSConfigAdmin.configureService(service.getName());
            if (ServerConstants.STS_NAME.equals(service.getName())) {
                STSConfigAdmin.configureGenericSTS();
            }
        } catch (IdentityProviderException e) {
            log.error(e);
        }
    }

}
 
Example 3
Source File: STSDeploymentInterceptor.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void serviceUpdate(AxisEvent event, AxisService service) {
    if (event.getEventType() == AxisEvent.SERVICE_DEPLOY
        && ServerConstants.STS_NAME.equals(service.getName())) {
        try {
            updateSTSService(service.getAxisConfiguration());
        } catch (Exception e) {
            log.error("Error while updating " + ServerConstants.STS_NAME
                      + " in STSDeploymentInterceptor", e);
        }
    }
}
 
Example 4
Source File: IWADeploymentInterceptor.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void serviceUpdate(AxisEvent event, AxisService service) {
    if (event.getEventType() == AxisEvent.SERVICE_DEPLOY
            && IWA_SERVICE_NAME.equals(service.getName())) {
        try {
            populateRampartConfig(service.getAxisConfiguration());
        } catch (Exception e) {
            log.error("Error while updating " + IWA_SERVICE_NAME
                    + " in IWADeploymentInterceptor", e);
            throw new RuntimeException(e);
        }
    }
}
 
Example 5
Source File: SystemStatisticsDeploymentInterceptor.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public void serviceUpdate(AxisEvent axisEvent, AxisService axisService) {

        if (SystemFilter.isFilteredOutService(axisService.getAxisServiceGroup()) || axisService.isClientSide()) {
            return;
        }
        if (axisEvent.getEventType() == AxisEvent.SERVICE_DEPLOY) {
            for (Iterator iter = axisService.getOperations(); iter.hasNext(); ) {
                AxisOperation op = (AxisOperation) iter.next();
                setCountersAndProcessors(op);
            }
            // see ESBJAVA-2327
            if (JavaUtils.isTrueExplicitly(axisService.getParameterValue("disableOperationValidation"))) {
                AxisOperation defaultOp = (AxisOperation) axisService.getParameterValue("_default_mediate_operation_");
                if (defaultOp != null) {
                    setCountersAndProcessors(defaultOp);
                }
            }
            // Service response time processor
            Parameter responseTimeProcessor = new Parameter();
            responseTimeProcessor.setName(StatisticsConstants.SERVICE_RESPONSE_TIME_PROCESSOR);
            responseTimeProcessor.setValue(new ResponseTimeProcessor());
            try {
                axisService.addParameter(responseTimeProcessor);
            } catch (AxisFault axisFault) {
                // will not occur
            }
        }
    }
 
Example 6
Source File: TargetServiceObserver.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public void serviceUpdate(AxisEvent event, AxisService service) {
    int eventType = event.getEventType();
    if (eventType == AxisEvent.SERVICE_START ||
            eventType == AxisEvent.SERVICE_DEPLOY ||
            eventType == CarbonConstants.AxisEvent.TRANSPORT_BINDING_ADDED ||
            eventType == CarbonConstants.AxisEvent.TRANSPORT_BINDING_REMOVED) {

        // send the hello message
        sendHello(service);

    } else if ((event.getEventType() == AxisEvent.SERVICE_STOP) ||
                    (event.getEventType() == AxisEvent.SERVICE_REMOVE)){
        // send the bye message
        MessageSender messageSender = new MessageSender();
        Parameter discoveryProxyParam =
                this.axisConfiguration.getParameter(DiscoveryConstants.DISCOVERY_PROXY);

        if (discoveryProxyParam != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending WS-Discovery Bye message for the " +
                        "service " + service.getName());
            }

            try {
                messageSender.sendBye(service, (String) discoveryProxyParam.getValue());
            } catch (DiscoveryException e) {
                log.error("Cannot send the bye message ", e);
            }
        }
    }
}