Examples of EntityContainer


Examples of org.apache.olingo.odata2.api.edm.provider.EntityContainer

    EntitySet entitySet = new EntitySet().setName("Employees");
    entitySets.add(entitySet);
    entitySets.add(entitySet);

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    EntityContainer container =
        new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
    entityContainers.add(container);

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here

Examples of org.apache.olingo.odata2.api.edm.provider.EntityContainer

    List<EntitySet> entitySets = new ArrayList<EntitySet>();
    EntitySet entitySet = new EntitySet().setName("Employees");
    entitySets.add(entitySet);

    List<EntityContainer> entityContainers = new ArrayList<EntityContainer>();
    EntityContainer container =
        new EntityContainer().setDefaultEntityContainer(true).setName("Container").setEntitySets(entitySets);
    entityContainers.add(container);

    EntityContainer container2 =
        new EntityContainer().setDefaultEntityContainer(false).setName("Container2").setEntitySets(entitySets);
    entityContainers.add(container2);

    List<Schema> schemas = new ArrayList<Schema>();
    schemas.add(new Schema().setEntityContainers(entityContainers));
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

         log.warn("container is null, can't steal persistence manager");
         return;
      }
      if (container instanceof EntityContainer)
      {
         EntityContainer ec = (EntityContainer) container;

         if (ec.getPersistenceManager() == null)
         {
            log.info("no persistence manager in container!");
            return;
         }
         if (ec.getPersistenceManager() == this)
         {
            log.info(" persistence manager in container already set!");
            return;
         }
         pm = ec.getPersistenceManager();
         ec.setPersistenceManager(this);
      }

      // get the JNDI names for all resources that are referenced "Unshareable"
      org.jboss.metadata.BeanMetaData bmd = container.getBeanMetaData();
      org.jboss.metadata.ApplicationMetaData appMetaData = bmd.getApplicationMetaData();
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

   public Object invokeHome(Invocation mi)
      throws Exception
   {
      // Get context
      EntityContainer container = (EntityContainer) getContainer();
      EntityEnterpriseContext ctx = (EntityEnterpriseContext) container.getInstancePool().get();
      ctx.setTxAssociation(GlobalTxEntityMap.NOT_READY);
      InstancePool pool = container.getInstancePool();

      // 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);
     
      // Invoke through interceptors
     
      Object obj = null;
      Exception exception = null;

      try
      {
         obj = getNext().invokeHome(mi);
         
         // Is the context now with an identity? in which case we need to insert
         if (ctx.getId() != null)
         {
            BeanLock lock = container.getLockManager().getLock(ctx.getCacheKey());
            lock.sync(); // lock all access to BeanLock
            try
            {
               // Check there isn't a context already in the cache
               // e.g. commit-option B where the entity was
               // created then removed externally
               InstanceCache cache = container.getInstanceCache();
               cache.remove(ctx.getCacheKey());
      
               // marcf: possible race on creation and usage
               // insert instance in cache,
               cache.insert(ctx);
            }
            finally
            {
               lock.releaseSync();
               container.getLockManager().removeLockRef(ctx.getCacheKey());
            }
            
            // we are all done            
            return obj;
         }
      }
      catch (Exception e)
      {
         exception = e;
      }
      finally
      {
         AllowedOperationsAssociation.popInMethodFlag();
      }

      ctx.setTransaction(null);
      // EntityCreateInterceptor will access ctx if it is not null and call postCreate
      mi.setEnterpriseContext(null);
     
      // if we get to here with a null exception then our invocation is
      // just a home invocation. Return our instance to the instance pool  
      if (exception == null)
      {
         container.getInstancePool().free(ctx);
         return obj;
      }
     
      if (exception instanceof RuntimeException)
      {
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

   public JDBCSelectorBridge(JDBCStoreManager manager, JDBCQueryMetaData queryMetaData)
   {
      this.queryMetaData = queryMetaData;
      this.manager = manager;

      EntityContainer container = manager.getContainer();
      tm = container.getTransactionManager();
      syncBeforeSelect = !container.getBeanMetaData().getContainerConfiguration().getSyncOnCommitOnly();
   }
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

      Collection retVal;
      Method method = getMethod();
      try
      {
         JDBCQueryCommand query = manager.getQueryManager().getQueryCommand(method);
         EntityContainer selectedContainer = query.getSelectManager().getContainer();
         GenericEntityObjectFactory factory;
         if(queryMetaData.isResultTypeMappingLocal() && selectedContainer.getLocalHomeClass() != null)
         {
            factory = selectedContainer.getLocalProxyFactory();
         }
         else
         {
            factory = selectedContainer.getProxyFactory();
         }

         retVal = query.execute(method, args, null, factory);
      }
      catch(FinderException e)
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

         // construct a new relationshet
         try
         {
            // get the curent transaction
            EntityContainer container = getJDBCStoreManager().getContainer();
            TransactionManager tm = container.getTransactionManager();
            Transaction tx = tm.getTransaction();

            // if whe have a valid transaction...
            if(tx != null && (tx.getStatus() == Status.STATUS_ACTIVE || tx.getStatus() == Status.STATUS_PREPARING))
            {
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

      // Related Manager
      relatedManager = (JDBCStoreManager) relatedEntity.getManager();

      // Related Container
      EntityContainer relatedContainer = relatedManager.getContainer();
      this.relatedContainerRef = new WeakReference(relatedContainer);

      // related findByPrimaryKey
      Class homeClass = (relatedContainer.getLocalHomeClass() != null ?
         relatedContainer.getLocalHomeClass() : relatedContainer.getHomeClass());
      try
      {
         relatedFindByPrimaryKey =
            homeClass.getMethod("findByPrimaryKey", new Class[]{relatedEntity.getPrimaryKeyClass()});
      }
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

    * @return related local object instance.
    */
   public EJBLocalObject getRelatedEntityByFK(Object fk)
   {
      EJBLocalObject relatedLocalObject = null;
      final EntityContainer relatedContainer = getRelatedContainer();

      if(hasFKFieldsMappedToCMPFields
         && relatedManager.getReadAheadCache().getPreloadDataMap(fk, false) == null // not in preload cache
      )
      {
         EJBLocalHome relatedHome = relatedContainer.getLocalProxyFactory().getEJBLocalHome();
         try
         {
            relatedLocalObject = (EJBLocalObject) relatedFindByPrimaryKey.invoke(relatedHome, new Object[]{fk});
         }
         catch(Exception ignore)
         {
            // no such entity. it is ok to ignore
         }
      }
      else
      {
         relatedLocalObject = relatedContainer.getLocalProxyFactory().getEntityEJBLocalObject(fk);
      }

      return relatedLocalObject;
   }
View Full Code Here

Examples of org.jboss.ejb.EntityContainer

   private Transaction getTransaction()
   {
      try
      {
         EntityContainer container = getJDBCStoreManager().getContainer();
         TransactionManager tm = container.getTransactionManager();
         return tm.getTransaction();
      }
      catch(SystemException e)
      {
         throw new EJBException("Error getting transaction from the transaction manager", e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.