Package org.jboss.ejb

Examples of org.jboss.ejb.EntityContainer


/*      */
/*      */   private Transaction getTransaction()
/*      */   {
/*      */     try
/*      */     {
/* 1822 */       EntityContainer container = getJDBCStoreManager().getContainer();
/* 1823 */       TransactionManager tm = container.getTransactionManager();
/* 1824 */       return tm.getTransaction();
/*      */     }
/*      */     catch (SystemException e) {
/*      */     }
/* 1828 */     throw new EJBException("Error getting transaction from the transaction manager", e);
View Full Code Here


/* 2042 */         return this.relationSet;
/*      */       }
/*      */
/*      */       try
/*      */       {
/* 2049 */         EntityContainer container = JDBCCMRFieldBridge.this.getJDBCStoreManager().getContainer();
/* 2050 */         TransactionManager tm = container.getTransactionManager();
/* 2051 */         Transaction tx = tm.getTransaction();
/*      */
/* 2054 */         if ((tx != null) && ((tx.getStatus() == 0) || (tx.getStatus() == 7)))
/*      */         {
/* 2057 */           this.relationSet = new RelationSet(JDBCCMRFieldBridge.this, this.ctx, this.setHandle, false);
View Full Code Here

/*  92 */       this.log.warn("container is null, can't steal persistence manager");
/*  93 */       return;
/*     */     }
/*  95 */     if ((this.container instanceof EntityContainer))
/*     */     {
/*  97 */       EntityContainer ec = (EntityContainer)this.container;
/*     */
/*  99 */       if (ec.getPersistenceManager() == null)
/*     */       {
/* 101 */         this.log.info("no persistence manager in container!");
/* 102 */         return;
/*     */       }
/* 104 */       if (ec.getPersistenceManager() == this)
/*     */       {
/* 106 */         this.log.info(" persistence manager in container already set!");
/* 107 */         return;
/*     */       }
/* 109 */       this.pm = ec.getPersistenceManager();
/* 110 */       ec.setPersistenceManager(this);
/*     */     }
/*     */
/* 114 */     BeanMetaData bmd = this.container.getBeanMetaData();
/* 115 */     ApplicationMetaData appMetaData = bmd.getApplicationMetaData();
/*     */
View Full Code Here

/*     */   public JDBCSelectorBridge(JDBCStoreManager manager, JDBCQueryMetaData queryMetaData)
/*     */   {
/*  63 */     this.queryMetaData = queryMetaData;
/*  64 */     this.manager = manager;
/*     */
/*  66 */     EntityContainer container = manager.getContainer();
/*  67 */     this.tm = container.getTransactionManager();
/*  68 */     this.syncBeforeSelect = (!container.getBeanMetaData().getContainerConfiguration().getSyncOnCommitOnly());
/*     */   }
View Full Code Here

/*     */   public Object execute(Object[] args) throws FinderException {
/* 106 */     Method method = getMethod();
/*     */     Collection retVal;
/*     */     try {
/* 109 */       JDBCQueryCommand query = this.manager.getQueryManager().getQueryCommand(method);
/* 110 */       EntityContainer selectedContainer = query.getSelectManager().getContainer();
/*     */       GenericEntityObjectFactory factory;
/*     */       GenericEntityObjectFactory factory;
/* 112 */       if ((this.queryMetaData.isResultTypeMappingLocal()) && (selectedContainer.getLocalHomeClass() != null))
/*     */       {
/* 114 */         factory = selectedContainer.getLocalProxyFactory();
/*     */       }
/*     */       else
/*     */       {
/* 118 */         factory = selectedContainer.getProxyFactory();
/*     */       }
/*     */
/* 121 */       retVal = query.execute(method, args, null, factory);
/*     */     }
/*     */     catch (FinderException e)
View Full Code Here

/*     */   private final Map selectorMap;
/*     */
/*     */   public InstanceFactory(JDBCStoreManager2 manager, JDBCEntityBridge2 entity)
/*     */     throws Exception
/*     */   {
/*  61 */     EntityContainer theContainer = manager.getContainer();
/*  62 */     this.beanClass = theContainer.getBeanClass();
/*  63 */     this.fieldMap = createFieldMap(entity);
/*  64 */     this.selectorMap = createSelectorMap(entity, manager.getQueryFactory());
/*     */
/*  66 */     EntityBridgeInvocationHandler handler = new EntityBridgeInvocationHandler(this.fieldMap, this.selectorMap, this.beanClass);
/*  67 */     Class[] classes = { this.beanClass };
View Full Code Here

/*     */   protected static final Method ejbTimeout;
/*     */
/*     */   public Object invokeHome(Invocation mi)
/*     */     throws Exception
/*     */   {
/*  89 */     EntityContainer ec = (EntityContainer)getContainer();
/*  90 */     EntityEnterpriseContext ctx = (EntityEnterpriseContext)ec.getInstancePool().get();
/*     */
/*  93 */     mi.setEnterpriseContext(ctx);
/*     */
/*  96 */     ctx.setTransaction(mi.getTransaction());
/*     */
/*  99 */     ctx.setPrincipal(mi.getPrincipal());
/*     */
/* 101 */     AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);
/*     */     Object result;
/*     */     try
/*     */     {
/* 107 */       result = getNext().invokeHome(mi);
/*     */     }
/*     */     finally
/*     */     {
/* 111 */       AllowedOperationsAssociation.popInMethodFlag();
/*     */     }
/*     */
/* 115 */     if (ctx.getId() == null)
/*     */     {
/* 117 */       ctx.setTransaction(null);
/* 118 */       ec.getInstancePool().free(ctx);
/*     */     }
/*     */
/* 122 */     return result;
/*     */   }
View Full Code Here

/*     */     throws Exception
/*     */   {
/* 130 */     Object key = mi.getId();
/*     */
/* 132 */     EntityEnterpriseContext ctx = null;
/* 133 */     EntityContainer ec = (EntityContainer)this.container;
/*     */     InvocationType type;
/* 134 */     if ((mi.getTransaction() == null) ||
/* 138 */       (ctx == null))
/*     */     {
/* 140 */       InstancePool pool = ec.getInstancePool();
/*     */       try
/*     */       {
/* 143 */         ctx = (EntityEnterpriseContext)pool.get();
/*     */       }
/*     */       catch (EJBException e)
/*     */       {
/* 147 */         throw e;
/*     */       }
/*     */       catch (RemoteException e)
/*     */       {
/* 151 */         throw e;
/*     */       }
/*     */       catch (Exception e)
/*     */       {
/* 155 */         type = mi.getType();
/* 156 */         boolean isLocal = (type == InvocationType.LOCAL) || (type == InvocationType.LOCALHOME);
/* 157 */         if (isLocal) {
/* 158 */           throw new EJBException("Unable to get an instance from the pool", e);
/*     */         }
/* 160 */         throw new RemoteException("Unable to get an intance from the pool", e);
/*     */       }
/* 162 */       ctx.setCacheKey(key);
/* 163 */       ctx.setId(key);
/* 164 */       EntityPersistenceManager pm = ec.getPersistenceManager();
/* 165 */       pm.activateEntity(ctx);
/*     */     }
/*     */
/* 168 */     boolean trace = this.log.isTraceEnabled();
/* 169 */     if (trace) this.log.trace("Begin invoke, key=" + key);
View Full Code Here

/*     */   {
/* 146 */     boolean trace = this.log.isTraceEnabled();
/* 147 */     if (trace) {
/* 148 */       this.log.trace("register, ctx=" + ctx + ", tx=" + tx);
/*     */     }
/* 150 */     EntityContainer ctxContainer = null;
/*     */     try
/*     */     {
/* 153 */       ctxContainer = (EntityContainer)ctx.getContainer();
/* 154 */       if (!ctx.hasTxSynchronization())
/*     */       {
/* 157 */         Synchronization synch = createSynchronization(tx, ctx);
/*     */
/* 160 */         tx.registerSynchronization(synch);
/*     */
/* 162 */         ctx.hasTxSynchronization(true);
/*     */       }
/*     */
/* 165 */       if (!ctxContainer.isReadOnly())
/*     */       {
/* 167 */         ctx.getTxAssociation().scheduleSync(tx, ctx);
/*     */       }
/*     */
/*     */     }
View Full Code Here

/*     */   }
/*     */
/*     */   public Object invokeHome(Invocation mi)
/*     */     throws Exception
/*     */   {
/* 113 */     EntityContainer container = (EntityContainer)getContainer();
/* 114 */     EntityEnterpriseContext ctx = (EntityEnterpriseContext)container.getInstancePool().get();
/* 115 */     ctx.setTxAssociation(GlobalTxEntityMap.NOT_READY);
/* 116 */     InstancePool pool = container.getInstancePool();
/*     */
/* 119 */     mi.setEnterpriseContext(ctx);
/*     */
/* 122 */     ctx.setTransaction(mi.getTransaction());
/*     */
/* 124 */     ctx.setSecurityContext(mi.getSecurityContext());
/*     */
/* 126 */     ctx.setPrincipal(mi.getPrincipal());
/*     */
/* 128 */     AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);
/*     */
/* 132 */     Object obj = null;
/* 133 */     Exception exception = null;
/*     */     try
/*     */     {
/* 137 */       obj = getNext().invokeHome(mi);
/*     */
/* 140 */       if (ctx.getId() != null)
/*     */       {
/* 142 */         BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
/* 143 */         lock.sync();
/*     */         try
/*     */         {
/* 149 */           cache = container.getInstanceCache();
/* 150 */           cache.remove(ctx.getCacheKey());
/*     */
/* 154 */           cache.insert(ctx);
/*     */         }
/*     */         finally
/*     */         {
/* 158 */           lock.releaseSync();
/* 159 */           container.getLockManager().removeLockRef(ctx.getCacheKey());
/*     */         }
/*     */
/* 163 */         InstanceCache cache = obj;
/*     */         return cache;
/*     */       }
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 168 */       exception = e;
/*     */     }
/*     */     finally
/*     */     {
/* 172 */       AllowedOperationsAssociation.popInMethodFlag();
/*     */     }
/*     */
/* 175 */     ctx.setTransaction(null);
/*     */
/* 177 */     mi.setEnterpriseContext(null);
/*     */
/* 181 */     if (exception == null)
/*     */     {
/* 183 */       container.getInstancePool().free(ctx);
/* 184 */       return obj;
/*     */     }
/*     */
/* 187 */     if ((exception instanceof RuntimeException))
/*     */     {
View Full Code Here

TOP

Related Classes of org.jboss.ejb.EntityContainer

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.