Package org.jboss.ejb

Examples of org.jboss.ejb.EntityContainer$ContainerInterceptor


 
   public Object invokeHome(Invocation mi)
      throws Exception
   {
      // Get context
      EntityContainer ec = (EntityContainer) getContainer();
      EntityEnterpriseContext ctx = (EntityEnterpriseContext) ec.getInstancePool().get();

    // Pass it to the method invocation
      mi.setEnterpriseContext(ctx);

      // Give it the transaction
      ctx.setTransaction(mi.getTransaction());

      // Set the current security information
      ctx.setPrincipal(mi.getPrincipal());

      AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);

      Object result;
      try
      {
         // Invoke through interceptors
         result = getNext().invokeHome(mi);
      }
      finally
      {
         AllowedOperationsAssociation.popInMethodFlag();
      }
     
      // No id, means we can put the context back in the pool
      if (ctx.getId() == null)
      {
         ctx.setTransaction(null);
         ec.getInstancePool().free(ctx);
      }
     
      // We are done
      return result;
   }
View Full Code Here


      // The key
      Object key = mi.getId();

      EntityEnterpriseContext ctx = null;
      EntityContainer ec = (EntityContainer) container;
      if (mi.getTransaction() != null)
      {
         //ctx = ec.getTxEntityMap().getCtx(mi.getTransaction(), key);
      }
      if (ctx == null)
      {
         InstancePool pool = ec.getInstancePool();
         try
         {
            ctx = (EntityEnterpriseContext) pool.get();
         }
         catch (EJBException e)
         {
            throw e;
         }
         catch (RemoteException e)
         {
            throw e;
         }
         catch (Exception e)
         {
            InvocationType type = mi.getType();
            boolean isLocal = (type == InvocationType.LOCAL || type == InvocationType.LOCALHOME);
            if (isLocal)
               throw new EJBException("Unable to get an instance from the pool", e);
            else
               throw new RemoteException("Unable to get an intance from the pool", e);
         }
         ctx.setCacheKey(key);
         ctx.setId(key);
         EntityPersistenceManager pm = ec.getPersistenceManager();
         pm.activateEntity(ctx);
      }

      boolean trace = log.isTraceEnabled();
      if( trace ) log.trace("Begin invoke, key="+key);
