@Override
  protected void startListeningForService(AxisService service) throws AxisFault {
    E endpoint = createEndpoint(service);
    endpoint.setListener(this);
    endpoint.setService(service);
    endpoint.setContentType(
        ParamUtils.getRequiredParam(service, "transport." + getTransportName() + ".contentType"));
    endpoint.setMetrics(metrics);

    try {
      dispatcher.addEndpoint(endpoint);
    } catch (IOException ex) {
      throw new AxisFault(
          "Unable to listen on endpoint " + endpoint.getEndpointReference(defaultIp), ex);
    }
    if (log.isDebugEnabled()) {
      log.debug(
          "Started listening on endpoint "
              + endpoint.getEndpointReference(defaultIp)
              + " [contentType="
              + endpoint.getContentType()
              + "; service="
              + service.getName()
              + "]");
    }
    endpoints.put(service.getName(), endpoint);
  }
  /** @see org.apache.axis2.service.Lifecycle#init(org.apache.axis2.context.ServiceContext) */
  public void init(ServiceContext sc) {
    synchronized (initialized) {
      if (!initialized.booleanValue()) {
        AxisService axisService = sc.getAxisService();

        String propertiesPath =
            (String) axisService.getParameterValue("karma.properties.file.path");

        // remove potential whitespace introduced in karma.properties
        if (propertiesPath != null) propertiesPath = propertiesPath.trim();

        ServiceLauncher.start(propertiesPath);

        log = Logger.getLogger(KarmaServiceSkeleton.class);

        if (log.isDebugEnabled()) log.debug("in init");

        ingester = ServiceLauncher.getIngester();
        querier = ServiceLauncher.getQuerier();

        try {
          ingester.resetUnfinishedNotifications();
        } catch (IngestException e) {
          log.error("Error resetting unfinished notifications", e);
        }

        initialized = Boolean.TRUE;
      }
    }
  }
  /**
   * Loads a web service from a web service wrapper
   *
   * @param wrapper Web service wrapper
   * @throws Exception
   */
  protected void loadService(IServiceConfig wsDef) throws Exception {

    // first create the service
    String serviceId = wsDef.getId();
    AxisService axisService = AxisUtil.createService(wsDef, getAxisConfiguration());

    // add any additional transports
    addTransports(axisService);

    // add any end points
    addServiceEndPoints(axisService);

    // create the WSDL for the service
    AxisUtil.createServiceWsdl(axisService, wsDef, getAxisConfiguration());

    // add the wrapper to the service list
    services.put(serviceId, wsDef);

    // start the service
    axisConfig.addService(axisService);
    axisConfig.startService(axisService.getName());

    // enable or disable the service as the wrapper dictates
    axisService.setActive(wsDef.isEnabled());
  }
 @Override
 protected void stopListeningForService(AxisService service) {
   try {
     dispatcher.removeEndpoint(endpoints.get(service.getName()));
   } catch (IOException ex) {
     log.error("I/O exception while stopping listener for service " + service.getName(), ex);
   }
   endpoints.remove(service.getName());
 }
 private void loadObjectSupplierClass(String objectSupplierValue) throws AxisFault {
   try {
     ClassLoader loader = service.getClassLoader();
     Class objectSupplierImpl = Loader.loadClass(loader, objectSupplierValue.trim());
     ObjectSupplier objectSupplier = (ObjectSupplier) objectSupplierImpl.newInstance();
     service.setObjectSupplier(objectSupplier);
   } catch (Exception e) {
     throw AxisFault.makeFault(e);
   }
 }
  /** {@inheritDoc} */
  public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
    if (log.isDebugEnabled()) {
      log.debug(
          "Starting Activation Handler invocation. Incoming Message: "
              + messageContext.getEnvelope().toString());
    }

    AxisService service = messageContext.getAxisService();
    int tenantId = getTenantId(messageContext);
    if (service != null && "ActivationService".equals(service.getName())) {
      log.debug("Granted access to the Activation Service");
      if (tenantId > 0) {
        TenantAxisUtils.getTenantAxisConfiguration(
            getTenantDomain(), messageContext.getConfigurationContext());
        log.debug("Loaded Tenant Configuration");
      }
      return InvocationResponse.CONTINUE;
    }
    if (tenantId == MultitenantConstants.SUPER_TENANT_ID) {
      log.debug("Granted access for super tenant");
      return InvocationResponse.CONTINUE;
    }
    if (ActivationManager.activationRecorded(tenantId)) {
      if (ActivationManager.getActivation(tenantId)) {
        TenantAxisUtils.getTenantAxisConfiguration(
            getTenantDomain(), messageContext.getConfigurationContext());
        log.debug("Loaded Tenant Configuration");
        return InvocationResponse.CONTINUE;
      } else {
        if (log.isWarnEnabled()) {
          String serviceName = Util.getServiceName();
          log.warn("Failed attempt to access " + serviceName + " by tenant " + tenantId);
        }
        return InvocationResponse.ABORT;
      }
    }
    String serviceName = Util.getServiceName();
    try {
      if (CloudServicesUtil.isCloudServiceActive(serviceName, tenantId)) {
        log.debug("Successful attempt to access " + serviceName + " by tenant " + tenantId);
        ActivationManager.setActivation(tenantId, true);
        TenantAxisUtils.getTenantAxisConfiguration(
            getTenantDomain(), messageContext.getConfigurationContext());
        log.debug("Loaded Tenant Configuration");
        return InvocationResponse.CONTINUE;
      }
    } catch (Exception e) {
      throw new AxisFault("Failed to determine Activation status.", e);
    }
    log.warn("Failed attempt to access " + serviceName + " by tenant " + tenantId);
    ActivationManager.setActivation(tenantId, false);
    return InvocationResponse.ABORT;
  }
 private void loadServiceLifeCycleClass(String className) throws DeploymentException {
   if (className != null) {
     try {
       ClassLoader loader = service.getClassLoader();
       Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className);
       ServiceLifeCycle serviceLifeCycle =
           (ServiceLifeCycle) serviceLifeCycleClassImpl.newInstance();
       service.setServiceLifeCycle(serviceLifeCycle);
     } catch (Exception e) {
       throw new DeploymentException(e.getMessage(), e);
     }
   }
 }
