/** * Create a new ConfigurationMetaData. * * @param delegate the delegate * @return the metadata * @throws IllegalArgumentException for a null delegate or an unknown delegate */ public static ConfigurationMetaData create(ContainerConfigurationMetaData delegate) { if (delegate == null) throw new IllegalArgumentException("Null delegate"); return new ConfigurationMetaData(delegate); }
/** * Get the instance pool * * @return the data or null if there isn't one */ public String getInstancePool() { return getDelegate().getInstancePool(); }
public void create() throws Exception { try { ConfigurationMetaData configuration = container.getBeanMetaData().getContainerConfiguration(); commitOption = configuration.getCommitOption(); optionDRefreshRate = configuration.getOptionDRefreshRate(); } catch(Exception e) { log.warn(e.getMessage()); } }
private static InstancePool createInstancePool(ConfigurationMetaData conf, ClassLoader cl) throws Exception { // Set instance pool InstancePool ip = null; try { ip = (InstancePool) cl.loadClass(conf.getInstancePool()).newInstance(); } catch (Exception e) { throw new DeploymentException("Missing or invalid Instance Pool (in jboss.xml or standardjboss.xml)", e); } if (ip instanceof XmlLoadable) ((XmlLoadable) ip).importXml(conf.getContainerPoolConf()); return ip; }
private static InstanceCache createInstanceCache(ConfigurationMetaData conf, ClassLoader cl) throws Exception { // Set instance cache InstanceCache ic = null; try { ic = (InstanceCache) cl.loadClass(conf.getInstanceCache()).newInstance(); } catch (Exception e) { throw new DeploymentException("Missing or invalid Instance Cache (in jboss.xml or standardjboss.xml)", e); } if (ic instanceof XmlLoadable) ((XmlLoadable) ic).importXml(conf.getContainerCacheConf()); return ic; }
private StatefulSessionContainer createStatefulSessionContainer(SessionMetaData bean, DeploymentUnit unit) throws Exception { // get the container configuration for this bean // a default configuration is now always provided ConfigurationMetaData conf = bean.getContainerConfiguration(); // Create container StatefulSessionContainer container = new StatefulSessionContainer(); int transType = bean.isContainerManagedTx() ? CMT : BMT; initializeContainer(container, conf, bean, transType, unit); if (bean.getHome() != null || bean.getServiceEndpoint() != null) { createProxyFactories(bean, container); } ClassLoader cl = unit.getClassLoader(); container.setInstanceCache(createInstanceCache(conf, cl)); // No real instance pool, use the shadow class StatefulSessionInstancePool ip = new StatefulSessionInstancePool(); ip.importXml(conf.getContainerPoolConf()); container.setInstancePool(ip); // Set persistence manager container.setPersistenceManager((StatefulSessionPersistenceManager) cl.loadClass(conf.getPersistenceManager()) .newInstance()); // Set the bean Lock Manager container.setLockManager(createBeanLockManager(container, false, conf.getLockClass(), cl)); return container; }
private Object findSingleObject(Transaction tx, Method method, Object[] args, EntityEnterpriseContext instance, GenericEntityObjectFactory factory) throws Exception { if(method.getName().equals("findByPrimaryKey")) { if(args[0] == null) throw new IllegalArgumentException("findByPrimaryKey called with null argument."); if(metaData.getContainerConfiguration().getCommitOption() != ConfigurationMetaData.B_COMMIT_OPTION) { Object key = instance.getCacheKey(); if(key == null) { key = ((EntityCache)instanceCache).createCacheKey(args[0]); } if(instanceCache.isActive(key)) { return factory.getEntityEJBObject(key); } } } else if(!metaData.getContainerConfiguration().getSyncOnCommitOnly()) { EntityContainer.synchronizeEntitiesWithinTransaction(tx); } return getPersistenceManager().findEntity(method, args, instance, factory); }
dontFlushCreated = containerConf.isInsertAfterEjbPostCreate(); final Element cacheConf = containerConf.getContainerCacheConf(); final Element cachePolicy = cacheConf == null ? null : MetaData.getOptionalChild(cacheConf, "cache-policy-conf");
String confSecurityDomain = conf.getSecurityDomain(); addInterceptors(container, transType, conf.getContainerInterceptorsConf());
public EJBObject getEJBObject() { AllowedOperationsAssociation.assertAllowedIn("getEJBObject", IN_EJB_CREATE | IN_EJB_REMOVE | IN_EJB_ACTIVATE | IN_EJB_PASSIVATE | IN_BUSINESS_METHOD | IN_AFTER_BEGIN | IN_BEFORE_COMPLETION | IN_AFTER_COMPLETION); if (((StatefulSessionContainer)con).getRemoteClass()==null) throw new IllegalStateException( "No remote interface defined." ); if (ejbObject == null) { EJBProxyFactory proxyFactory = con.getProxyFactory(); if(proxyFactory == null) { String defaultInvokerName = con.getBeanMetaData(). getContainerConfiguration().getDefaultInvokerName(); proxyFactory = con.lookupProxyFactory(defaultInvokerName); } ejbObject = (EJBObject) proxyFactory.getStatefulSessionEJBObject(id); } return ejbObject; }
public void create() throws Exception { super.start(); BeanMetaData md = getContainer().getBeanMetaData(); ejbName = md.getEjbName(); // Should we log call details callLogging = md.getContainerConfiguration().getCallLogging(); }
public void start() throws Exception { super.start(); log.debug("Starting InvalidableEntityInstanceCache..."); EntityMetaData emd = ((EntityMetaData) this.getContainer().getBeanMetaData()); boolean participateInDistInvalidations = emd.doDistributedCacheInvalidations(); byte co = emd.getContainerConfiguration().getCommitOption(); if (participateInDistInvalidations && (co == ConfigurationMetaData.A_COMMIT_OPTION || co == ConfigurationMetaData.D_COMMIT_OPTION) ) { // we are interested in receiving cache invalidation callbacks // String groupName = emd.getDistributedCacheInvalidationConfig().getInvalidationGroupName(); String imName = emd.getDistributedCacheInvalidationConfig().getInvalidationManagerName(); this.invalMgr = (InvalidationManagerMBean) Registry.lookup(imName); this.ig = this.invalMgr.getInvalidationGroup(groupName); this.ig.register(this); this.isTraceEnabled = log.isTraceEnabled(); } }
public EJBObject getEJBObject() { AllowedOperationsAssociation.assertAllowedIn("getEJBObject", IN_EJB_CREATE | IN_EJB_REMOVE | IN_BUSINESS_METHOD | IN_EJB_TIMEOUT | IN_SERVICE_ENDPOINT_METHOD); if (((StatelessSessionContainer)con).getProxyFactory()==null) throw new IllegalStateException( "No remote interface defined." ); if (ejbObject == null) { EJBProxyFactory proxyFactory = con.getProxyFactory(); if(proxyFactory == null) { String defaultInvokerName = con.getBeanMetaData(). getContainerConfiguration().getDefaultInvokerName(); proxyFactory = con.lookupProxyFactory(defaultInvokerName); } ejbObject = (EJBObject) proxyFactory.getStatelessSessionEJBObject(); } return ejbObject; }
/** * Get the persistence manager * * @return the data or null if there isn't one */ public String getPersistenceManager() { return getDelegate().getPersistenceManager(); }
/** * Create a new ConfigurationMetaData. * * @param delegate the delegate * @return the metadata * @throws IllegalArgumentException for a null delegate or an unknown delegate */ public static ConfigurationMetaData create(ContainerConfigurationMetaData delegate) { if (delegate == null) throw new IllegalArgumentException("Null delegate"); return new ConfigurationMetaData(delegate); }
public EJBObject getEJBObject() { AllowedOperationsAssociation.assertAllowedIn("getEJBObject", IN_EJB_POST_CREATE | IN_EJB_REMOVE | IN_EJB_ACTIVATE | IN_EJB_PASSIVATE | IN_EJB_LOAD | IN_EJB_STORE | IN_BUSINESS_METHOD | IN_EJB_TIMEOUT); if(((EntityContainer)con).getRemoteClass() == null) { throw new IllegalStateException( "No remote interface defined." ); } if (ejbObject == null) { // Create a new CacheKey Object cacheKey = ((EntityCache)((EntityContainer)con).getInstanceCache()).createCacheKey(id); EJBProxyFactory proxyFactory = con.getProxyFactory(); if(proxyFactory == null) { String defaultInvokerName = con.getBeanMetaData(). getContainerConfiguration().getDefaultInvokerName(); proxyFactory = con.lookupProxyFactory(defaultInvokerName); } ejbObject = (EJBObject)proxyFactory.getEntityEJBObject(cacheKey); } return ejbObject; }
/** * Get whether call logging is enabled * * @return true for enabled */ public boolean getCallLogging() { return getDelegate().isCallLogging(); }
/** * Get the container configuration * * @return the configuration * @throws IllegalStateException when the configuration could not be determined */ public ConfigurationMetaData getContainerConfiguration() { ContainerConfigurationMetaData containerConfigurationMetaData = getDelegate().determineContainerConfiguration(); return new ConfigurationMetaData(containerConfigurationMetaData); }
/** * Get whether store not flushed is enabled * * @return true for enabled */ public boolean isStoreNotFlushed() { return getDelegate().isStoreNotFlushed(); }
/** * Get the container configuration * * @return the configuration * @throws IllegalStateException when the configuration could not be determined */ public ConfigurationMetaData getContainerConfiguration() { ContainerConfigurationMetaData containerConfigurationMetaData = getDelegate().determineContainerConfiguration(); return new ConfigurationMetaData(containerConfigurationMetaData); }