Examples of ActivationSpec


Examples of javax.resource.spi.ActivationSpec

    Iterator it = keys.iterator();
    while (it.hasNext()) {
      Map.Entry entry = (Map.Entry) it.next();
     
      MessageEndpointFactory endpointFactory = ((InboundConsumer)entry.getValue()).endpointFactory;
      ActivationSpec spec = (ActivationSpec) entry.getKey();
      try {
        endpointDeactivation(endpointFactory, spec);
        endpointActivation(endpointFactory, spec);
      } catch (ResourceException e) {
        if (logger.isLoggable(BasicLevel.INFO))
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

        } catch (JoramException e) {
            throw new EZBComponentException("Cannot create initial queues", e);
        }

        // Create and bind ActivationSpec
        ActivationSpec activationSpec = new ActivationSpecImpl();
        try {
            activationSpec.setResourceAdapter(this.joramAdapter);
        } catch (ResourceException e) {
            throw new EZBComponentException("Cannot set resource adapter on activation spec object", e);
        }
        try {
            this.ictx.rebind("joramActivationSpec", activationSpec);
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

        // Activation Spec object
        String activationSpecName = getActivationSpec(messageDrivenBean);


        // get Activation spec object
        ActivationSpec activationSpec = null;
        try {
            activationSpec = (ActivationSpec) new InitialContext().lookup(activationSpecName);
        } catch (NamingException e1) {
            throw new EZBContainerException("Cannot get the activation spec with the name '"
                    + activationSpecName + "'.", e1);
        }

        // Marshall the given object in order to be sure to get a new Object each time
        if (activationSpec instanceof Serializable) {
            byte[] byteArgs;
            try {
                byteArgs = storeObject((Serializable) activationSpec);
            } catch (IOException e) {
                throw new EZBContainerException("Cannot serialize the activation spec object '" + activationSpec + "'.", e);
            }

            // Then load object from this array of bytes
            try {
                activationSpec = (ActivationSpec) loadObject(byteArgs);
            } catch (IOException e) {
               throw new EZBContainerException("Cannot load activation spec from the serialized object.", e);
            } catch (ClassNotFoundException e) {
                throw new EZBContainerException("Cannot load activation spec from the serialized object.", e);
            }

        }

        // get ResourceAdapter object
        ResourceAdapter resourceAdapter = null;
        try {
            resourceAdapter = MDBResourceAdapterHelper.getResourceAdapter(activationSpecName,
                    (Embedded) getConfiguration().getEZBServer());
        } catch (ResourceException e) {
            throw new EZBContainerException("Cannot get the resource adapter for this MDB factory", e);
        }

        // Associate Resource Adapter with ActivationSpec object (if not set)
        if (activationSpec.getResourceAdapter() == null) {
            try {
                activationSpec.setResourceAdapter(resourceAdapter);
            } catch (ResourceException e) {
                throw new EZBContainerException("Cannot associate resource adapter with activation spec object", e);
            }
        }
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

      else if ("endpointActivation".equals(actionName))
      {
         if (params.length != 2)
            throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
         MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
         ActivationSpec activationSpec = (ActivationSpec) params[1];
         endpointActivation(messageEndpointFactory, activationSpec);
         return null;
      }
      else if ("endpointDeactivation".equals(actionName))
      {
         if (params.length != 2)
            throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
         MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory) params[0];
         ActivationSpec activationSpec = (ActivationSpec) params[1];
         endpointDeactivation(messageEndpointFactory, activationSpec);
         return null;
      }
      return super.internalInvoke(actionName, params, signature);
   }
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

                    beanContext.getMdbInterface().getName() + " but this MDB container only supports " +
                    messageListenerInterface);
        }

        // create the activation spec
        ActivationSpec activationSpec = createActivationSpec(beanContext);

        if (inboundRecovery != null) {
            inboundRecovery.recover(resourceAdapter, activationSpec, containerID.toString());
        }
       
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

            for (Map.Entry<String, String> entry : activationProperties.entrySet()) {
                objectRecipe.setMethodProperty(entry.getKey(), entry.getValue());
            }

            // create the activationSpec
            ActivationSpec activationSpec = (ActivationSpec) objectRecipe.create(activationSpecClass.getClassLoader());

            // verify all properties except "destination" and "destinationType" were consumed
            Set<String> unusedProperties = new TreeSet<String>(objectRecipe.getUnsetProperties().keySet());
            unusedProperties.remove("destination");
            unusedProperties.remove("destinationType");
            if (!unusedProperties.isEmpty()) {
                throw new IllegalArgumentException("No setter found for the activation spec properties: " + unusedProperties);
            }


            // validate the activation spec
            try {
                activationSpec.validate();
            } catch (UnsupportedOperationException uoe) {
                logger.info("ActivationSpec does not support validate. Implementation of validate is optional");
            }
            // also try validating using Bean Validation if there is a Validator available in the context.
            try {
                Validator validator = (Validator)beanContext.getJndiContext().lookup("comp/Validator");

                Set generalSet = validator.validate(activationSpec);
                if (!generalSet.isEmpty()) {
                    throw new ConstraintViolationException("Constraint violation for ActivationSpec " + activationSpecClass.getName(), generalSet);
                }
            } catch (NamingException e) {
                logger.debug("No Validator bound to JNDI context");
            }


            // set the resource adapter into the activation spec
            activationSpec.setResourceAdapter(resourceAdapter);

            return activationSpec;
        } catch (Exception e) {
            throw new OpenEJBException("Unable to create activation spec", e);
        }
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

                    deploymentInfo.getMdbInterface().getName() + " but this MDB container only supports " +
                    messageListenerInterface);
        }

        // create the activation spec
        ActivationSpec activationSpec = createActivationSpec(deploymentInfo);

        // create the message endpoint
        MdbInstanceFactory instanceFactory = new MdbInstanceFactory(deploymentInfo, securityService, instanceLimit);
        EndpointFactory endpointFactory = new EndpointFactory(activationSpec, this, deploymentInfo, instanceFactory, xaResourceWrapper);
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

            for (Map.Entry<String, String> entry : activationProperties.entrySet()) {
                objectRecipe.setMethodProperty(entry.getKey(), entry.getValue());
            }

            // create the activationSpec
            ActivationSpec activationSpec = (ActivationSpec) objectRecipe.create(activationSpecClass.getClassLoader());

            // verify all properties except "destination" and "destinationType" were consumed
            Set<String> unusedProperties = new TreeSet<String>(objectRecipe.getUnsetProperties().keySet());
            unusedProperties.remove("destination");
            unusedProperties.remove("destinationType");
            if (!unusedProperties.isEmpty()) {
                throw new IllegalArgumentException("No setter found for the activation spec properties: " + unusedProperties);
            }


            // validate the activation spec
            try {
                activationSpec.validate();
            } catch (UnsupportedOperationException uoe) {
                logger.info("ActivationSpec does not support validate. Implementation of validate is optional");
            }
           

            // set the resource adapter into the activation spec
            activationSpec.setResourceAdapter(resourceAdapter);

            return activationSpec;
        } catch (Exception e) {
            throw new OpenEJBException("Unable to create activation spec", e);
        }
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

      ResourceAdapter ra = rar.get();

      if (ra == null)
         throw new NotFoundException(bundle.resourceAdapterNotAvailable());

      ActivationSpec instance = ActivationSpec.class.cast(clz.newInstance());
      instance.setResourceAdapter(ra);

      if (valueProperties != null && valueProperties.size() > 0)
      {
         Injection injector = new Injection();
         Iterator<Map.Entry<String, String>> it = valueProperties.entrySet().iterator();
View Full Code Here

Examples of javax.resource.spi.ActivationSpec

            final Activation activation = requiredMessageListener.getActivation();
            // filter out the activation config properties, specified on the MDB, which aren't accepted by the resource
            // adaptor
            final Properties validActivationConfigProps = this.filterUnknownActivationConfigProperties(resourceAdapterName, activation, activationConfigProperties);
            // now set the activation config properties on the ActivationSpec
            final ActivationSpec activationSpec = activation.createInstance();
            PropertyEditors.mapJavaBeanProperties(activationSpec, validActivationConfigProps);

            return activationSpec;

        } catch (IllegalAccessException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.