Exemple #8
0
 public void processdisengageModule(HttpServletRequest req, HttpServletResponse res)
     throws IOException, ServletException {
   String type = req.getParameter("type");
   String serviceName = req.getParameter("serviceName");
   String moduleName = req.getParameter("module");
   AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
   AxisService service = axisConfiguration.getService(serviceName);
   AxisModule module = axisConfiguration.getModule(moduleName);
   if (type.equals("operation")) {
     if (service.isEngaged(module.getName()) || axisConfiguration.isEngaged(module.getName())) {
       req.getSession()
           .setAttribute(
               "status",
               "Can not disengage module "
                   + moduleName
                   + ". This module is engaged at a higher level.");
     } else {
       String opName = req.getParameter("operation");
       AxisOperation op = service.getOperation(new QName(opName));
       op.disengageModule(module);
       req.getSession()
           .setAttribute(
               "status",
               "Module "
                   + moduleName
                   + " was disengaged from "
                   + "operation "
                   + opName
                   + " in service "
                   + serviceName
                   + ".");
     }
   } else {
     if (axisConfiguration.isEngaged(module.getName())) {
       req.getSession()
           .setAttribute(
               "status",
               "Can not disengage module "
                   + moduleName
                   + ". "
                   + "This module is engaged at a higher level.");
     } else {
       service.disengageModule(axisConfiguration.getModule(moduleName));
       req.getSession()
           .setAttribute(
               "status",
               "Module " + moduleName + " was disengaged from" + " service " + serviceName + ".");
     }
   }
   renderView("disengage.jsp", req, res);
 }
 /**
  * Updates RelyingPartyService with Crypto information
  *
  * @param config AxisConfiguration
  * @throws Exception
  */
 private void populateRampartConfig(AxisConfiguration config) throws Exception {
   AxisService service;
   // Get the RelyingParty Service to update security policy with keystore information
   service = config.getService(GAPP_TENANT_REG_SERVICE_NAME);
   if (service == null) {
     String msg = GAPP_TENANT_REG_SERVICE_NAME + " is not available in the Configuration Context";
     log.error(msg);
     throw new Exception(msg);
   }
   // Create a Rampart Config with default crypto information
   Policy rampartConfig = TenantMgtRampartUtil.getDefaultRampartConfig();
   // Add the RampartConfig to service policy
   service.getPolicySubject().attachPolicy(rampartConfig);
 }
Exemple #10
0
  private boolean generateWsdl(AxisService axisService) {
    Iterator operatins = axisService.getOperations();
    if (operatins.hasNext()) {
      while (operatins.hasNext()) {
        AxisOperation axisOperation = (AxisOperation) operatins.next();

        if (axisOperation.isControlOperation()) {
          continue;
        }

        if (axisOperation.getMessageReceiver() == null) {
          continue;
        }
        String messageReceiverClass = axisOperation.getMessageReceiver().getClass().getName();
        if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver".equals(messageReceiverClass)
            || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
                .equals(messageReceiverClass)
            || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver"
                .equals(messageReceiverClass)
            || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver".equals(messageReceiverClass))) {
          return false;
        }
      }
    }
    return true;
  }
  public void testSoapOverUdpWithEchoService() throws Exception {
    Options options = new Options();
    options.setTo(new EndpointReference("udp://127.0.0.1:3333?contentType=text/xml+soap"));
    options.setAction(Constants.AXIS2_NAMESPACE_URI + "/echoOMElement");
    options.setUseSeparateListener(true);
    options.setTimeOutInMilliSeconds(Long.MAX_VALUE);

    ServiceClient serviceClient = new ServiceClient(getClientCfgCtx(), null);
    serviceClient.setOptions(options);
    // We need to set up the anonymous service Axis uses to get the response
    AxisService clientService = serviceClient.getServiceContext().getAxisService();
    clientService.addParameter(UDPConstants.PORT_KEY, 4444);
    clientService.addParameter(UDPConstants.CONTENT_TYPE_KEY, "text/xml+soap");
    OMElement response = serviceClient.sendReceive(createPayload());

    assertEchoResponse(response);
  }
Exemple #12
0
  /*
   * process data locator configuration for data retrieval.
   */
  private void processDataLocatorConfig(OMElement dataLocatorElement, AxisService service) {
    OMAttribute serviceOverallDataLocatorclass =
        dataLocatorElement.getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
    if (serviceOverallDataLocatorclass != null) {
      String className = serviceOverallDataLocatorclass.getAttributeValue();
      service.addDataLocatorClassNames(DRConstants.SERVICE_LEVEL, className);
    }
    Iterator iterator =
        dataLocatorElement.getChildrenWithName(new QName(DRConstants.DIALECT_LOCATOR_ELEMENT));

    while (iterator.hasNext()) {
      OMElement locatorElement = (OMElement) iterator.next();
      OMAttribute dialect = locatorElement.getAttribute(new QName(DRConstants.DIALECT_ATTRIBUTE));
      OMAttribute dialectclass =
          locatorElement.getAttribute(new QName(DRConstants.CLASS_ATTRIBUTE));
      service.addDataLocatorClassNames(
          dialect.getAttributeValue(), dialectclass.getAttributeValue());
    }
  }
Exemple #13
0
  /**
   * Return the connection factory name for this service. If this service refers to an invalid
   * factory or defaults to a non-existent default factory, this returns null
   *
   * @param service the AxisService
   * @return the JMSConnectionFactory to be used, or null if reference is invalid
   */
  public JMSConnectionFactory getConnectionFactory(AxisService service) {

    Parameter conFacParam = service.getParameter(JMSConstants.PARAM_JMS_CONFAC);
    // validate connection factory name (specified or default)
    if (conFacParam != null) {
      return connFacManager.getJMSConnectionFactory((String) conFacParam.getValue());
    } else {
      return connFacManager.getJMSConnectionFactory(JMSConstants.DEFAULT_CONFAC_NAME);
    }
  }
