Package org.apache.axis2.engine

Examples of org.apache.axis2.engine.AxisConfiguration


                     AxisModule axisModule) throws AxisFault {

        log.info("Deploying the Synapse service..");

        // Dynamically initialize the Synapse Service and deploy it into Axis2
        AxisConfiguration axisCfg = configurationContext.getAxisConfiguration();
        AxisService synapseService = new AxisService(SYNAPSE_SERVICE_NAME);
        AxisOperation mediateOperation = new InOutAxisOperation(MEDIATE_OPERATION_Q_NAME);
        mediateOperation.setMessageReceiver(new SynapseMessageReceiver());
        synapseService.addOperation(mediateOperation);
        axisCfg.addService(synapseService);

        // Initializing the SynapseEnvironment and SynapseConfiguration
        log.info("Initializing the Synapse configuration ...");
        SynapseConfiguration synCfg = initializeSynapse(configurationContext);
View Full Code Here


    }

    private static SynapseConfiguration initializeSynapse(
            ConfigurationContext cfgCtx) {

        AxisConfiguration axisConfiguration = cfgCtx.getAxisConfiguration();

        /*
        First check, if synapse.xml URL is provided as a system property, if so use it..
        else check if synapse.xml location is available from the axis2.xml
        "SynapseConfiguration" else use the default config
        */
        SynapseConfiguration synapseConfiguration;
        Parameter configParam = axisConfiguration.getParameter(Constants.SYNAPSE_CONFIGURATION);

        String config = System.getProperty(Constants.SYNAPSE_XML);

        if (config != null) {
            log.info("System property '" + Constants.SYNAPSE_XML +
                     "' specifies synapse configuration as " + config);
            synapseConfiguration =
                    SynapseConfigurationBuilder.getConfiguration(config);
        } else if (configParam != null) {
            log.info(
                    "Synapse configuration is available via the " +
                    "'SynapseConfiguration' parameter in axis2.xml");
            synapseConfiguration = SynapseConfigurationBuilder
                    .getConfiguration(configParam.getValue().toString().trim());
        } else {
            log.warn("System property '" + Constants.SYNAPSE_XML +
                     "' is not specified or 'SynapseConfiguration' Parameter " +
                     "is not available via axis2.xml.  Using default configuration..");
            synapseConfiguration =
                    SynapseConfigurationBuilder.getDefaultConfiguration();
        }

        // Set the Axis2 ConfigurationContext to the SynapseConfiguration
        synapseConfiguration.setAxisConfiguration(cfgCtx.getAxisConfiguration());

        // set the Synapse configuration and environment into the Axis2 configuration
        Parameter synapseCtxParam = new Parameter(Constants.SYNAPSE_CONFIG, null);
        synapseCtxParam.setValue(synapseConfiguration);

        Parameter synapseEnvParam = new Parameter(Constants.SYNAPSE_ENV, null);

        Parameter synEnvImpl = axisConfiguration.getParameter(Constants.SYNAPSE_ENV_IMPL);
        if (synEnvImpl != null && synEnvImpl.getValue() != null) {
            String clazz = (String) synEnvImpl.getValue();
            try {
                Constructor constr = Class.forName(clazz).getDeclaredConstructor(
                        new Class [] {ConfigurationContext.class});
                synapseEnvParam.setValue(constr.newInstance(new Object[] {cfgCtx}));
            } catch (ClassNotFoundException e) {
                handleException("Cannot find Synapse environment implementation : " + clazz, e);
            } catch (NoSuchMethodException e) {
                handleException("Cannot find Synapse environment constructor : " + clazz, e);
            } catch (IllegalAccessException e) {
                handleException("Error instantiating Synapse environment with : " + clazz, e);
            } catch (InvocationTargetException e) {
                handleException("Error invoking constructor of Synapse environment : " + clazz, e);
            } catch (InstantiationException e) {
                handleException("Error instantiating Synapse environment with : " + clazz, e);
            }
        } else {
            synapseEnvParam.setValue(new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration));
        }

        try {
            axisConfiguration.addParameter(synapseCtxParam);
            axisConfiguration.addParameter(synapseEnvParam);

        } catch (AxisFault e) {
            String msg =
                    "Could not set parameters '" + Constants.SYNAPSE_CONFIG +
                    "' and/or '" + Constants.SYNAPSE_ENV +
View Full Code Here

            log.debug("RM Mediator works only for the First Chain");
            return true;
        }

        ConfigurationContext cc = msgCtx.getConfigurationContext();
        AxisConfiguration ac = cc.getAxisConfiguration();

        try {
            rmEnabledService(cc, ac, msgCtx);

            AxisEngine ae = new AxisEngine(cc);
View Full Code Here

   
    // Some code to programatically load an Axis2 module only if we need it
    // currently hard coded to load rampart only. Needs generalization
    public synchronized static void loadRampartModule(ConfigurationContext axis2ConfigContext) {
        try {
            final AxisConfiguration axisConfiguration = axis2ConfigContext.getAxisConfiguration();
            final URL rampartURL = new URL(axis2Config.repositoryURL.toString() + "modules/rampart-1.4.mar");
           
            ClassLoader deploymentClassLoader = org.apache.axis2.deployment.util.Utils.createClassLoader(
                    new URL[]{rampartURL},
                    axisConfiguration.getModuleClassLoader(),
                    true,
                    (File) axisConfiguration.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
           
            final AxisModule module = new AxisModule();
            module.setModuleClassLoader(deploymentClassLoader);
            module.setParent(axisConfiguration);

            if (module.getName() == null) {
                module.setName("rampart-1.4");
                module.setVersion(new Version("1.4"));
            }
           
            populateModule(axis2ConfigContext, module, rampartURL);
            module.setFileName(rampartURL);
           
            // Allow privileged access to read properties. Requires PropertiesPermission read in
            // security policy.
            try {
                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                    public Object run() throws IOException {
                        DeploymentEngine.addNewModule(module, axisConfiguration);
                        return null;
                    }
                });
            } catch (PrivilegedActionException e) {
                throw (AxisFault)e.getException();
            }           
          
            org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(),
                                                                      axisConfiguration);
            axisConfiguration.validateSystemPredefinedPhases();
        } catch (IOException e) {
            throw new ServiceRuntimeException(e);
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
View Full Code Here

        super("CreateSeqBeanMgrTest");
    }

    public void setUp() throws Exception {
     
        AxisConfiguration axisConfig =  new AxisConfiguration();
        SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
        ConfigurationContext configCtx = new ConfigurationContext(axisConfig);

        ClassLoader classLoader = getClass().getClassLoader();
        configCtx.setProperty(Sandesha2Constants.MODULE_CLASS_LOADER,classLoader);
View Full Code Here

    public SenderBeanMgrTest() {
        super("RetransmitterBeanMgrTest");
    }

    public void setUp() throws Exception {
        AxisConfiguration axisConfig = new AxisConfiguration();
        SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
        ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
       
        ClassLoader classLoader = getClass().getClassLoader();
        configCtx.setProperty(Sandesha2Constants.MODULE_CLASS_LOADER,classLoader);
View Full Code Here

    String repoPath = "target" + File.separator + "repos" + File.separator + "server";
    String axis2_xml = "test-resources" + File.separator + "server_mtom_axis2.xml";
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
        repoPath, axis2_xml);

    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
    AxisService axisService = axisConfiguration.getService("RMSampleService");
    AxisOperation operation = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY);
    operation.setMessageReceiver(new MTOMTestMessageReceiver());
    operation.setName(new QName(MTOMping));
    axisService.addOperation(operation);
