Package org.apache.axis2.engine

Examples of org.apache.axis2.engine.AxisConfiguration


    /**
     * Stop the proxy service
     * @param synCfg the synapse configuration
     */
    public void stop(SynapseConfiguration synCfg) {
        AxisConfiguration axisConfig = synCfg.getAxisConfiguration();
        if (axisConfig != null) {
            try {
                AxisService as = axisConfig.getService(this.getName());
                if (as != null) {
                    as.setActive(false);
                }
                this.setRunning(false);
                auditInfo("Started the proxy service : " + name);
View Full Code Here


            service.addParameter(responses);

            String value = Utils.getParameterValue(disabled);
            if (JavaUtils.isFalseExplicitly(value)) {
                ServiceDescription sd = endpointDescription.getServiceDescription();
                AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
                if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
                    axisConfig.engageModule(Constants.MODULE_ADDRESSING);
            }
        } catch (Exception e) {
            logger.error("Fail to configure addressing info ", e);
            throw ExceptionFactory.makeWebServiceException(Messages.getMessage("AddressingEngagementError", e.toString()));
        }
View Full Code Here

            for (URL url : entry.getValue()) {
                try {
                    AxisModule axismodule = new AxisModule();
                    ClassLoader loader = new org.apache.axis2.osgi.deployment.BundleClassLoader(bundle, Registry.class.getClassLoader());
                    axismodule.setModuleClassLoader(loader);
                    AxisConfiguration axisConfig = configurationContext.getAxisConfiguration();
                    ModuleBuilder builder = new ModuleBuilder(url.openStream(), axismodule, axisConfig);
                    Dictionary headers = bundle.getHeaders();
                    String bundleSymbolicName = (String) headers.get("Bundle-SymbolicName");
                    if (bundleSymbolicName != null && bundleSymbolicName.length() != 0) {
                        axismodule.setName(bundleSymbolicName);
                    }
                    String bundleVersion = (String) headers.get("Bundle-Version");
                    if (bundleVersion != null && bundleVersion.length() != 0) {
                        /*
                            Bundle version is defined as
                            version ::=
                                major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
                                major ::= number
                                minor ::= number
                                micro ::= number
                                qualifier ::= ( alphanum | ’_’ | '-' )+
                         */
                        String[] versionSplit = bundleVersion.split("\\.");
                        int[] components = new int[Math.min(versionSplit.length, 3)];
                        for (int i = 0; i < components.length; i++) {
                            components[i] = Integer.parseInt(versionSplit[i]);
                        }
                        axismodule.setVersion(new Version(components, versionSplit.length > 3 ? versionSplit[3] : null));
                    }
                    builder.populateModule();
                    axismodule.setParent(axisConfig);
                    AxisModule module = axisConfig.getModule(axismodule.getName());
                    if (module == null) {
                        DeploymentEngine.addNewModule(axismodule, axisConfig);
                        //initialze the module if the module contains Module interface.
                        Module moduleObj = axismodule.getModule();
                        if (moduleObj != null) {
                            moduleObj.init(configurationContext, axismodule);
                        }
                    }
                    // set in default map if necessary
                    Utils.calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
                } catch (IOException e) {
                    logger.error("Error while reading module.xml", e);
                }
            }
        }
View Full Code Here

     * @throws AxisFault
     */
    protected MessageContext getMsgCtx() throws Exception {
        MessageContext ctx = new MessageContext();
       
        AxisConfiguration axisConfiguration = new AxisConfiguration();
        AxisService axisService = new AxisService("TestService");
        axisConfiguration.addService(axisService);
        AxisServiceGroup axisServiceGroup = new AxisServiceGroup();
        axisConfiguration.addServiceGroup(axisServiceGroup);
        ctx.setConfigurationContext(new ConfigurationContext(axisConfiguration));
        axisServiceGroup.addService(axisService);
        ServiceGroupContext gCtx = ctx.getConfigurationContext().createServiceGroupContext(axisServiceGroup);
        ServiceContext serviceContext = gCtx.getServiceContext(axisService);
        ctx.setServiceContext(serviceContext);
View Full Code Here

  // initialize the module
  public void init(ConfigurationContext configContext,
      AxisModule module) throws AxisFault {
    if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::init, " + configContext);

    AxisConfiguration config = configContext.getAxisConfiguration();

    //storing the Sandesha module as a parameter.
    Parameter parameter = new Parameter(Sandesha2Constants.MODULE_CLASS_LOADER,module.getModuleClassLoader());
    config.addParameter(parameter);

    //init the i18n messages
    SandeshaMessageHelper.innit();
   
    //storing the module as a static variable
    SandeshaUtil.setAxisModule(module);
   
    // continueUncompletedSequences (storageManager,configCtx);

        SandeshaPolicyBean constantPropertyBean = new SandeshaPolicyBean ();
    SandeshaPolicyBean propertyBean = PropertyManager.loadPropertiesFromModuleDescPolicy(module,constantPropertyBean);
   
    if (propertyBean==null) {
      String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotLoadModulePolicies);
      log.error (message);
      propertyBean = new SandeshaPolicyBean ();
    } else {
      if (log.isDebugEnabled()) {
        String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.modulePoliciesLoaded);
        log.info (message);
      }
    }
   
    parameter = new Parameter (Sandesha2Constants.SANDESHA_PROPERTY_BEAN, propertyBean);
    config.addParameter(parameter);
   
    // Reset both storage managers
    parameter = config.getParameter(Sandesha2Constants.INMEMORY_STORAGE_MANAGER);
    if(parameter != null) config.removeParameter(parameter);
    parameter = config.getParameter(Sandesha2Constants.PERMANENT_STORAGE_MANAGER);
    if(parameter != null) config.removeParameter(parameter);

    try {
      StorageManager inMemorytorageManager = SandeshaUtil.getInMemoryStorageManager(configContext);
      inMemorytorageManager.initStorage(module);
    } catch (SandeshaStorageException e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotInitInMemoryStorageManager,
          e.toString());
      log.debug(message,e);
    }
   
    try {
      StorageManager permanentStorageManager = SandeshaUtil.getPermanentStorageManager(configContext);
      permanentStorageManager.initStorage(module);
    } catch (SandeshaStorageException e) {
      String message = SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotInitPersistentStorageManager,
          e.toString());
      log.debug(message,e);
    }
   
    // Reset the security manager, and then load it
    parameter = config.getParameter(Sandesha2Constants.SECURITY_MANAGER);
    if(parameter != null) config.removeParameter(parameter);
    SecurityManager util = SandeshaUtil.getSecurityManager(configContext);
    util.initSecurity(module);

    // Mark the config context so that we can run sync 2-way interations over
    // RM, but at the same time switch it off for unreliable messages.
    // We do a similar trick with the code that does an early HTTP 202 for
    // messages that don't need their backchannel.
    configContext.setProperty(Constants.Configuration.USE_ASYNC_OPERATIONS, Boolean.TRUE);
    configContext.getAxisConfiguration().addTargetResolver(
        new TargetResolver() {
          public void resolveTarget(MessageContext messageContext) {
           
            //if Sandesha2 is not engaged we can set the property straight away
           
            boolean engaged = false;
           
            //checking weather the module is engaged at the System level
            AxisConfiguration axisConfiguration = messageContext.getConfigurationContext().getAxisConfiguration();
            if (axisConfiguration!=null) {
              Collection modules = axisConfiguration.getEngagedModules();
              for (Iterator iter = modules.iterator();iter.hasNext();) {
                AxisModule module = (AxisModule) iter.next();
                String moduleName = module.getName();
                if (moduleName!=null && moduleName.startsWith (Sandesha2Constants.MODULE_NAME)) {
                  engaged = true;
View Full Code Here

    if (key==null)
      throw new SandeshaException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.cannotGetStorageKey));
   
    ConfigurationContext configurationContext = msgContext.getConfigurationContext();
    AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
   
    StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,axisConfiguration);
   
    msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,Sandesha2Constants.VALUE_TRUE);
   
View Full Code Here

 
  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 != nullreturn 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);
View Full Code Here

 
  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 != nullreturn 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);
View Full Code Here

  private static StorageManager getStorageManagerInstance (String className,ConfigurationContext context) throws SandeshaException {
   
    StorageManager storageManager = null;
    try {
      ClassLoader classLoader = null;
      AxisConfiguration config = context.getAxisConfiguration();
      Parameter classLoaderParam = config.getParameter(Sandesha2Constants.MODULE_CLASS_LOADER);
      if(classLoaderParam != null) classLoader = (ClassLoader) classLoaderParam.getValue();

        if (classLoader==null)
          throw new SandeshaException (SandeshaMessageHelper.getMessage(
              SandeshaMessageKeys.classLoaderNotFound));
View Full Code Here

  public static MessageContext createNewRelatedMessageContext(RMMsgContext referenceRMMessage, AxisOperation operation)
      throws SandeshaException {
    try {
      MessageContext referenceMessage = referenceRMMessage.getMessageContext();
      ConfigurationContext configContext = referenceMessage.getConfigurationContext();
      AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();

      MessageContext newMessageContext = new MessageContext();
      newMessageContext.setConfigurationContext(configContext);
     
      Options oldOptions = referenceMessage.getOptions();
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.