Exemple #14
0
 protected void build() throws IOException {
   InputStream jsFileStream = null;
   Parameter implInfoParam = service.getParameter(MashupConstants.SERVICE_JS);
   if (implInfoParam == null) {
     throw new AxisFault("Parameter 'ServiceJS' not specified");
   }
   Object value = implInfoParam.getValue();
   // We are reading the stream from the axis2 parameter
   jsFileStream =
       new ByteArrayInputStream(
           ((String) service.getParameter(MashupConstants.SERVICE_JS_STREAM).getValue())
               .getBytes());
   // We are reading the stream from the axis2 parameter
   try {
     sourceReader = new StringReader(HostObjectUtil.streamToString(jsFileStream));
   } catch (ScriptException e) {
     throw new IOException(e);
   }
 }
  /**
   * Adds Synapse Service to Axis2 configuration which enables the main message mediation.
   *
   * @throws AxisFault if an error occurs during Axis2 service initialization
   */
  private void deploySynapseService() 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(SynapseConstants.SYNAPSE_SERVICE_NAME);
    AxisOperation mediateOperation =
        new InOutAxisOperation(SynapseConstants.SYNAPSE_OPERATION_NAME);
    mediateOperation.setMessageReceiver(new SynapseMessageReceiver());
    synapseService.addOperation(mediateOperation);
    List<String> transports = new ArrayList<String>();
    transports.add(Constants.TRANSPORT_HTTP);
    transports.add(Constants.TRANSPORT_HTTPS);
    synapseService.setExposedTransports(transports);
    AxisServiceGroup synapseServiceGroup = new AxisServiceGroup(axisCfg);
    synapseServiceGroup.setServiceGroupName(SynapseConstants.SYNAPSE_SERVICE_NAME);
    synapseServiceGroup.addParameter(SynapseConstants.HIDDEN_SERVICE_PARAM, "true");
    synapseServiceGroup.addService(synapseService);
    axisCfg.addServiceGroup(synapseServiceGroup);
  }
Exemple #16
0
 public void processExplicitSchemaAndWSDL(HttpServletRequest req, HttpServletResponse res)
     throws IOException, ServletException {
   HashMap services = configContext.getAxisConfiguration().getServices();
   String filePart = req.getRequestURL().toString();
   String schema = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length());
   if ((services != null) && !services.isEmpty()) {
     Iterator i = services.values().iterator();
     while (i.hasNext()) {
       AxisService service = (AxisService) i.next();
       InputStream stream = service.getClassLoader().getResourceAsStream("META-INF/" + schema);
       if (stream != null) {
         OutputStream out = res.getOutputStream();
         res.setContentType("text/xml");
         copy(stream, out);
         out.flush();
         out.close();
         return;
       }
     }
   }
 }
Exemple #17
0
 /**
  * Process the package name to QName mapping:
  *
  * <p>&lt;packageMapping&gt; &lt;mapping packageName="foo.bar" qname="http://foo/bar/xsd"%gt;
  * ...... ...... &lt;/packageMapping&gt;
  *
  * @param packageMappingElement OMElement for the packageMappingElement
  */
 private void processTypeMappings(OMElement packageMappingElement) {
   Iterator elementItr = packageMappingElement.getChildrenWithName(new QName(TAG_MAPPING));
   TypeTable typeTable = service.getTypeTable();
   if (typeTable == null) {
     typeTable = new TypeTable();
   }
   while (elementItr.hasNext()) {
     OMElement mappingElement = (OMElement) elementItr.next();
     String packageName = mappingElement.getAttributeValue(new QName(TAG_PACKAGE_NAME));
     String qName = mappingElement.getAttributeValue(new QName(TAG_QNAME));
     if (packageName == null || qName == null) {
       continue;
     }
     Iterator keys = service.getNamespaceMap().keySet().iterator();
     while (keys.hasNext()) {
       String key = (String) keys.next();
       if (qName.equals(service.getNamespaceMap().get(key))) {
         typeTable.addComplexSchema(packageName, new QName(qName, packageName, key));
       }
     }
   }
   service.setTypeTable(typeTable);
 }
Exemple #18
0
  public static ServiceContext createAdressedEnabledClientSide(
      AxisService service, String clientHome) throws AxisFault {
    File file = getAddressingMARFile();
    TestCase.assertTrue(file.exists());

    ConfigurationContext configContext =
        ConfigurationContextFactory.createConfigurationContextFromFileSystem(clientHome, null);
    AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();

    AxisModule axisModule = DeploymentEngine.buildModule(file, axisConfiguration);
    axisConfiguration.addModule(axisModule);

    axisConfiguration.addService(service);
    ServiceGroupContext serviceGroupContext =
        configContext.createServiceGroupContext((AxisServiceGroup) service.getParent());
    return serviceGroupContext.getServiceContext(service);
  }
Exemple #19
0
 private void setDefaultMessageReceivers() {
   Iterator operations = service.getPublishedOperations().iterator();
   while (operations.hasNext()) {
     AxisOperation operation = (AxisOperation) operations.next();
     if (operation.getMessageReceiver() == null) {
       MessageReceiver messageReceiver =
           loadDefaultMessageReceiver(operation.getMessageExchangePattern(), service);
       if (messageReceiver == null
           &&
           // we assume that if the MEP is ROBUST_IN_ONLY then the in-out
           // MR can handle that
           WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(operation.getMessageExchangePattern())) {
         messageReceiver = loadDefaultMessageReceiver(WSDL2Constants.MEP_URI_IN_OUT, service);
       }
       operation.setMessageReceiver(messageReceiver);
     }
   }
 }
Exemple #20
0
  protected void processServiceModuleConfig(
      Iterator moduleConfigs, ParameterInclude parent, AxisService service)
      throws DeploymentException {
    while (moduleConfigs.hasNext()) {
      OMElement moduleConfig = (OMElement) moduleConfigs.next();
      OMAttribute moduleName_att = moduleConfig.getAttribute(new QName(ATTRIBUTE_NAME));

      if (moduleName_att == null) {
        throw new DeploymentException(
            Messages.getMessage(DeploymentErrorMsgs.INVALID_MODULE_CONFIG));
      } else {
        String module = moduleName_att.getAttributeValue();
        ModuleConfiguration moduleConfiguration = new ModuleConfiguration(module, parent);
        Iterator parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER));

        processParameters(parameters, moduleConfiguration, parent);
        service.addModuleConfig(moduleConfiguration);
      }
    }
  }
Exemple #21
0
  /**
   * Gets the list of modules that is required to be engaged globally.
   *
   * @param moduleRefs <code>java.util.Iterator</code>
   * @throws DeploymentException <code>DeploymentException</code>
   */
  protected void processModuleRefs(Iterator moduleRefs) throws DeploymentException {
    //		try {
    while (moduleRefs.hasNext()) {
      OMElement moduleref = (OMElement) moduleRefs.next();
      OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));

      if (moduleRefAttribute != null) {
        String refName = moduleRefAttribute.getAttributeValue();
        service.addModuleref(refName);
        //					if (axisConfig.getModule(refName) == null) {
        //						throw new DeploymentException(Messages.getMessage(
        //								DeploymentErrorMsgs.MODULE_NOT_FOUND, refName));
        //					} else {
        //						service.addModuleref(refName);
        //					}
      }
    }
    //		} catch (AxisFault axisFault) {
    //			throw new DeploymentException(axisFault);
    //		}
  }