View Full Code Here

    public InvokerBeanMgrTest() {
        super ("StorageMapBeanMgrTest");
    }

    public void setUp() throws Exception {
        AxisConfiguration axisConfig = new AxisConfiguration();
        SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
        ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
       
        ClassLoader classLoader = getClass().getClassLoader();
        configCtx.setProperty(Sandesha2Constants.MODULE_CLASS_LOADER,classLoader);
View Full Code Here

    public SequencePropertyBeanMgrTest() {
        super("SequencePropertyBeanMgrTest");
    }

    public void setUp() throws Exception {
        AxisConfiguration axisConfig = new AxisConfiguration();
        SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromDefaultValues();
        Parameter parameter = new Parameter ();
        parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN);
        parameter.setValue(propertyBean);
        axisConfig.addParameter(parameter);
       
        ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
       
        ClassLoader classLoader = getClass().getClassLoader();
        configCtx.setProperty(Sandesha2Constants.MODULE_CLASS_LOADER,classLoader);
View Full Code Here

   
    ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
        repoPath, axis2_xml);

    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
    AxisService axisService = axisConfiguration.getService("RMSampleService");
    AxisOperation operation = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_ONLY);
    operation.setMessageReceiver(new TestMessageReceiver());
    operation.setName(new QName(TEST_OPERATION_NAME));
    axisService.addOperation(operation);
View Full Code Here

TOP

Related Classes of org.apache.axis2.engine.AxisConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.