private Object getInterceptorImpl(Class<?> ann) { if (ann == AroundInvoke.class) { return new AroundInvokeImpl(); } else if (ann == PostConstruct.class) { return new PostConstructImpl(); } else if (ann == PostActivate.class) { return new PostActivateImpl(); } else if (ann == PrePassivate.class) { return new PrePassivateImpl(); } else if (ann == PreDestroy.class) { return new PreDestroyImpl(); } return null; }
public LocalProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable icProperties) { super(container, producer, props, dest, ctx, icProperties); try { factoryName = pImpl.connectionFactory(); if (factoryName.equals("")) factoryName = "java:/ConnectionFactory"; } catch (Exception e) { throw new RuntimeException(e); } }
public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, ApplicationExceptionMetaData metaData, ClassLoader classLoader) { if(annotationClass == ApplicationException.class && metaData != null) { return annotationClass.cast(new ApplicationExceptionImpl(metaData.isRollback())); } return null; }
annotation = new InitImpl(); annotation = new PostConstructImpl(); annotation = new PostActivateImpl(); annotationClass = javax.ejb.PostActivate.class; method.setMethodName("ejbActivate"); addAnnotations(annotationClass, annotation, container, method); annotation = new PrePassivateImpl(); annotationClass = javax.ejb.PrePassivate.class; method.setMethodName("ejbPassivate"); addAnnotations(annotationClass, annotation, container, method); annotation = new PreDestroyImpl(); annotationClass = javax.annotation.PreDestroy.class; method.setMethodName("ejbRemove"); addAnnotations(annotationClass, annotation, container, method); annotation = new ResourceImpl(); annotationClass = Resource.class; method.setMethodName("setSessionContext");
private void addDefaultActivationConfig(MDB container, JBossMessageDrivenBeanMetaData mdb) { ActivationConfigMetaData defaultActivationConfig = mdb.getDefaultActivationConfig(); if (defaultActivationConfig != null) { DefaultActivationSpecsImpl activationAnnotation = new DefaultActivationSpecsImpl(); for (ActivationConfigPropertyMetaData property : defaultActivationConfig.getActivationConfigProperties()) { activationAnnotation.addActivationConfigProperty(new ActivationConfigPropertyImpl(property .getName(), property.getValue())); } DefaultActivationSpecs existingAnnotation = ejbClass.getAnnotation(DefaultActivationSpecs.class); if (existingAnnotation != null) activationAnnotation.merge(existingAnnotation); addClassAnnotation(container, DefaultActivationSpecs.class, activationAnnotation); } }
private void addSecurityIdentityAnnotation(EJBContainer container, SecurityIdentityMetaData identity) { if (identity != null && !identity.isUseCallerId()) { RunAsMetaData runAs = identity.getRunAs(); RunAsImpl annotation = null; if (runAs != null) { annotation = new RunAsImpl(runAs.getRoleName()); addClassAnnotation(container, annotation.annotationType(), annotation); } String runAsPrincipal = identity.getRunAsPrincipal(); if (runAsPrincipal != null) { RunAsPrincipalImpl principalAnnotation = new RunAsPrincipalImpl(runAsPrincipal); addClassAnnotation(container, principalAnnotation .annotationType(), principalAnnotation); } } }
private void addHomeAnnotations(EJBContainer container, JBossSessionBeanMetaData sessionBean) throws Exception { if (sessionBean.getHome() != null) { RemoteHomeImpl annotation = new RemoteHomeImpl(di.getClassLoader() .loadClass(sessionBean.getHome())); addClassAnnotation(container, annotation.annotationType(), annotation); } if (sessionBean.getLocalHome() != null) { LocalHomeImpl annotation = new LocalHomeImpl(di.getClassLoader() .loadClass(sessionBean.getLocalHome())); addClassAnnotation(container, annotation.annotationType(), annotation); } }
private void addSimpleJndiAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws ClassNotFoundException { RemoteBindingImpl remoteBinding = null; String jndiName = enterpriseBean.getMappedName(); if (jndiName != null) { remoteBinding = new RemoteBindingImpl(); remoteBinding.setJndiBinding(jndiName); addClassAnnotation(container, RemoteBinding.class, remoteBinding); } if (remoteBinding != null) { RemoteBinding existingBinding = ejbClass.getAnnotation(RemoteBinding.class); if (existingBinding != null) remoteBinding.merge(existingBinding); addClassAnnotation(container, RemoteBinding.class, remoteBinding); } }
public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData metaData, ClassLoader classLoader) { if (annotationClass == Clustered.class && isClustered(metaData)) { ClusteredImpl impl = createAnnotationImpl(); ClusterConfigMetaData ccmd = findClusterConfigMetaData(metaData); if (ccmd != null) { if (ccmd.getPartitionName() != null) impl.setPartition(ccmd.getPartitionName()); // FIXME Once @Clustered and ClusteredImpl are updated, just use the string values if (ccmd.getBeanLoadBalancePolicy() != null) impl.setLoadBalancePolicy(ccmd.getBeanLoadBalancePolicy()); if (ccmd.getHomeLoadBalancePolicy() != null) impl.setHomeLoadBalancePolicy(ccmd.getHomeLoadBalancePolicy()); } return annotationClass.cast(impl); } return null; }
public Object createProxyBusiness() { Class[] interfaces = {producer, ProducerObject.class}; ProducerManagerImpl mImpl = null; mImpl = new ProducerManagerImpl(dest, factoryName, props.delivery(), props.timeToLive(), props.priority(), methodMap, initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode()); Interceptor[] interceptors = {mImpl}; ProducerProxy ih = new ProducerProxy(mImpl, interceptors); return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih); }
private void addLocalJndiAnnotations(EJBContainer container, JBossSessionBeanMetaData enterpriseBean) throws ClassNotFoundException { String localJndiName = enterpriseBean.getLocalJndiName(); if (localJndiName != null) { LocalBindingImpl localBinding = new LocalBindingImpl(localJndiName); addClassAnnotation(container, LocalBinding.class, localBinding); } String localHomeJndiName = enterpriseBean.getLocalHomeJndiName(); if (localHomeJndiName != null) { LocalHomeBindingImpl localHomeBinding = new LocalHomeBindingImpl(localHomeJndiName); addClassAnnotation(container, LocalHomeBinding.class, localHomeBinding); } }
public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType) { JBossEnterpriseBeanMetaData beanMetaData = getBeanMetaData(); if (beanMetaData == null) return null; if (annotationType == SecurityDomain.class) { String securityDomain = beanMetaData.getSecurityDomain(); if (securityDomain != null) return new SimpleAnnotationItem(new SecurityDomainImpl(securityDomain)); } return null; }
private void addInitAnnotations(EJBContainer container, InitMethodsMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null) { for (InitMethodMetaData initMethod : list) { NamedMethodMetaData method = initMethod.getBeanMethod(); InitImpl annotation = new InitImpl(); addAnnotations(Init.class, annotation, container, method); } } }
private void addServiceAnnotations(EJBContainer container, JBossServiceBeanMetaData service) throws ClassNotFoundException { if (service == null) return; String management = service.getManagement(); if (management != null) { ManagementImpl annotation = new ManagementImpl(di.getClassLoader().loadClass(management)); addClassAnnotation(container, Management.class, annotation); } }
private void addRemoveAnnotations(EJBContainer container, RemoveMethodsMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null) { for (RemoveMethodMetaData removeMethod : list) { NamedMethodMetaData method = removeMethod.getBeanMethod(); RemoveImpl annotation = new RemoveImpl(removeMethod.isRetainIfException()); addAnnotations(Remove.class, annotation, container, method); } } }
private RemoteBinding initializeRemoteBinding(RemoteBinding binding) { if(binding.jndiBinding().length() == 0) { return new RemoteBindingImpl(ProxyFactoryHelper.getDefaultRemoteBusinessJndiName(container), binding .interceptorStack(), binding.clientBindUrl(), ""); } return binding; }
private void addExcludeAnnotations(EJBContainer container, ExcludeListMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null && list.getMethods() != null) { for(MethodMetaData method : list.getMethods()) { if (method.getEjbName().equals(ejbName)) { DenyAllImpl annotation = new DenyAllImpl(); addAnnotations(DenyAll.class, annotation, container, method); } } } }
public void initializeLocalBindingMetadata() { localBinding = container.getAnnotation(LocalBinding.class); if (localBinding == null) { if (ProxyFactoryHelper.getLocalAndBusinessLocalInterfaces(container).length > 0) { localBinding = new LocalBindingImpl(ProxyFactoryHelper.getLocalJndiName(container)); container.getAnnotations().addClassAnnotation(LocalBinding.class, localBinding); } } }
public Object createProxyBusiness() { Class[] interfaces = {producer, ProducerObject.class}; ProducerManagerImpl mImpl = null; mImpl = new ProducerManagerImpl(dest, factory, props.delivery(), props.timeToLive(), props.priority(), methodMap, initialContextProperties, pImpl.transacted(), pImpl.acknowledgeMode()); Interceptor[] interceptors = {mImpl}; ProducerProxy ih = new ProducerProxy(mImpl, interceptors); return java.lang.reflect.Proxy.newProxyInstance(producer.getClassLoader(), interfaces, ih); }
public RemoteProducerFactory(ConsumerContainer container, Class producer, MessageProperties props, Destination dest, InitialContext ctx, Hashtable initialContextProperties) { super(container, producer, props, dest, ctx, initialContextProperties); try { String factoryName = pImpl.connectionFactory(); if (factoryName.equals("")) factoryName = "ConnectionFactory"; factory = (ConnectionFactory) ctx.lookup(factoryName); } catch (Exception e) { throw new RuntimeException(e); } }