Exemple #22
0
 /**
  * To get the methods which do not use RPC* MessageReceivers
  *
  * @param axisService the AxisService to search
  * @return an ArrayList of the LOCAL PARTS of the QNames of any non-RPC operations TODO: Why not
  *     just return the AxisOperations themselves??
  */
 private ArrayList<String> getNonRPCMethods(AxisService axisService) {
   ArrayList<String> excludeOperations = new ArrayList<String>();
   Iterator<AxisOperation> operatins = axisService.getOperations();
   if (operatins.hasNext()) {
     while (operatins.hasNext()) {
       AxisOperation axisOperation = operatins.next();
       if (axisOperation.getMessageReceiver() == null) {
         continue;
       }
       String messageReceiverClass = axisOperation.getMessageReceiver().getClass().getName();
       if (!("org.apache.axis2.rpc.receivers.RPCMessageReceiver".equals(messageReceiverClass)
           || "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"
               .equals(messageReceiverClass)
           || "org.apache.axis2.rpc.receivers.RPCInOutAsyncMessageReceiver"
               .equals(messageReceiverClass)
           || "org.apache.axis2.jaxws.server.JAXWSMessageReceiver".equals(messageReceiverClass))) {
         excludeOperations.add(axisOperation.getName().getLocalPart());
       }
     }
   }
   return excludeOperations;
 }
Exemple #23
0
  public void processEditServicePara(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    String serviceName = req.getParameter("axisService");
    if (req.getParameter("changePara") != null) {
      AxisService service = configContext.getAxisConfiguration().getService(serviceName);
      if (service != null) {
        for (Parameter parameter : service.getParameters()) {
          String para = req.getParameter(serviceName + "_" + parameter.getName());
          service.addParameter(new Parameter(parameter.getName(), para));
        }

        for (Iterator<AxisOperation> iterator = service.getOperations(); iterator.hasNext(); ) {
          AxisOperation axisOperation = iterator.next();
          String op_name = axisOperation.getName().getLocalPart();

          for (Parameter parameter : axisOperation.getParameters()) {
            String para = req.getParameter(op_name + "_" + parameter.getName());

            axisOperation.addParameter(new Parameter(parameter.getName(), para));
          }
        }
      }
      res.setContentType("text/html");
      req.setAttribute("status", "Parameters Changed Successfully.");
      req.getSession().removeAttribute(Constants.SERVICE);
    } else {
      AxisService serviceTemp =
          configContext.getAxisConfiguration().getServiceForActivation(serviceName);
      if (serviceTemp.isActive()) {

        if (serviceName != null) {
          req.getSession()
              .setAttribute(
                  Constants.SERVICE, configContext.getAxisConfiguration().getService(serviceName));
        }
      } else {
        req.setAttribute(
            "status",
            "Service "
                + serviceName
                + " is not an active service"
                + ". \n Only parameters of active services can be edited.");
      }
    }
    renderView(SERVICE_PARA_EDIT_JSP_NAME, req, res);
  }
Exemple #24
0
 private void startupServiceLifecycle() {
   if (service.getServiceLifeCycle() != null) {
     service.getServiceLifeCycle().startUp(configCtx, service);
   }
 }
Exemple #25
0
 private void processEndpoints(AxisService axisService) throws AxisFault {
   String endpointName = axisService.getEndpointName();
   if (endpointName == null || endpointName.length() == 0) {
     Utils.addEndpointsToService(axisService, service.getAxisConfiguration());
   }
 }
