Package javax.resource.spi

Examples of javax.resource.spi.ActivationSpec


                    + aClass.getClassLoader());
            logger.log(Level.FINEST, "classloader parent = "
                    + aClass.getClassLoader().getParent());
        }

        ActivationSpec activationSpec =
                (ActivationSpec) aClass.newInstance();
        Set props = ConnectorsUtil.getMergedActivationConfigProperties(getDescriptor());

        AccessController.doPrivileged(new SetMethodAction(activationSpec, props));
        return activationSpec;
View Full Code Here


                    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

                objectRecipe.setMethodProperty(entry.getKey(), entry.getValue());
            }
            objectRecipe.setMethodProperty("beanClass", beanContext.getBeanClass());

            // 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");
            unusedProperties.remove("beanClass");
            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

/* 105 */     if (trace)
/* 106 */       log.trace("Loading ActivationSpec class=" + className);
/* 107 */     Class asClass = Thread.currentThread().getContextClassLoader().loadClass(className);
/* 108 */     if (!ActivationSpec.class.isAssignableFrom(asClass))
/* 109 */       throw new DeploymentException(asClass.getName() + " is not an activation spec class '" + messagingType + "' ra=" + rarName);
/* 110 */     ActivationSpec result = (ActivationSpec)asClass.newInstance();
/* 111 */     if (trace) {
/* 112 */       log.trace("Instantiated ActivationSpec class=" + result);
/*     */     }
/*     */
/* 117 */     Properties beanProps = new Properties();
/* 118 */     for (Iterator i = activationConfig.iterator(); i.hasNext(); )
/*     */     {
/* 120 */       ActivationConfigPropertyMetaData acpmd = (ActivationConfigPropertyMetaData)i.next();
/* 121 */       String name = acpmd.getName();
/* 122 */       String value = acpmd.getValue();
/* 123 */       beanProps.setProperty(name, value);
/*     */     }
/* 125 */     if (trace)
/* 126 */       log.trace("Configuring ActivationSpec properties=" + beanProps);
/*     */     try
/*     */     {
/* 129 */       PropertyEditors.mapJavaBeanProperties(result, beanProps);
/*     */     }
/*     */     catch (IntrospectionException e)
/*     */     {
/* 133 */       String msg = "Error for ActivationSpec class " + asClass.getName() + " as JavaBean";
/*     */
/* 135 */       DeploymentException.rethrowAsDeploymentException(msg, e);
/*     */     }
/*     */
/*     */     try
/*     */     {
/* 141 */       if (trace)
/* 142 */         log.trace("Trying to validate ActivationSpec " + result);
/* 143 */       result.validate();
/*     */     }
/*     */     catch (UnsupportedOperationException e)
/*     */     {
/* 147 */       log.debug("Validation is not supported for ActivationSpec: " + className);
/*     */     }
View Full Code Here

/* 231 */     if ("endpointActivation".equals(actionName))
/*     */     {
/* 233 */       if (params.length != 2)
/* 234 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 235 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 236 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 237 */       endpointActivation(messageEndpointFactory, activationSpec);
/* 238 */       return null;
/*     */     }
/* 240 */     if ("endpointDeactivation".equals(actionName))
/*     */     {
/* 242 */       if (params.length != 2)
/* 243 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 244 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 245 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 246 */       endpointDeactivation(messageEndpointFactory, activationSpec);
/* 247 */       return null;
/*     */     }
/* 249 */     return super.internalInvoke(actionName, params, signature);
/*     */   }
View Full Code Here

/* 235 */     else if ("endpointActivation".equals(actionName))
/*     */     {
/* 237 */       if (params.length != 2)
/* 238 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 239 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 240 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 241 */       endpointActivation(messageEndpointFactory, activationSpec);
/*     */     }
/* 243 */     else if ("endpointDeactivation".equals(actionName))
/*     */     {
/* 245 */       if (params.length != 2)
/* 246 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 247 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 248 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 249 */       endpointDeactivation(messageEndpointFactory, activationSpec);
/*     */     }
/*     */
/* 252 */     return result;
/*     */   }
View Full Code Here

/* 278 */     if ("endpointActivation".equals(actionName))
/*     */     {
/* 280 */       if (params.length != 2)
/* 281 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 282 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 283 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 284 */       endpointActivation(messageEndpointFactory, activationSpec);
/* 285 */       return null;
/*     */     }
/* 287 */     if ("endpointDeactivation".equals(actionName))
/*     */     {
/* 289 */       if (params.length != 2)
/* 290 */         throw new IllegalArgumentException("Wrong number of parameters for " + actionName);
/* 291 */       MessageEndpointFactory messageEndpointFactory = (MessageEndpointFactory)params[0];
/* 292 */       ActivationSpec activationSpec = (ActivationSpec)params[1];
/* 293 */       endpointDeactivation(messageEndpointFactory, activationSpec);
/* 294 */       return null;
/*     */     }
/* 296 */     return super.internalInvoke(actionName, params, signature);
/*     */   }
View Full Code Here

                    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

            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

      ResourceAdapter ra = rar.get();

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

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

      return instance;
   }
View Full Code Here

TOP

Related Classes of javax.resource.spi.ActivationSpec

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.