private void processAttachmentsLifecycleManager(AxisConfiguration axisConfig, OMElement element) { String className = element.getAttributeValue(new QName(TAG_CLASS_NAME)); try { Class classInstance = Loader.loadClass(className); LifecycleManager manager = (LifecycleManager) classInstance.newInstance(); axisConfig.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processAttachmentsLifecycleManager: Exception thrown initialising LifecycleManager: " + e.getMessage()); } } }
private void processAttachmentsLifecycleManager(AxisConfiguration axisConfig, OMElement element) { String className = element.getAttributeValue(new QName(TAG_CLASS_NAME)); try { Class classInstance = Loader.loadClass(className); LifecycleManager manager = (LifecycleManager) classInstance.newInstance(); axisConfig.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processAttachmentsLifecycleManager: Exception thrown initialising LifecycleManager: " + e.getMessage()); } } }
/** * Register a new WSDLExtensionValidator. * * @param axisConfiguration * @param validator */ public static void addWSDLExtensionValidator(AxisConfiguration axisConfiguration, WSDLExtensionValidator validator) throws AxisFault { Parameter param = axisConfiguration.getParameter(Constants.WSDL_EXTENSION_VALIDATOR_LIST_ID); if (param == null) { param = new Parameter(Constants.WSDL_EXTENSION_VALIDATOR_LIST_ID, new LinkedList()); axisConfiguration.addParameter(param); } List validatorList = (List) param.getValue(); validatorList.add(validator); if (debug) { log.debug("Registered WSDLExtensionValidator [" + validator + "] with AxisConfiguration: " + axisConfiguration); } }
/** * Register a new WSDLExtensionValidator. * * @param axisConfiguration * @param validator */ public static void addWSDLExtensionValidator(AxisConfiguration axisConfiguration, WSDLExtensionValidator validator) throws AxisFault { Parameter param = axisConfiguration.getParameter(Constants.WSDL_EXTENSION_VALIDATOR_LIST_ID); if (param == null) { param = new Parameter(Constants.WSDL_EXTENSION_VALIDATOR_LIST_ID, new LinkedList()); axisConfiguration.addParameter(param); } List validatorList = (List) param.getValue(); validatorList.add(validator); if (debug) { log.debug("Registered WSDLExtensionValidator [" + validator + "] with AxisConfiguration: " + axisConfiguration); } }
public void setSystemParameter(OMElement parameterElement) throws AxisFault { Parameter parameter = ParameterUtil.createParameter(parameterElement); getAxisConfig().addParameter(parameter); }
protected void activate(ComponentContext ctxt) { //TODO: Modify the permission in the UI try { ConfigurationContext configContext = configContextService.getServerConfigContext(); AxisService serviceAdmin = configContext.getAxisConfiguration().getService("ServiceAdmin"); Properties props = new Properties(); props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName()); ctxt.getBundleContext().registerService(AxisObserver.class.getName(), new CloudMSDeploymentInterceptor(), props); // register the role player for this configuration AxisConfiguration axisConfiguration = configContext.getAxisConfiguration(); axisConfiguration.addParameter(new Parameter("rolePlayer", new SuperTenantRolePlayer())); } catch (Exception e) { log.error("CloudMSDeploymentServiceComponent activation failed", e); } }
/** * @param args * @throws AxisFault * @throws Exception */ public void start() throws AxisFault { ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); context.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false)); context.getAxisConfiguration().addParameter(SUPPORT_SINGLE_OP, Boolean.valueOf(true)); context.getAxisConfiguration().addParameter(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false)); Map<String, MessageReceiver> msgRecieverMap = new HashMap<String, MessageReceiver>(); ConsumerMsgReceiver conMsgRcv = new ConsumerMsgReceiver(handler); msgRecieverMap.put("http://www.w3.org/ns/wsdl/in-only", conMsgRcv); AxisService service = AxisService.createService(ConsumerService.class.getName(), context.getAxisConfiguration(), msgRecieverMap, null, null, ConsumerServer.class.getClassLoader()); context.getAxisConfiguration().addService(service); server = new SimpleHTTPServer(context, this.listeningPort); server.start(); consumerService = service; }
/** * @param args * @throws AxisFault * @throws Exception */ public void start() throws AxisFault { ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null); context.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false)); context.getAxisConfiguration().addParameter(SUPPORT_SINGLE_OP, Boolean.valueOf(true)); context.getAxisConfiguration().addParameter(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false)); Map<String, MessageReceiver> msgRecieverMap = new HashMap<String, MessageReceiver>(); ConsumerMsgReceiver conMsgRcv = new ConsumerMsgReceiver(handler); msgRecieverMap.put("http://www.w3.org/ns/wsdl/in-only", conMsgRcv); AxisService service = AxisService.createService(ConsumerService.class.getName(), context.getAxisConfiguration(), msgRecieverMap, null, null, ConsumerServer.class.getClassLoader()); context.getAxisConfiguration().addService(service); server = new SimpleHTTPServer(context, this.listeningPort); server.start(); consumerService = service; }
public void setConfigContext(ConfigurationContext configContext) { // setting ServletContext into configctx configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, config.getServletContext()); Parameter servletConfigParam = new Parameter(); servletConfigParam.setName(HTTPConstants.HTTP_SERVLETCONFIG); servletConfigParam.setValue(config); try { configContext.getAxisConfiguration().addParameter(servletConfigParam); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } super.setConfigContext(configContext); } }
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { AxisConfiguration axiConfiguration = configContext.getAxisConfiguration(); Counter globalRequestCounter = new Counter(); Parameter globalRequestCounterParameter = new Parameter(); globalRequestCounterParameter.setName(MetricsConstants.GLOBAL_REQUEST_COUNTER); globalRequestCounterParameter.setValue(globalRequestCounter); axiConfiguration.addParameter(globalRequestCounterParameter); }
public void setConfigContext(ConfigurationContext configContext) { // setting ServletContext into configctx configContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, config.getServletContext()); Parameter servletConfigParam = new Parameter(); servletConfigParam.setName(HTTPConstants.HTTP_SERVLETCONFIG); servletConfigParam.setValue(config); try { configContext.getAxisConfiguration().addParameter(servletConfigParam); } catch (AxisFault axisFault) { log.error(axisFault.getMessage(), axisFault); } super.setConfigContext(configContext); } }
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { AxisConfiguration axiConfiguration = configContext.getAxisConfiguration(); Counter globalRequestCounter = new Counter(); Parameter globalRequestCounterParameter = new Parameter(); globalRequestCounterParameter.setName(MetricsConstants.GLOBAL_REQUEST_COUNTER); globalRequestCounterParameter.setValue(globalRequestCounter); axiConfiguration.addParameter(globalRequestCounterParameter); }
/** * Create a mock SynapseEnvironment object * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); axis2ConfigurationContext.getAxisConfiguration().addParameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
/** * Create a mock SynapseEnvironment object * * @return Axis2SynapseEnvironment instance * @throws AxisFault on creating/mocking object */ private Axis2SynapseEnvironment getMockedSynapseEnvironment() throws AxisFault { Axis2SynapseEnvironment synapseEnvironment = PowerMockito.mock(Axis2SynapseEnvironment.class); ConfigurationContext axis2ConfigurationContext = new ConfigurationContext(new AxisConfiguration()); axis2ConfigurationContext.getAxisConfiguration().addParameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment); Mockito.when(synapseEnvironment.getAxis2ConfigurationContext()).thenReturn(axis2ConfigurationContext); return synapseEnvironment; }
private MessageContext createMessageContext(String payload, String action) { try { SynapseConfiguration synapseConfig = new SynapseConfiguration(); AxisConfiguration axisConfig = new AxisConfiguration(); synapseConfig.setAxisConfiguration(axisConfig); ConfigurationContext cfgCtx = new ConfigurationContext(axisConfig); SynapseEnvironment env = new Axis2SynapseEnvironment(cfgCtx, synapseConfig); axisConfig.addParameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfig); axisConfig.addParameter(SynapseConstants.SYNAPSE_ENV, env); MessageContext msgCtx = TestUtils.getAxis2MessageContext(payload, null). getAxis2MessageContext(); msgCtx.setConfigurationContext(cfgCtx); msgCtx.setTo(new EndpointReference(SUB_MAN_URL)); msgCtx.setWSAAction(action); return msgCtx; } catch (Exception e) { fail(); } return null; } }
public static StorageManager getInMemoryStorageManager(ConfigurationContext context) throws SandeshaException { StorageManager inMemoryStorageManager = null; AxisConfiguration config = context.getAxisConfiguration(); Parameter parameter = config.getParameter(Sandesha2Constants.INMEMORY_STORAGE_MANAGER); if(parameter != null) inMemoryStorageManager = (StorageManager) parameter.getValue(); if (inMemoryStorageManager != null) return inMemoryStorageManager; try { //Currently module policies (default) are used to find the storage manager. These cant be overriden //TODO change this so that different services can hv different storage managers. String storageManagerClassStr = getDefaultPropertyBean(context.getAxisConfiguration()).getInMemoryStorageManagerClass(); inMemoryStorageManager = getStorageManagerInstance(storageManagerClassStr,context); parameter = new Parameter(Sandesha2Constants.INMEMORY_STORAGE_MANAGER, inMemoryStorageManager); config.addParameter(parameter); } catch(AxisFault e) { String message = SandeshaMessageHelper.getMessage( SandeshaMessageKeys.cannotInitInMemoryStorageManager, e.toString()); throw new SandeshaException(message, e); } return inMemoryStorageManager; }
public static EPRDecorator getEPRDecorator(ConfigurationContext context) throws SandeshaException { EPRDecorator decorator = null; AxisConfiguration config = context.getAxisConfiguration(); Parameter p = config.getParameter(Sandesha2Constants.EPR_DECORATOR); if(p != null) decorator = (EPRDecorator) p.getValue(); if (decorator != null) return decorator; try { //Currently module policies are used to find the decorator impl. These cant be overriden String decoratorClassStr = getDefaultPropertyBean(context.getAxisConfiguration()).getEPRDecoratorClass(); decorator = getEPRDecoratorInstance(decoratorClassStr,context); p = new Parameter(Sandesha2Constants.EPR_DECORATOR,decorator); config.addParameter(p); } catch(AxisFault e) { String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotInitEPRDecorator, e.toString()); throw new SandeshaException(message,e); } return decorator; }
public static ContextManager getContextManager(ConfigurationContext context) throws SandeshaException { ContextManager mgr = null; AxisConfiguration config = context.getAxisConfiguration(); Parameter p = config.getParameter(Sandesha2Constants.CONTEXT_MANAGER); if(p != null) mgr = (ContextManager) p.getValue(); if (mgr != null) return mgr; try { //Currently module policies are used to find the context impl. These cant be overriden String securityManagerClassStr = getDefaultPropertyBean(context.getAxisConfiguration()).getContextManagerClass(); mgr = getContextManagerInstance(securityManagerClassStr,context); p = new Parameter(Sandesha2Constants.CONTEXT_MANAGER,mgr); config.addParameter(p); } catch(AxisFault e) { String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotInitContextManager, e.toString()); throw new SandeshaException(message,e); } return mgr; }
public static SecurityManager getSecurityManager(ConfigurationContext context) throws SandeshaException { SecurityManager util = null; AxisConfiguration config = context.getAxisConfiguration(); Parameter p = config.getParameter(Sandesha2Constants.SECURITY_MANAGER); if(p != null) util = (SecurityManager) p.getValue(); if (util != null) return util; try { //Currently module policies are used to find the security impl. These cant be overriden String securityManagerClassStr = getDefaultPropertyBean(context.getAxisConfiguration()).getSecurityManagerClass(); util = getSecurityManagerInstance(securityManagerClassStr,context); p = new Parameter(Sandesha2Constants.SECURITY_MANAGER,util); config.addParameter(p); } catch(AxisFault e) { String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotInitSecurityManager, e.toString()); throw new SandeshaException(message,e); } return util; }
public static StorageManager getPermanentStorageManager(ConfigurationContext context) throws SandeshaException { StorageManager permanentStorageManager = null; AxisConfiguration config = context.getAxisConfiguration(); Parameter parameter = config.getParameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER); if(parameter != null) permanentStorageManager = (StorageManager) parameter.getValue(); if (permanentStorageManager != null) return permanentStorageManager; try { //Currently module policies (default) are used to find the storage manager. These cant be overriden //TODO change this so that different services can hv different storage managers. String storageManagerClassStr = getDefaultPropertyBean(context.getAxisConfiguration()).getPermanentStorageManagerClass(); permanentStorageManager = getStorageManagerInstance(storageManagerClassStr,context); parameter = new Parameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER, permanentStorageManager); config.addParameter(parameter); } catch(AxisFault e) { String message = SandeshaMessageHelper.getMessage( SandeshaMessageKeys.cannotInitPersistentStorageManager, e.toString()); throw new SandeshaException(message, e); } return permanentStorageManager; }