Exemple #26
0
  /**
   * Populates service from corresponding OM.
   *
   * @param service_element an OMElement for the &lt;service&gt; tag
   * @return a filled-in AxisService, configured from the passed XML
   * @throws DeploymentException if there is a problem
   */
  public AxisService populateService(OMElement service_element) throws DeploymentException {
    try {
      // Determine whether service should be activated.
      String serviceActivate = service_element.getAttributeValue(new QName(ATTRIBUTE_ACTIVATE));
      if (serviceActivate != null) {
        if ("true".equals(serviceActivate)) {
          service.setActive(true);
        } else if ("false".equals(serviceActivate)) {
          service.setActive(false);
        }
      }

      // Processing service level parameters
      OMAttribute serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME));

      // If the service name is explicitly specified in the services.xml
      // then use that as the service name
      if (serviceNameatt != null) {
        if (!"".equals(serviceNameatt.getAttributeValue().trim())) {
          AxisService wsdlService = wsdlServiceMap.get(serviceNameatt.getAttributeValue());
          if (wsdlService != null) {
            wsdlService.setClassLoader(service.getClassLoader());
            wsdlService.setParent(service.getAxisServiceGroup());
            service = wsdlService;
            service.setWsdlFound(true);
            service.setCustomWsdl(true);
          }
          service.setName(serviceNameatt.getAttributeValue());
          // To be on the safe side
          if (service.getDocumentation() == null) {
            service.setDocumentation(serviceNameatt.getAttributeValue());
          }
        }
      }

      Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER));
      processParameters(itr, service, service.getParent());

      Parameter childFirstClassLoading =
          service.getParameter(Constants.Configuration.ENABLE_CHILD_FIRST_CLASS_LOADING);
      if (childFirstClassLoading != null) {
        ClassLoader cl = service.getClassLoader();
        if (cl instanceof DeploymentClassLoader) {
          DeploymentClassLoader deploymentClassLoader = (DeploymentClassLoader) cl;
          if (JavaUtils.isTrueExplicitly(childFirstClassLoading.getValue())) {
            deploymentClassLoader.setChildFirstClassLoading(true);
          } else if (JavaUtils.isFalseExplicitly(childFirstClassLoading.getValue())) {
            deploymentClassLoader.setChildFirstClassLoading(false);
          }
        }
      }

      // If multiple services in one service group have different values
      // for the PARENT_FIRST
      // parameter then the final value become the value specified by the
      // last service in the group
      // Parameter parameter =
      // service.getParameter(DeploymentClassLoader.PARENT_FIRST);
      // if (parameter !=null && "false".equals(parameter.getValue())) {
      // ClassLoader serviceClassLoader = service.getClassLoader();
      // ((DeploymentClassLoader)serviceClassLoader).setParentFirst(false);
      // }
      // process service description
      OMElement descriptionElement =
          service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
      if (descriptionElement != null) {
        OMElement descriptionValue = descriptionElement.getFirstElement();
        if (descriptionValue != null) {
          service.setDocumentation(descriptionValue);
        } else {
          service.setDocumentation(descriptionElement.getText());
        }
      } else {
        serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME));

        if (serviceNameatt != null) {
          if (!"".equals(serviceNameatt.getAttributeValue().trim())
              && service.getDocumentation() == null) {
            service.setDocumentation(serviceNameatt.getAttributeValue());
          }
        }
      }

      if (service.getParameter("ServiceClass") == null) {
        log.debug("The Service " + service.getName() + " does not specify a Service Class");
      }

      // Process WS-Addressing flag attribute
      OMAttribute addressingRequiredatt =
          service_element.getAttribute(new QName(ATTRIBUTE_WSADDRESSING));
      if (addressingRequiredatt != null) {
        String addressingRequiredString = addressingRequiredatt.getAttributeValue();
        AddressingHelper.setAddressingRequirementParemeterValue(service, addressingRequiredString);
      }

      // Setting service target namespace if any
      OMAttribute targetNameSpace = service_element.getAttribute(new QName(TARGET_NAME_SPACE));

      if (targetNameSpace != null) {
        String nameSpeceVale = targetNameSpace.getAttributeValue();
        if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
          service.setTargetNamespace(nameSpeceVale);
        }
      } else {
        if (service.getTargetNamespace() == null || "".equals(service.getTargetNamespace())) {
          service.setTargetNamespace(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE);
        }
      }

      // Processing service lifecycle attribute
      OMAttribute serviceLifeCycleClass = service_element.getAttribute(new QName(TAG_CLASS_NAME));
      if (serviceLifeCycleClass != null) {
        String className = serviceLifeCycleClass.getAttributeValue();
        loadServiceLifeCycleClass(className);
      }
      // Setting schema namespece if any
      OMElement schemaElement = service_element.getFirstChildWithName(new QName(SCHEMA));
      if (schemaElement != null) {
        OMAttribute schemaNameSpace = schemaElement.getAttribute(new QName(SCHEMA_NAME_SPACE));
        if (schemaNameSpace != null) {
          String nameSpeceVale = schemaNameSpace.getAttributeValue();
          if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
            service.setSchemaTargetNamespace(nameSpeceVale);
          }
        }
        OMAttribute elementFormDefault =
            schemaElement.getAttribute(new QName(SCHEMA_ELEMENT_QUALIFIED));
        if (elementFormDefault != null) {
          String value = elementFormDefault.getAttributeValue();
          if ("true".equals(value)) {
            service.setElementFormDefault(true);
          } else if ("false".equals(value)) {
            service.setElementFormDefault(false);
          }
        }

        // package to namespace mapping. This will be an element that
        // maps pkg names to a namespace
        // when this is doing AxisService.getSchemaTargetNamespace will
        // be overridden
        // This will be <mapping/> with @namespace and @package
        Iterator mappingIterator = schemaElement.getChildrenWithName(new QName(MAPPING));
        if (mappingIterator != null) {
          Map<String, String> pkg2nsMap = new Hashtable<String, String>();
          while (mappingIterator.hasNext()) {
            OMElement mappingElement = (OMElement) mappingIterator.next();
            OMAttribute namespaceAttribute =
                mappingElement.getAttribute(new QName(ATTRIBUTE_NAMESPACE));
            OMAttribute packageAttribute =
                mappingElement.getAttribute(new QName(ATTRIBUTE_PACKAGE));
            if (namespaceAttribute != null && packageAttribute != null) {
              String namespaceAttributeValue = namespaceAttribute.getAttributeValue();
              String packageAttributeValue = packageAttribute.getAttributeValue();
              if (namespaceAttributeValue != null && packageAttributeValue != null) {
                pkg2nsMap.put(packageAttributeValue.trim(), namespaceAttributeValue.trim());
              } else {
                log.warn(
                    "Either value of @namespce or @packagename not available. Thus, generated will be selected.");
              }
            } else {
              log.warn(
                  "Either @namespce or @packagename not available. Thus, generated will be selected.");
            }
          }
          service.setP2nMap(pkg2nsMap);
        }
      }

      // processing Default Message receivers
      OMElement messageReceiver =
          service_element.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVERS));
      if (messageReceiver != null) {
        HashMap<String, MessageReceiver> mrs =
            processMessageReceivers(service.getClassLoader(), messageReceiver);
        for (Map.Entry<String, MessageReceiver> entry : mrs.entrySet()) {
          service.addMessageReceiver(entry.getKey(), entry.getValue());
        }
      }

      // Removing exclude operations
      OMElement excludeOperations =
          service_element.getFirstChildWithName(new QName(TAG_EXCLUDE_OPERATIONS));
      ArrayList<String> excludeops = null;
      if (excludeOperations != null) {
        excludeops = processExcludeOperations(excludeOperations);
      }
      if (excludeops == null) {
        excludeops = new ArrayList<String>();
      }
      Utils.addExcludeMethods(excludeops);

      // <schema targetNamespace="http://x.y.z"/>
      // setting the PolicyInclude
      // processing <wsp:Policy> .. </..> elements
      Iterator policyElements =
          service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));

      if (policyElements != null && policyElements.hasNext()) {
        processPolicyElements(policyElements, service.getPolicySubject());
      }

      // processing <wsp:PolicyReference> .. </..> elements
      Iterator policyRefElements =
          service_element.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));

      if (policyRefElements != null && policyRefElements.hasNext()) {
        processPolicyRefElements(policyRefElements, service.getPolicySubject());
      }

      // processing service scope
      String sessionScope = service_element.getAttributeValue(new QName(ATTRIBUTE_SCOPE));
      if (sessionScope != null) {
        service.setScope(sessionScope);
      }

      // processing service-wide modules which required to engage globally
      Iterator moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE));

      processModuleRefs(moduleRefs);

      // processing transports
      OMElement transports = service_element.getFirstChildWithName(new QName(TAG_TRANSPORTS));
      if (transports != null) {
        Iterator transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT));
        ArrayList<String> trs = new ArrayList<String>();
        while (transport_itr.hasNext()) {
          OMElement trsEle = (OMElement) transport_itr.next();
          String transportName = trsEle.getText().trim();
          if (axisConfig.getTransportIn(transportName) == null) {
            log.warn(
                "Service [ "
                    + service.getName()
                    + "] is trying to expose in a transport : "
                    + transportName
                    + " and which is not available in Axis2");
          } else {
            trs.add(transportName);
          }
        }

        if (trs.isEmpty()) {
          throw new AxisFault(
              "Service ["
                  + service.getName()
                  + "] is trying expose in tranpsorts: "
                  + transports
                  + " and which is/are not available in Axis2");
        }
        service.setExposedTransports(trs);
      }
      // processing operations
      Iterator operationsIterator = service_element.getChildrenWithName(new QName(TAG_OPERATION));
      ArrayList ops = processOperations(operationsIterator);

      for (int i = 0; i < ops.size(); i++) {
        AxisOperation operationDesc = (AxisOperation) ops.get(i);
        ArrayList wsamappings = operationDesc.getWSAMappingList();
        if (wsamappings == null) {
          continue;
        }
        if (service.getOperation(operationDesc.getName()) == null) {
          service.addOperation(operationDesc);
        }
        for (int j = 0; j < wsamappings.size(); j++) {
          String mapping = (String) wsamappings.get(j);
          if (mapping.length() > 0) {
            service.mapActionToOperation(mapping, operationDesc);
          }
        }
      }
      String objectSupplierValue = (String) service.getParameterValue(TAG_OBJECT_SUPPLIER);
      if (objectSupplierValue != null) {
        loadObjectSupplierClass(objectSupplierValue);
      }
      // Set the default message receiver for the operations that were
      // not listed in the services.xml
      setDefaultMessageReceivers();
      Utils.processBeanPropertyExclude(service);
      if (!service.isUseUserWSDL()) {
        // Generating schema for the service if the impl class is Java
        if (!service.isWsdlFound()) {
          // trying to generate WSDL for the service using JAM and
          // Java reflection
          try {
            if (generateWsdl(service)) {
              Utils.fillAxisService(service, axisConfig, excludeops, null);
            } else {
              ArrayList nonRpcOperations = getNonRPCMethods(service);
              Utils.fillAxisService(service, axisConfig, excludeops, nonRpcOperations);
            }
          } catch (Exception e) {
            throw new DeploymentException(
                Messages.getMessage("errorinschemagen", e.getMessage()), e);
          }
        }
      }
      if (service.isCustomWsdl()) {
        OMElement mappingElement =
            service_element.getFirstChildWithName(new QName(TAG_PACKAGE2QNAME));
        if (mappingElement != null) {
          processTypeMappings(mappingElement);
        }
      }

      for (String opName : excludeops) {
        service.removeOperation(new QName(opName));
      }

      // Need to call the same logic towice
      setDefaultMessageReceivers();
      Iterator moduleConfigs = service_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
      processServiceModuleConfig(moduleConfigs, service, service);

      // Loading Data Locator(s) configured
      OMElement dataLocatorElement =
          service_element.getFirstChildWithName(new QName(DRConstants.DATA_LOCATOR_ELEMENT));
      if (dataLocatorElement != null) {
        processDataLocatorConfig(dataLocatorElement, service);
      }

      processEndpoints(service);
      processPolicyAttachments(service_element, service);

    } catch (AxisFault axisFault) {
      throw new DeploymentException(axisFault);
    }

    startupServiceLifecycle();
    return service;
  }
