Package org.jboss.ejb3.annotation

Examples of org.jboss.ejb3.annotation.CacheConfig


   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here


    */
   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();

View Full Code Here

      PersistenceManagerFactoryRegistry pmFactoryRegistry = ejbContainer.getDeployment()
            .getPersistenceManagerFactoryRegistry();
      PersistenceManagerFactory pmFactory = pmFactoryRegistry.getPersistenceManagerFactory(pmConfigValue);
      this.pm = pmFactory.createPersistenceManager();
      pm.initialize(container);
      CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
      maxSize = config.maxSize();
      sessionTimeout = config.idleTimeoutSeconds();
      removalTimeout = config.removalTimeoutSeconds() * 1000;
      SessionBeanEffigy effigy = this.container.getEffigy();
      if(effigy != null)
      {
         StatefulTimeoutEffigy statefulTimeout = effigy.getStatefulTimeout();
         if(statefulTimeout != null)
View Full Code Here

            bean = new InfinispanStatefulBeanContext(this.container, bean.getInstance());
         }
      }

      // Tell context how to handle replication
      CacheConfig config = this.container.getAnnotation(CacheConfig.class);
      if (config != null)
      {
         bean.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      bean = bean.pushContainedIn();
View Full Code Here

    * @see org.jboss.ejb3.cache.infinispan.CacheSource#getCache(org.jboss.ejb3.stateful.StatefulContainer)
    */
   @Override
   public <K, V> Cache<K, V> getCache(StatefulContainer ejbContainer)
   {
      CacheConfig cacheConfig = ejbContainer.getAnnotation(CacheConfig.class);
      String containerName = StringPropertyReplacer.replaceProperties(cacheConfig.name());
      String templateCacheName = null;

      if ((containerName == null) || containerName.isEmpty())
      {
         containerName = CacheConfig.DEFAULT_CLUSTERED_OBJECT_NAME;
      }
      else
      {
         String[] parts = containerName.split("/");
        
         if (parts.length == 2)
         {
            containerName = parts[0];
            templateCacheName = parts[1];
         }
      }
     
      String cacheName = ejbContainer.getDeploymentPropertyListString();
     
      EmbeddedCacheManager container = this.registry.getCacheContainer(containerName);
     
      Configuration configuration = container.defineConfiguration(cacheName, templateCacheName, new Configuration());
/*
      for (CacheProperty cacheProperty: cacheConfig.properties())
      {
         String name = cacheProperty.name();
        
         if (!name.startsWith(PREFIX))
         {
            log.debug(String.format("Ignoring cache property \"%s\" for bean %s", name, cacheName));
            continue;
         }

         String property = name.substring(PREFIX.length());
         String value = cacheProperty.value();
        
         if (property.equals(MODE))
         {
            try
            {
               configuration.setCacheMode(CacheMode.valueOf(value.toUpperCase(Locale.ENGLISH)));
            }
            catch (IllegalArgumentException e)
            {
               throw new IllegalArgumentException(String.format("\"%s\" is not a valid \"%s\" for bean %s  Valid modes: %s", value, name, cacheName, CacheMode.values()), e);
            }
         }
         else if (property.equals(OWNERS))
         {
            try
            {
               configuration.setNumOwners(Integer.valueOf(value));
            }
            catch (NumberFormatException e)
            {
               throw new IllegalArgumentException(String.format("\"%s\" is not a valid \"%s\" for bean %s  Integer expected.", value, name, cacheName), e);
            }
         }
         else
         {
            log.info(String.format("Ignoring unrecognized cache property \"%s\" for bean %s", name, value));
         }
      }
*/
      configuration.setEvictionMaxEntries(cacheConfig.maxSize());
     
      if (configuration.getCacheMode().isDistributed())
      {
         configuration.setL1CacheEnabled(true);
         configuration.setL1Lifespan(TimeUnit.SECONDS.toMillis(cacheConfig.idleTimeoutSeconds()));
      }
     
      return container.getCache(cacheName);
   }
View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

    */
   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();

View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

   public StatefulBeanContext create(Class<?>[] initTypes, Object[] initValues)
   {
      StatefulBeanContext sfctx = (StatefulBeanContext) createBeanContext();
      // Tell context how to handle replication
      CacheConfig config = getAnnotation(CacheConfig.class);
      if (config != null)
      {
         sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
      }

      // this is for propagated extended PC's
      sfctx = sfctx.pushContainedIn();
     
View Full Code Here

TOP

Related Classes of org.jboss.ejb3.annotation.CacheConfig

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.