Package org.jboss.metadata

Examples of org.jboss.metadata.EntityMetaData


/* 177 */       isStatelessSession = smd.isStateless();
/*     */     }
/* 179 */     Class pkClass = null;
/* 180 */     if (!isSession)
/*     */     {
/* 182 */       EntityMetaData metaData = (EntityMetaData)bmd;
/* 183 */       String pkClassName = metaData.getPrimaryKeyClass();
/*     */       try
/*     */       {
/* 186 */         if (pkClassName != null)
/*     */         {
/* 188 */           pkClass = this.container.getClassLoader().loadClass(pkClassName);
/*     */         }
/*     */         else
/*     */         {
/* 192 */           pkClass = this.container.getClassLoader().loadClass(metaData.getEjbClass()).getField(metaData.getPrimKeyField()).getClass();
/*     */         }
/*     */
/*     */       }
/*     */       catch (NoSuchFieldException e)
/*     */       {
View Full Code Here


/*     */
/* 498 */     if ((this.container.getBeanMetaData() instanceof EntityMetaData))
/*     */     {
/* 501 */       this.beanServantRegistry = this.servantRegistries.getServantRegistry(registryWithPersistentPOA);
/*     */
/* 505 */       EntityMetaData metaData = (EntityMetaData)this.container.getBeanMetaData();
/* 506 */       String pkClassName = metaData.getPrimaryKeyClass();
/*     */       Class pkClass;
/*     */       try
/*     */       {
/*     */         Class pkClass;
/* 508 */         if (pkClassName != null)
/* 509 */           pkClass = this.container.getClassLoader().loadClass(pkClassName);
/*     */         else {
/* 511 */           pkClass = this.container.getClassLoader().loadClass(metaData.getEjbClass()).getField(metaData.getPrimKeyField()).getClass();
/*     */         }
/*     */       }
/*     */       catch (NoSuchFieldException e)
/*     */       {
/* 516 */         this.logger.error("Unable to identify Bean's Primary Key class! Did you specify a primary key class and/or field? Does that field exist?");
View Full Code Here

/*     */     {
/* 135 */       BeanMetaData bean = (BeanMetaData)beans.next();
/*     */
/* 138 */       if (bean.isEntity())
/*     */       {
/* 140 */         EntityMetaData entity = (EntityMetaData)bean;
/*     */         Class pm;
/*     */         try
/*     */         {
/* 146 */           pm = classLoader.loadClass(entity.getContainerConfiguration().getPersistenceManager());
/*     */         }
/*     */         catch (ClassNotFoundException e)
/*     */         {
/* 150 */           throw new DeploymentException("Unable to load persistence manager", e);
/*     */         }
/* 152 */         if ((entity.isCMP()) && ((JDBC_PM.isAssignableFrom(pm)) || (pm.getName().equals("org.jboss.ejb.plugins.cmp.jdbc2.JDBCStoreManager2"))))
/*     */         {
/* 155 */           JDBCEntityMetaData jdbcEntity = new JDBCEntityMetaData(this, entity);
/*     */
/* 157 */           this.entities.put(entity.getEjbName(), jdbcEntity);
/*     */
/* 159 */           String schemaName = jdbcEntity.getAbstractSchemaName();
/* 160 */           if (schemaName != null)
/*     */           {
/* 162 */             this.entitiesByAbstractSchemaName.put(schemaName, jdbcEntity);
/*     */           }
/*     */
/* 165 */           Class remote = jdbcEntity.getRemoteClass();
/* 166 */           if (remote != null)
/*     */           {
/* 168 */             this.entitiesByInterface.put(remote, jdbcEntity);
/*     */           }
/*     */
/* 171 */           Class local = jdbcEntity.getLocalClass();
/* 172 */           if (local != null)
/*     */           {
/* 174 */             this.entitiesByInterface.put(local, jdbcEntity);
/*     */           }
/*     */
/* 178 */           this.entityRoles.put(entity.getEjbName(), new HashSet());
/*     */         }
/*     */       }
/*     */
/*     */     }
/*     */
View Full Code Here

/*     */     {
/* 152 */       BeanMetaData bean = (BeanMetaData)beans.next();
/*     */
/* 154 */       if (bean.isEntity())
/*     */       {
/* 156 */         EntityMetaData entityBean = (EntityMetaData)bean;
/* 157 */         if ((metaData.isEJB2x()) && (entityBean.isCMP1x()))
/*     */         {
/* 162 */           boolean storedSuccess = this.success;
/*     */
/* 164 */           this.verifier.checkEntity(entityBean);
/*     */
/* 166 */           if (this.success != storedSuccess)
/*     */           {
/* 168 */             log.warn("The CMP 1.x EJB '" + entityBean.getEjbName() + "' generated some verification warnings. The Deployer " + "will ignore these warnings but you should check " + "your EJB to be on the safe side of things.");
/*     */           }
/*     */
/* 174 */           this.success = storedSuccess;
/*     */         }
/*     */         else
View Full Code Here

/*     */   public boolean invalidateRelated;
/*     */
/*     */   public void start()
/*     */     throws Exception
/*     */   {
/*  50 */     EntityMetaData emd = (EntityMetaData)getContainer().getBeanMetaData();
/*  51 */     this.doCacheInvalidations = emd.doDistributedCacheInvalidations();
/*     */
/*  53 */     if (this.doCacheInvalidations)
/*     */     {
/*  57 */       String groupName = emd.getDistributedCacheInvalidationConfig().getInvalidationGroupName();
/*  58 */       String imName = emd.getDistributedCacheInvalidationConfig().getInvalidationManagerName();
/*     */
/*  60 */       this.invalMgr = ((InvalidationManagerMBean)Registry.lookup(imName));
/*  61 */       this.ig = this.invalMgr.getInvalidationGroup(groupName);
/*     */     }
/*     */   }
View Full Code Here

/*  132 */     this.log = Logger.getLogger(getClass().getName() + "." + this.tableName);
/*      */
/*  134 */     this.schema = schema;
/*  135 */     this.tableId = tableId;
/*      */
/*  137 */     EntityMetaData entityMetaData = (EntityMetaData)entity.getContainer().getBeanMetaData();
/*  138 */     ConfigurationMetaData containerConf = entityMetaData.getContainerConfiguration();
/*  139 */     this.dontFlushCreated = containerConf.isInsertAfterEjbPostCreate();
/*      */
/*  142 */     Element cacheConf = containerConf.getContainerCacheConf();
/*  143 */     Element cachePolicy = cacheConf == null ? null : MetaData.getOptionalChild(cacheConf, "cache-policy-conf");
/*      */     int maxCapacity;
/*      */     int minCapacity;
/*      */     int maxCapacity;
/*  147 */     if (cachePolicy != null)
/*      */     {
/*  149 */       String str = MetaData.getOptionalChildContent(cachePolicy, "min-capacity");
/*  150 */       int minCapacity = str == null ? 1000 : Integer.parseInt(str);
/*  151 */       str = MetaData.getOptionalChildContent(cachePolicy, "max-capacity");
/*  152 */       maxCapacity = str == null ? 10000 : Integer.parseInt(str);
/*      */     }
/*      */     else
/*      */     {
/*  156 */       minCapacity = 1000;
/*  157 */       maxCapacity = 10000;
/*      */     }
/*      */
/*  160 */     Element otherConf = cacheConf == null ? null : MetaData.getOptionalChild(cacheConf, "cache-policy-conf-other");
/*      */     boolean invalidable;
/*      */     int partitionsTotal;
/*      */     Element batchCommitStrategy;
/*      */     boolean invalidable;
/*  165 */     if (otherConf != null)
/*      */     {
/*  167 */       String str = MetaData.getOptionalChildContent(otherConf, "partitions");
/*  168 */       int partitionsTotal = str == null ? 10 : Integer.parseInt(str);
/*  169 */       Element batchCommitStrategy = MetaData.getOptionalChild(otherConf, "batch-commit-strategy");
/*  170 */       invalidable = MetaData.getOptionalChild(otherConf, "invalidable") != null;
/*      */     }
/*      */     else
/*      */     {
/*  174 */       partitionsTotal = 10;
/*  175 */       batchCommitStrategy = null;
/*  176 */       invalidable = false;
/*      */     }
/*      */
/*  179 */     if (cachePolicy != null)
/*      */     {
/*  181 */       this.cache = new PartitionedTableCache(minCapacity, maxCapacity, partitionsTotal);
/*      */
/*  183 */       String periodStr = MetaData.getOptionalChildContent(cachePolicy, "overager-period");
/*  184 */       String maxAgeStr = MetaData.getOptionalChildContent(cachePolicy, "max-bean-age");
/*  185 */       if (((periodStr != null) && (maxAgeStr == null)) || ((maxAgeStr != null) && (periodStr == null)))
/*      */       {
/*  187 */         throw new DeploymentException("Failed to initialize age-out thread for entity " + entity.getEntityName() + ": overager-period or max-bean-age is missing!");
/*      */       }
/*      */
/*  191 */       if ((periodStr != null) && (maxAgeStr != null))
/*      */       {
/*  193 */         long period = Long.parseLong(periodStr);
/*  194 */         long maxAge = Long.parseLong(maxAgeStr);
/*  195 */         ((PartitionedTableCache)this.cache).initOverager(period, maxAge, entity.getEntityName() + " overager");
/*      */
/*  197 */         if (this.log.isTraceEnabled())
/*      */         {
/*  199 */           this.log.trace("initialized age-out thread for " + entity.getEntityName() + ": overager-period=" + period + ", max-bean-age=" + maxAge);
/*      */         }
/*      */
/*      */       }
/*      */
/*  204 */       MBeanServer server = MBeanServerLocator.locateJBoss();
/*  205 */       this.serviceController = ((ServiceControllerMBean)MBeanProxyExt.create(ServiceControllerMBean.class, ServiceControllerMBean.OBJECT_NAME, server));
/*      */       try
/*      */       {
/*  211 */         this.cacheName = new ObjectName("jboss.cmp:service=tablecache,ejbname=" + metadata.getName() + ",table=" + this.tableName);
/*      */
/*  213 */         server.registerMBean(this.cache, this.cacheName);
/*  214 */         this.serviceController.create(this.cacheName);
/*      */       }
/*      */       catch (Exception e)
/*      */       {
/*  218 */         throw new DeploymentException("Failed to register table cache for " + this.tableName, e);
/*      */       }
/*      */     }
/*      */     else
/*      */     {
/*  223 */       this.cache = Cache.NONE;
/*      */     }
/*      */
/*  226 */     if (invalidable)
/*      */     {
/*  228 */       String groupName = entityMetaData.getDistributedCacheInvalidationConfig().getInvalidationGroupName();
/*  229 */       String imName = entityMetaData.getDistributedCacheInvalidationConfig().getInvalidationManagerName();
/*      */
/*  231 */       InvalidationManagerMBean im = (InvalidationManagerMBean)Registry.lookup(imName);
/*  232 */       InvalidationGroup invalidationGroup = im.getInvalidationGroup(groupName);
/*      */
/*  234 */       this.cacheInvalidator = new CacheInvalidator(this.cache, entity.getContainer().getTransactionManager(), invalidationGroup);
View Full Code Here

/*     */   public void initEntity(EntityEnterpriseContext ctx)
/*     */   {
/* 276 */     Object instance = ctx.getInstance();
/* 277 */     Class ejbClass = instance.getClass();
/*     */
/* 281 */     EntityMetaData metaData = (EntityMetaData)this.con.getBeanMetaData();
/* 282 */     Iterator i = metaData.getCMPFields();
/*     */
/* 284 */     while (i.hasNext())
/*     */     {
/*     */       try
/*     */       {
View Full Code Here

/*     */   public void initEntity(EntityEnterpriseContext ctx)
/*     */   {
/* 159 */     Object instance = ctx.getInstance();
/* 160 */     Class ejbClass = instance.getClass();
/*     */
/* 164 */     EntityMetaData metaData = (EntityMetaData)this.con.getBeanMetaData();
/* 165 */     Iterator i = metaData.getCMPFields();
/*     */
/* 167 */     while (i.hasNext())
/*     */     {
/*     */       try
/*     */       {
View Full Code Here

/*     */   }
/*     */
/*     */   public void remove(String id)
/*     */     throws Exception
/*     */   {
/*  87 */     EntityMetaData metaData = (EntityMetaData)this.m_container.getBeanMetaData();
/*  88 */     String primKeyClass = metaData.getPrimaryKeyClass();
/*  89 */     Object key = PropertyEditors.convertValue(id, primKeyClass);
/*  90 */     remove(key);
/*     */   }
View Full Code Here

/*     */   {
/* 108 */     super.start();
/*     */
/* 110 */     log.debug("Starting InvalidableEntityInstanceCache...");
/*     */
/* 112 */     EntityMetaData emd = (EntityMetaData)getContainer().getBeanMetaData();
/*     */
/* 114 */     boolean participateInDistInvalidations = emd.doDistributedCacheInvalidations();
/* 115 */     byte co = emd.getContainerConfiguration().getCommitOption();
/*     */
/* 117 */     if ((participateInDistInvalidations) && ((co == 0) || (co == 3)))
/*     */     {
/* 123 */       String groupName = emd.getDistributedCacheInvalidationConfig().getInvalidationGroupName();
/* 124 */       String imName = emd.getDistributedCacheInvalidationConfig().getInvalidationManagerName();
/*     */
/* 126 */       this.invalMgr = ((InvalidationManagerMBean)Registry.lookup(imName));
/* 127 */       this.ig = this.invalMgr.getInvalidationGroup(groupName);
/* 128 */       this.ig.register(this);
/* 129 */       this.isTraceEnabled = log.isTraceEnabled();
View Full Code Here

TOP

Related Classes of org.jboss.metadata.EntityMetaData

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.