View Full Code Here

   {
      boolean trace = log.isTraceEnabled();
      if(trace)
         log.trace("register, ctx=" + ctx + ", tx=" + tx);

      EntityContainer ctxContainer = null;
      try
      {
         ctxContainer = (EntityContainer)ctx.getContainer();
         if(!ctx.hasTxSynchronization())
         {
            // Create a new synchronization
            Synchronization synch = createSynchronization(tx, ctx);

            // We want to be notified when the transaction commits
            tx.registerSynchronization(synch);

            ctx.hasTxSynchronization(true);
         }
         //mark it dirty in global tx entity map if it is not read only
         if(!ctxContainer.isReadOnly())
         {
            ctx.getTxAssociation().scheduleSync(tx, ctx);
         }
      }
      catch(RollbackException e)
View Full Code Here

   private final Map selectorMap;

   public InstanceFactory(JDBCStoreManager2 manager, JDBCEntityBridge2 entity)
      throws Exception
   {
      EntityContainer theContainer = manager.getContainer();
      beanClass = theContainer.getBeanClass();
      fieldMap = createFieldMap(entity);
      selectorMap = createSelectorMap(entity, manager.getQueryFactory());
      // use proxy generator to create one implementation
      EntityBridgeInvocationHandler handler = new EntityBridgeInvocationHandler(fieldMap, selectorMap, beanClass);
      Class[] classes = new Class[]{beanClass};
View Full Code Here

   private final Map selectorMap;

   public JDBCCreateBeanClassInstanceCommand(JDBCStoreManager manager)
      throws Exception
   {
      EntityContainer theContainer = manager.getContainer();
      entityBridge = (JDBCEntityBridge) manager.getEntityBridge();
      beanClass = theContainer.getBeanClass();
      fieldMap = createFieldMap();
      selectorMap = createSelectorMap();
      // use proxy generator to create one implementation
      EntityBridgeInvocationHandler handler = new EntityBridgeInvocationHandler(fieldMap, selectorMap, beanClass);
      Class[] classes = new Class[]{beanClass};
View Full Code Here

/* 295 */       this.log.debug("Remove: Rows affected = " + rowsAffected);
/*     */   }
/*     */
/*     */   public void invokeRemoveRelated(Object relatedId) throws RemoveException, RemoteException
/*     */   {
/* 300 */     EntityContainer container = this.relatedManager.getContainer();
/*     */
/* 333 */     if (container.getLocalProxyFactory() != null)
/*     */     {
/* 335 */       EJBLocalObject ejbObject = container.getLocalProxyFactory().getEntityEJBLocalObject(relatedId);
/* 336 */       ejbObject.remove();
/*     */     }
/*     */     else
/*     */     {
/* 340 */       EJBObject ejbObject = (EJBObject)container.getProxyFactory().getEntityEJBObject(relatedId);
/* 341 */       ejbObject.remove();
/*     */     }
/*     */   }
View Full Code Here

/* 170 */       leftJoinCMRList = Collections.EMPTY_LIST;
/*     */     }
/*     */
/* 174 */     setParameterList(compiler.getInputParameters());
/*     */
/* 176 */     EntityContainer con = ((JDBCStoreManager)compiler.getStoreManager()).getContainer();
/* 177 */     factory = (this.metadata.isResultTypeMappingLocal()) && (con.getLocalHomeClass() != null) ? con.getLocalProxyFactory() : con.getProxyFactory();
/*     */
/* 180 */     return execute(compiler.getSQL(), parameters, offset, limit, selectEntity, selectField, selectFunction, (JDBCStoreManager)compiler.getStoreManager(), mask, compiler.getInputParameters(), leftJoinCMRList, this.metadata, factory, this.log);
/*     */   }
View Full Code Here

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

/*  300 */       throw new DeploymentException(message);
/*      */     }
/*      */
/*  304 */     this.relatedManager = ((JDBCStoreManager)this.relatedEntity.getManager());
/*      */
/*  307 */     EntityContainer relatedContainer = this.relatedManager.getContainer();
/*  308 */     this.relatedContainerRef = new WeakReference(relatedContainer);
/*      */
/*  311 */     Class homeClass = relatedContainer.getLocalHomeClass() != null ? relatedContainer.getLocalHomeClass() : relatedContainer.getHomeClass();
/*      */     try
/*      */     {
/*  315 */       this.relatedFindByPrimaryKey = homeClass.getMethod("findByPrimaryKey", new Class[] { this.relatedEntity.getPrimaryKeyClass() });
/*      */     }
/*      */     catch (Exception e)
View Full Code Here

/*      */   }
/*      */
/*      */   public EJBLocalObject getRelatedEntityByFK(Object fk)
/*      */   {
/*  779 */     EJBLocalObject relatedLocalObject = null;
/*  780 */     EntityContainer relatedContainer = getRelatedContainer();
/*      */
/*  782 */     if ((this.hasFKFieldsMappedToCMPFields) && (this.relatedManager.getReadAheadCache().getPreloadDataMap(fk, false) == null))
/*      */     {
/*  786 */       EJBLocalHome relatedHome = relatedContainer.getLocalProxyFactory().getEJBLocalHome();
/*      */       try
/*      */       {
/*  789 */         relatedLocalObject = (EJBLocalObject)this.relatedFindByPrimaryKey.invoke(relatedHome, new Object[] { fk });
/*      */       }
/*      */       catch (Exception ignore)
/*      */       {
/*      */       }
/*      */
/*      */     }
/*      */     else
/*      */     {
/*  798 */       relatedLocalObject = relatedContainer.getLocalProxyFactory().getEntityEJBLocalObject(fk);
/*      */     }
/*      */
/*  801 */     return relatedLocalObject;
/*      */   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb.EntityContainer$ContainerInterceptor

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.