Exemple #27
0
  private ArrayList<AxisOperation> processOperations(Iterator operationsIterator) throws AxisFault {
    ArrayList<AxisOperation> operations = new ArrayList<AxisOperation>();
    while (operationsIterator.hasNext()) {
      OMElement operation = (OMElement) operationsIterator.next();
      // getting operation name
      OMAttribute op_name_att = operation.getAttribute(new QName(ATTRIBUTE_NAME));
      if (op_name_att == null) {
        throw new DeploymentException(
            Messages.getMessage(
                Messages.getMessage(DeploymentErrorMsgs.INVALID_OP, "operation name missing")));
      }

      // setting the MEP of the operation
      OMAttribute op_mep_att = operation.getAttribute(new QName(TAG_MEP));
      String mepurl = null;

      if (op_mep_att != null) {
        mepurl = op_mep_att.getAttributeValue();
      }

      String opname = op_name_att.getAttributeValue();
      AxisOperation op_descrip = null;

      // getting the namesapce from the attribute.
      OMAttribute operationNamespace = operation.getAttribute(new QName(ATTRIBUTE_NAMESPACE));
      if (operationNamespace != null) {
        String namespace = operationNamespace.getAttributeValue();
        op_descrip = service.getOperation(new QName(namespace, opname));
      }
      if (op_descrip == null) {
        op_descrip = service.getOperation(new QName(opname));
      }

      if (op_descrip == null) {
        op_descrip = service.getOperation(new QName(service.getTargetNamespace(), opname));
      }
      if (op_descrip == null) {
        if (mepurl == null) {
          // assumed MEP is in-out
          op_descrip = new InOutAxisOperation();
          op_descrip.setParent(service);

        } else {
          op_descrip = AxisOperationFactory.getOperationDescription(mepurl);
        }
        op_descrip.setName(new QName(opname));
        String MEP = op_descrip.getMessageExchangePattern();
        if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
            || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
          AxisMessage inaxisMessage = op_descrip.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
          if (inaxisMessage != null) {
            inaxisMessage.setName(opname + Java2WSDLConstants.MESSAGE_SUFFIX);
          }
        }

        if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP)
            || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP)
            || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
          AxisMessage outAxisMessage = op_descrip.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
          if (outAxisMessage != null) {
            outAxisMessage.setName(opname + Java2WSDLConstants.RESPONSE);
          }
        }
      }

      // setting the PolicyInclude

      // processing <wsp:Policy> .. </..> elements
      Iterator policyElements = operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY));

      if (policyElements != null && policyElements.hasNext()) {
        processPolicyElements(policyElements, op_descrip.getPolicySubject());
      }

      // processing <wsp:PolicyReference> .. </..> elements
      Iterator policyRefElements =
          operation.getChildrenWithName(new QName(POLICY_NS_URI, TAG_POLICY_REF));

      if (policyRefElements != null && policyRefElements.hasNext()) {
        processPolicyRefElements(policyRefElements, op_descrip.getPolicySubject());
      }

      // Operation Parameters
      Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
      processParameters(parameters, op_descrip, service);
      // To process wsamapping;
      processActionMappings(operation, op_descrip);

      // loading the message receivers
      OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER));

      if (receiverElement != null) {
        MessageReceiver messageReceiver =
            loadMessageReceiver(service.getClassLoader(), receiverElement);

        op_descrip.setMessageReceiver(messageReceiver);
      } else {
        // setting default message receiver
        MessageReceiver msgReceiver =
            loadDefaultMessageReceiver(op_descrip.getMessageExchangePattern(), service);
        op_descrip.setMessageReceiver(msgReceiver);
      }

      // Process Module Refs
      Iterator modules = operation.getChildrenWithName(new QName(TAG_MODULE));

      processOperationModuleRefs(modules, op_descrip);

      // processing Messages
      Iterator messages = operation.getChildrenWithName(new QName(TAG_MESSAGE));

      processMessages(messages, op_descrip);

      // setting Operation phase
      if (axisConfig != null) {
        PhasesInfo info = axisConfig.getPhasesInfo();

        info.setOperationPhases(op_descrip);
      }
      Iterator moduleConfigs = operation.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
      processOperationModuleConfig(moduleConfigs, op_descrip, op_descrip);
      // adding the operation
      operations.add(op_descrip);
    }
    return operations;
  }
  public void execute(ConfigurationContext configContext) throws ClusteringFault {
    AxisConfiguration axisConfig = configContext.getAxisConfiguration();

    // Run this code only if this node is not already initialized
    if (configContext.getPropertyNonReplicable(ClusteringConstants.RECD_CONFIG_INIT_MSG) == null) {
      log.info("Received configuration initialization message");
      configContext.setNonReplicableProperty(ClusteringConstants.RECD_CONFIG_INIT_MSG, "true");
      if (serviceGroups != null) {

        // Load all the service groups that are sent by the neighbour
        for (int i = 0; i < serviceGroups.length; i++) {
          String serviceGroup = serviceGroups[i];
          if (axisConfig.getServiceGroup(serviceGroup) == null) {
            // Load the service group
            try {
              ClusteringUtils.loadServiceGroup(
                  serviceGroup,
                  configContext,
                  System.getProperty(
                      "axis2.work.dir")); // TODO: Introduce a constant. work dir is a temp dir.
            } catch (FileNotFoundException ignored) {
            } catch (Exception e) {
              throw new ClusteringFault(e);
            }
          }
        }

        // TODO: We support only AAR files for now

        // Unload all service groups which were not sent by the neighbour,
        // but have been currently loaded
        for (Iterator iter = axisConfig.getServiceGroups(); iter.hasNext(); ) {
          AxisServiceGroup serviceGroup = (AxisServiceGroup) iter.next();
          boolean foundServiceGroup = false;
          for (int i = 0; i < serviceGroups.length; i++) {
            String serviceGroupName = serviceGroups[i];
            if (serviceGroup.getServiceGroupName().equals(serviceGroupName)) {
              foundServiceGroup = true;
              break;
            }
          }
          if (!foundServiceGroup) {
            boolean mustUnloadServiceGroup = true;
            // Verify that this service was not loaded from within a module
            // If so, we must not unload such a service
            for (Iterator serviceIter = serviceGroup.getServices(); serviceIter.hasNext(); ) {
              AxisService service = (AxisService) serviceIter.next();
              if (service.isClientSide()
                  || service.getParameter(AxisModule.MODULE_SERVICE)
                      != null) { // Do not unload service groups containing client side services or
                                 // ones deployed from within modules
                mustUnloadServiceGroup = false;
                break;
              }
            }
            if (mustUnloadServiceGroup) {
              try {
                axisConfig.removeServiceGroup(serviceGroup.getServiceGroupName());
              } catch (Exception e) {
                throw new ClusteringFault(e);
              }
            }
          }
        }
      }
    }
  }
  /**
   * Loads a throttle metadata for a particular throttle type
   *
   * @param messageContext - The messageContext
   * @param throttleType - The type of throttle
   * @return IPBaseThrottleConfiguration - The IPBaseThrottleConfiguration - load from
   *     AxisConfiguration
   * @throws ThrottleException Throws if the throttle type is unsupported
   */
  public Throttle loadThrottle(MessageContext messageContext, int throttleType)
      throws ThrottleException {

    Throttle throttle = null;
    ConfigurationContext configContext = messageContext.getConfigurationContext();
    // the Parameter which hold throttle ipbase object
    // to get throttles map from the configuration context

    Map throttles = (Map) configContext.getPropertyNonReplicable(ThrottleConstants.THROTTLES_MAP);
    if (throttles == null) {
      if (debugOn) {
        log.debug("Couldn't find throttles object map .. thottlling will not be occurred ");
      }
      return null;
    }
    switch (throttleType) {
      case ThrottleConstants.GLOBAL_THROTTLE:
        {
          throttle = (Throttle) throttles.get(ThrottleConstants.GLOBAL_THROTTLE_KEY);
          break;
        }
      case ThrottleConstants.OPERATION_BASED_THROTTLE:
        {
          AxisOperation axisOperation = messageContext.getAxisOperation();
          if (axisOperation != null) {
            QName opName = axisOperation.getName();
            if (opName != null) {
              AxisService service = (AxisService) axisOperation.getParent();
              if (service != null) {
                String currentServiceName = service.getName();
                if (currentServiceName != null) {
                  throttle = (Throttle) throttles.get(currentServiceName + opName.getLocalPart());
                }
              }
            }
          } else {
            if (debugOn) {
              log.debug("Couldn't find axis operation ");
            }
            return null;
          }
          break;
        }
      case ThrottleConstants.SERVICE_BASED_THROTTLE:
        {
          AxisService axisService = messageContext.getAxisService();
          if (axisService != null) {
            throttle = (Throttle) throttles.get(axisService.getName());
          } else {
            if (debugOn) {
              log.debug("Couldn't find axis service ");
            }
            return null;
          }
          break;
        }
      default:
        {
          throw new ThrottleException("Unsupported Throttle type");
        }
    }
    return throttle;
  }
  /**
   * Create a ServiceTaskManager for the service passed in and its corresponding
   * JMSConnectionFactory
   *
   * @param jcf
   * @param service
   * @param workerPool
   * @return
   */
  public static ServiceTaskManager createTaskManagerForService(
      JMSConnectionFactory jcf, AxisService service, WorkerPool workerPool) {

    String name = service.getName();
    Map<String, String> svc = getServiceStringParameters(service.getParameters());
    Map<String, String> cf = jcf.getParameters();

    ServiceTaskManager stm = new ServiceTaskManager();

    stm.setServiceName(name);
    stm.addJmsProperties(cf);
    stm.addJmsProperties(svc);

    stm.setConnFactoryJNDIName(getRqdStringProperty(JMSConstants.PARAM_CONFAC_JNDI_NAME, svc, cf));
    String destName = getOptionalStringProperty(JMSConstants.PARAM_DESTINATION, svc, cf);
    if (destName == null) {
      destName = service.getName();
    }
    stm.setDestinationJNDIName(destName);
    stm.setDestinationType(getDestinationType(svc, cf));
    if (getOptionalBooleanProperty(JMSConstants.PARAM_SUB_DURABLE, svc, cf) != null
        && getOptionalBooleanProperty(JMSConstants.PARAM_SUB_DURABLE, svc, cf)) {
      stm.setDurableSubscriberClientId(
          getRqdStringProperty(JMSConstants.PARAM_DURABLE_SUB_CLIENT_ID, svc, cf));
    }

    stm.setJmsSpec11(getJMSSpecVersion(svc, cf));
    stm.setTransactionality(getTransactionality(svc, cf));
    stm.setCacheUserTransaction(
        getOptionalBooleanProperty(BaseConstants.PARAM_CACHE_USER_TXN, svc, cf));
    stm.setUserTransactionJNDIName(
        getOptionalStringProperty(BaseConstants.PARAM_USER_TXN_JNDI_NAME, svc, cf));
    stm.setSessionTransacted(
        getOptionalBooleanProperty(JMSConstants.PARAM_SESSION_TRANSACTED, svc, cf));
    stm.setSessionAckMode(getSessionAck(svc, cf));
    stm.setMessageSelector(getOptionalStringProperty(JMSConstants.PARAM_MSG_SELECTOR, svc, cf));
    stm.setSubscriptionDurable(getOptionalBooleanProperty(JMSConstants.PARAM_SUB_DURABLE, svc, cf));
    stm.setDurableSubscriberName(
        getOptionalStringProperty(JMSConstants.PARAM_DURABLE_SUB_NAME, svc, cf));

    stm.setCacheLevel(getCacheLevel(svc, cf));
    stm.setPubSubNoLocal(getOptionalBooleanProperty(JMSConstants.PARAM_PUBSUB_NO_LOCAL, svc, cf));

    Integer value = getOptionalIntProperty(JMSConstants.PARAM_RCV_TIMEOUT, svc, cf);
    if (value != null) {
      stm.setReceiveTimeout(value);
    }
    value = getOptionalIntProperty(JMSConstants.PARAM_CONCURRENT_CONSUMERS, svc, cf);
    if (value != null) {
      stm.setConcurrentConsumers(value);
    }
    value = getOptionalIntProperty(JMSConstants.PARAM_MAX_CONSUMERS, svc, cf);
    if (value != null) {
      stm.setMaxConcurrentConsumers(value);
    }
    value = getOptionalIntProperty(JMSConstants.PARAM_IDLE_TASK_LIMIT, svc, cf);
    if (value != null) {
      stm.setIdleTaskExecutionLimit(value);
    }
    value = getOptionalIntProperty(JMSConstants.PARAM_MAX_MSGS_PER_TASK, svc, cf);
    if (value != null) {
      stm.setMaxMessagesPerTask(value);
    }

    value = getOptionalIntProperty(JMSConstants.PARAM_RECON_INIT_DURATION, svc, cf);
    if (value != null) {
      stm.setInitialReconnectDuration(value);
    }
    value = getOptionalIntProperty(JMSConstants.PARAM_RECON_MAX_DURATION, svc, cf);
    if (value != null) {
      stm.setMaxReconnectDuration(value);
    }
    Double dValue = getOptionalDoubleProperty(JMSConstants.PARAM_RECON_FACTOR, svc, cf);
    if (dValue != null) {
      stm.setReconnectionProgressionFactor(dValue);
    }

    stm.setWorkerPool(workerPool);

    // remove processed properties from property bag
    stm.removeJmsProperties(JMSConstants.PARAM_CONFAC_JNDI_NAME);
    stm.removeJmsProperties(JMSConstants.PARAM_DESTINATION);
    stm.removeJmsProperties(JMSConstants.PARAM_JMS_SPEC_VER);
    stm.removeJmsProperties(BaseConstants.PARAM_TRANSACTIONALITY);
    stm.removeJmsProperties(BaseConstants.PARAM_CACHE_USER_TXN);
    stm.removeJmsProperties(BaseConstants.PARAM_USER_TXN_JNDI_NAME);
    stm.removeJmsProperties(JMSConstants.PARAM_SESSION_TRANSACTED);
    stm.removeJmsProperties(JMSConstants.PARAM_MSG_SELECTOR);
    stm.removeJmsProperties(JMSConstants.PARAM_SUB_DURABLE);
    stm.removeJmsProperties(JMSConstants.PARAM_DURABLE_SUB_NAME);
    stm.removeJmsProperties(JMSConstants.PARAM_CACHE_LEVEL);
    stm.removeJmsProperties(JMSConstants.PARAM_PUBSUB_NO_LOCAL);
    stm.removeJmsProperties(JMSConstants.PARAM_RCV_TIMEOUT);
    stm.removeJmsProperties(JMSConstants.PARAM_CONCURRENT_CONSUMERS);
    stm.removeJmsProperties(JMSConstants.PARAM_MAX_CONSUMERS);
    stm.removeJmsProperties(JMSConstants.PARAM_IDLE_TASK_LIMIT);
    stm.removeJmsProperties(JMSConstants.PARAM_MAX_MSGS_PER_TASK);
    stm.removeJmsProperties(JMSConstants.PARAM_RECON_INIT_DURATION);
    stm.removeJmsProperties(JMSConstants.PARAM_RECON_MAX_DURATION);
    stm.removeJmsProperties(JMSConstants.PARAM_RECON_FACTOR);
    stm.removeJmsProperties(JMSConstants.PARAM_DURABLE_SUB_CLIENT_ID);

    return stm;
  }