Java Code Examples for org.apache.axis2.engine.AxisConfiguration#engageModule()
The following examples show how to use
org.apache.axis2.engine.AxisConfiguration#engageModule() .
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: ServiceComponent.java From micro-integrator with Apache License 2.0 | 6 votes |
private void engagePoxSecurity() { try { AxisConfiguration axisConfig = DataHolder.getInstance().getConfigCtx().getAxisConfiguration(); Parameter passwordCallbackParam = new Parameter(); DefaultPasswordCallback passwordCallbackClass = new DefaultPasswordCallback(); passwordCallbackParam.setName("passwordCallbackRef"); passwordCallbackParam.setValue(passwordCallbackClass); axisConfig.addParameter(passwordCallbackParam); String enablePoxSecurity = CarbonServerConfigurationService.getInstance() .getFirstProperty("EnablePoxSecurity"); if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) { AxisConfiguration mainAxisConfig = DataHolder.getInstance().getConfigCtx().getAxisConfiguration(); // Check for the module availability if (mainAxisConfig.getModules().toString().contains(POX_SECURITY_MODULE)){ mainAxisConfig.engageModule(POX_SECURITY_MODULE); log.debug("UT Security is activated"); } else { log.error("UT Security is not activated UTsecurity.mar is not available"); } } else { log.debug("POX Security Disabled"); } } catch (Throwable e) { log.error("Failed to activate Micro Integrator UT security module ", e); } }
Example 2
Source File: SecurityMgtServiceComponent.java From carbon-identity with Apache License 2.0 | 6 votes |
protected void activate(ComponentContext ctxt) { try { ConfigurationContext mainConfigCtx = configContextService.getServerConfigContext(); AxisConfiguration mainAxisConfig = mainConfigCtx.getAxisConfiguration(); BundleContext bundleCtx = ctxt.getBundleContext(); String enablePoxSecurity = ServerConfiguration.getInstance() .getFirstProperty("EnablePoxSecurity"); if (enablePoxSecurity == null || "true".equals(enablePoxSecurity)) { mainAxisConfig.engageModule(POX_SECURITY_MODULE); } else { log.info("POX Security Disabled"); } bundleCtx.registerService(SecurityConfigAdmin.class.getName(), new SecurityConfigAdmin(mainAxisConfig, registryService.getConfigSystemRegistry(), null), null); bundleCtx.registerService(Axis2ConfigurationContextObserver.class.getName(), new SecurityAxis2ConfigurationContextObserver(), null); log.debug("Security Mgt bundle is activated"); } catch (Throwable e) { log.error("Failed to activate SecurityMgtServiceComponent", e); } }
Example 3
Source File: StatisticsAxis2ConfigurationContextObserver.java From carbon-commons with Apache License 2.0 | 6 votes |
public void createdConfigurationContext(ConfigurationContext configurationContext) { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); try { if (axisConfig.getModule(StatisticsConstants.STATISTISTICS_MODULE_NAME) != null) { axisConfig.engageModule(StatisticsConstants.STATISTISTICS_MODULE_NAME); } } catch (Throwable e) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String msg; if (carbonContext.getTenantDomain() != null) { msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME + " module to tenant " + carbonContext.getTenantDomain() + "[" + carbonContext.getTenantId() + "]"; } else { msg = "Could not globally engage " + StatisticsConstants.STATISTISTICS_MODULE_NAME + " module to super tenant "; } log.error(msg, e); } }
Example 4
Source File: SecurityAxis2ConfigurationContextObserver.java From carbon-identity with Apache License 2.0 | 5 votes |
@Override public void createdConfigurationContext(ConfigurationContext configurationContext) { AxisConfiguration axisConfig = configurationContext.getAxisConfiguration(); AxisModule poxSecModule = axisConfig.getModule("POXSecurityModule"); if (poxSecModule != null) { try { axisConfig.engageModule(poxSecModule); } catch (AxisFault e) { log.error("Cannot globally engage POX Security module", e); } } }
Example 5
Source File: TracerAdmin.java From carbon-commons with Apache License 2.0 | 5 votes |
/** * @param flag; support ON or OFF. * @return The information about the Tracer service * @throws AxisFault If the tracer module is not found */ public TracerServiceInfo setMonitoring(String flag) throws AxisFault { if (!flag.equalsIgnoreCase("ON") && !flag.equalsIgnoreCase("OFF")) { throw new RuntimeException("IllegalArgument for monitoring status. Only 'ON' and 'OFF' is allowed"); } TracerServiceInfo tracerServiceInfo = new TracerServiceInfo(); ConfigurationContext configurationContext = getConfigContext(); AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration(); AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER); if (axisModule == null) { throw new RuntimeException(TracerAdmin.class.getName() + " " + TracerConstants.WSO2_TRACER + " is not available"); } if (flag.equalsIgnoreCase("ON")) { if (!axisConfiguration.isEngaged(axisModule.getName())) { try { axisConfiguration.engageModule(axisModule); } catch (AxisFault axisFault) { log.error(axisFault); throw new RuntimeException(axisFault); } } } else if (flag.equalsIgnoreCase("OFF")) { if (axisConfiguration.isEngaged(axisModule.getName())) { axisConfiguration.disengageModule(axisModule); configurationContext.removeProperty(TracerConstants.MSG_SEQ_BUFFER); } } TracePersister tracePersister = getTracePersister(); tracePersister.saveTraceStatus(flag); tracerServiceInfo.setEmpty(true); tracerServiceInfo.setFlag(flag); tracerServiceInfo.setTracePersister(tracePersister.getClass().getName()); return tracerServiceInfo; }
Example 6
Source File: TracerAdmin.java From carbon-commons with Apache License 2.0 | 4 votes |
public TracerServiceInfo getMessages(int numberOfMessages, String filter) throws AxisFault { ConfigurationContext configContext = getConfigContext(); AxisConfiguration axisConfiguration = configContext.getAxisConfiguration(); CircularBuffer<MessageInfo> msgSeqBuff = getMessageSequenceBuffer(); List<MessageInfo> messageObjs; TracerServiceInfo tracerServiceInfo = new TracerServiceInfo(); AxisModule axisModule = axisConfiguration.getModule(TracerConstants.WSO2_TRACER); if (axisModule == null) { throw new AxisFault(TracerConstants.WSO2_TRACER + " module is not available"); } TracePersister tracePersister = getTracePersister(); tracerServiceInfo.setTracePersister(tracePersister.getClass().getName()); if (tracePersister.isTracingEnabled()) { if (!axisConfiguration.isEngaged(axisModule)) { axisConfiguration.engageModule(axisModule); } tracerServiceInfo.setFlag("ON"); } else { if (axisConfiguration.isEngaged(axisModule)) { axisConfiguration.disengageModule(axisModule); } tracerServiceInfo.setFlag("OFF"); } if (msgSeqBuff == null) { tracerServiceInfo.setEmpty(true); return tracerServiceInfo; } else { messageObjs = msgSeqBuff.get(numberOfMessages); if (messageObjs.isEmpty()) { tracerServiceInfo.setEmpty(true); return tracerServiceInfo; } else { ArrayList<MessageInfo> msgInfoList = new ArrayList<MessageInfo>(); boolean filterProvided = (filter != null && (filter = filter.trim()).length() != 0); tracerServiceInfo.setFilter(filterProvided); for (MessageInfo mi : messageObjs) { if (filterProvided) { MessagePayload miPayload = getMessage(mi.getServiceId(), mi.getOperationName(), mi.getMessageSequence()); String req = miPayload.getRequest(); if (req == null) { req = ""; } String resp = miPayload.getResponse(); if (resp == null) { resp = ""; } if (req.toUpperCase().contains(filter.toUpperCase()) || resp.toUpperCase().contains(filter.toUpperCase())) { msgInfoList.add(mi); } } else { msgInfoList.add(mi); } } if (filterProvided) { tracerServiceInfo.setFilterString(filter); if (msgInfoList.size() == 0) { tracerServiceInfo.setEmpty(true); return tracerServiceInfo; } } Collections.reverse(msgInfoList); MessageInfo lastMessageInfo = msgInfoList.get(0); tracerServiceInfo.setMessageInfo( msgInfoList.toArray(new MessageInfo[msgInfoList.size()])); MessagePayload lastMsg = getMessage(lastMessageInfo.getServiceId(), lastMessageInfo.getOperationName(), lastMessageInfo.getMessageSequence()); tracerServiceInfo.setLastMessage(lastMsg); tracerServiceInfo.setEmpty(false); } } return tracerServiceInfo; }