Package org.jboss.metadata.ejb.jboss

Examples of org.jboss.metadata.ejb.jboss.CacheConfigMetaData


   private void addCacheAnnotations(EJBContainer container,
         JBossSessionBeanMetaData enterpriseBean) throws Exception
   {
      if (enterpriseBean.getCacheConfig() != null)
      {
         CacheConfigMetaData config = enterpriseBean.getCacheConfig();
         if (config.getValue() != null && !config.getValue().equals(""))
         {
            String cacheValue = config.getValue();
            CacheImpl cacheAnnotation = new CacheImpl(cacheValue);
            addClassAnnotation(container, Cache.class, cacheAnnotation);

            // FIXME: Wolf: what the hell is this?
            // FIXME: ALR: This shouldn't be hardcoded; configuration needs reworking
            if (cacheValue.equals("SimpleStatefulCache"))
            {
               if (!ejbClass.isAnnotationPresent(PersistenceManager.class))
               {
                  PersistenceManagerImpl persistenceAnnotation = new PersistenceManagerImpl();
                  if (config.getPersistenceManager() != null)
                  {
                     persistenceAnnotation.setValue(config.getPersistenceManager());
                  }
                  addClassAnnotation(container, PersistenceManager.class, persistenceAnnotation);
               }
            }
         }

         if (config.getName() != null)
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            configAnnotation.setName(config.getName());

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());

            if (config.getReplicationIsPassivation() != null)
               configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));

            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());
           
            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
            addClassAnnotation(container, org.jboss.ejb3.annotation.CacheConfig.class, configAnnotation);
         }
         else
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());
           
            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());

            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
View Full Code Here


   private void addCacheAnnotations(EJBContainer container,
         JBossSessionBeanMetaData enterpriseBean) throws Exception
   {
      if (enterpriseBean.getCacheConfig() != null)
      {
         CacheConfigMetaData config = enterpriseBean.getCacheConfig();
         if (config.getValue() != null && !config.getValue().equals(""))
         {
            String cacheValue = config.getValue();
            CacheImpl cacheAnnotation = new CacheImpl(cacheValue);
            addClassAnnotation(container, Cache.class, cacheAnnotation);

            // FIXME: Wolf: what the hell is this?
            // FIXME: ALR: This shouldn't be hardcoded; configuration needs reworking
            if (cacheValue.equals("SimpleStatefulCache"))
            {
               if (!ejbClass.isAnnotationPresent(PersistenceManager.class))
               {
                  PersistenceManagerImpl persistenceAnnotation = new PersistenceManagerImpl();
                  if (config.getPersistenceManager() != null)
                  {
                     persistenceAnnotation.setValue(config.getPersistenceManager());
                  }
                  addClassAnnotation(container, PersistenceManager.class, persistenceAnnotation);
               }
            }
         }

         if (config.getName() != null)
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            configAnnotation.setName(config.getName());

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());

            if (config.getReplicationIsPassivation() != null)
               configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));

            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());
           
            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
            addClassAnnotation(container, org.jboss.ejb3.annotation.CacheConfig.class, configAnnotation);
         }
         else
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());
           
            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());

            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
View Full Code Here

   private void addCacheAnnotations(EJBContainer container,
         JBossSessionBeanMetaData enterpriseBean) throws Exception
   {
      if (enterpriseBean.getCacheConfig() != null)
      {
         CacheConfigMetaData config = enterpriseBean.getCacheConfig();
         if (config.getValue() != null && !config.getValue().equals(""))
         {
            String cacheValue = config.getValue();
            CacheImpl cacheAnnotation = new CacheImpl(cacheValue);
            addClassAnnotation(container, Cache.class, cacheAnnotation);

            // FIXME: Wolf: what the hell is this?
            // FIXME: ALR: This shouldn't be hardcoded; configuration needs reworking
            if (cacheValue.equals("SimpleStatefulCache"))
            {
               if (!ejbClass.isAnnotationPresent(PersistenceManager.class))
               {
                  PersistenceManagerImpl persistenceAnnotation = new PersistenceManagerImpl();
                  if (config.getPersistenceManager() != null)
                  {
                     persistenceAnnotation.setValue(config.getPersistenceManager());
                  }
                  addClassAnnotation(container, PersistenceManager.class, persistenceAnnotation);
               }
            }
         }

         if (config.getName() != null)
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            configAnnotation.setName(config.getName());

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());

            if (config.getReplicationIsPassivation() != null)
               configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));

            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());
           
            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
            addClassAnnotation(container, org.jboss.ejb3.annotation.CacheConfig.class, configAnnotation);
         }
         else
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());
           
            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());

            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
View Full Code Here

   {
      CacheConfig annotation = finder.getAnnotation(type, CacheConfig.class);
      if(annotation == null)
         return;
     
      CacheConfigMetaData cacheConfig = new CacheConfigMetaData();
      cacheConfig.setMaxSize(annotation.maxSize());
      cacheConfig.setName(annotation.name());

      cacheConfig.setIdleTimeoutSeconds(Integer.valueOf((int) annotation.idleTimeoutSeconds()));
      cacheConfig.setRemoveTimeoutSeconds(Integer.valueOf((int) annotation.removalTimeoutSeconds()));
     
      cacheConfig.setReplicationIsPassivation(Boolean.toString(annotation.replicationIsPassivation()));
     
      metaData.setCacheConfig(cacheConfig);
   }
View Full Code Here

   private void addCacheAnnotations(EJBContainer container,
         JBossSessionBeanMetaData enterpriseBean) throws Exception
   {
      if (enterpriseBean.getCacheConfig() != null)
      {
         CacheConfigMetaData config = enterpriseBean.getCacheConfig();
         if (config.getValue() != null && !config.getValue().equals(""))
         {
            String cacheValue = config.getValue();
            CacheImpl cacheAnnotation = new CacheImpl(cacheValue);
            addClassAnnotation(container, Cache.class, cacheAnnotation);

            // FIXME: Wolf: what the hell is this?
            // FIXME: ALR: This shouldn't be hardcoded; configuration needs reworking
            if (cacheValue.equals("SimpleStatefulCache"))
            {
               if (!ejbClass.isAnnotationPresent(PersistenceManager.class))
               {
                  PersistenceManagerImpl persistenceAnnotation = new PersistenceManagerImpl();
                  if (config.getPersistenceManager() != null)
                  {
                     persistenceAnnotation.setValue(config.getPersistenceManager());
                  }
                  addClassAnnotation(container, PersistenceManager.class, persistenceAnnotation);
               }
            }
         }

         if (config.getName() != null)
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            configAnnotation.setName(config.getName());

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());

            if (config.getReplicationIsPassivation() != null)
               configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));

            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());
           
            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
            addClassAnnotation(container, org.jboss.ejb3.annotation.CacheConfig.class, configAnnotation);
         }
         else
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());
           
            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());

            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
View Full Code Here

      assertEquals("localHomeBinding", bean.getLocalHomeJndiName());
      assertEquals("remoteHomeBinding", bean.getHomeJndiName());
     
      // @CacheConfig
      assertNotNull(bean.getCacheConfig());
      CacheConfigMetaData cacheConfig = bean.getCacheConfig();
      assertEquals("test", cacheConfig.getName());
      assertEquals(Integer.valueOf(123), cacheConfig.getIdleTimeoutSeconds());
      assertEquals(Integer.valueOf(234), cacheConfig.getMaxSize());
      assertEquals(Integer.valueOf(345), cacheConfig.getRemoveTimeoutSeconds());
      assertEquals("true", cacheConfig.getReplicationIsPassivation());
   }
View Full Code Here

   }
  
   public void todotestCacheConfig()
   {
      // Override
      CacheConfigMetaData overrideCacheConfig = new CacheConfigMetaData();
      overrideCacheConfig.setIdleTimeoutSeconds(Integer.valueOf(5));
      overrideCacheConfig.setMaxSize(Integer.valueOf(5));
      overrideCacheConfig.setRemoveTimeoutSeconds(Integer.valueOf(5));
      overrideCacheConfig.setName("overrideName");
      overrideCacheConfig.setPersistenceManager("overridePersistenceManager");
      overrideCacheConfig.setReplicationIsPassivation("overrideReplicationIsPassivation");
      overrideCacheConfig.setValue("overrideValue");
     
      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setCacheConfig(overrideCacheConfig);
      override.setName("overrideName");
   
      // Original
      CacheConfigMetaData originalCacheConfig = new CacheConfigMetaData();
      originalCacheConfig.setIdleTimeoutSeconds(Integer.valueOf(6));
      originalCacheConfig.setMaxSize(Integer.valueOf(6));
      originalCacheConfig.setRemoveTimeoutSeconds(Integer.valueOf(6));
      originalCacheConfig.setName("originalName");
      originalCacheConfig.setPersistenceManager("originalPersistenceManager");
      originalCacheConfig.setReplicationIsPassivation("originalReplicationIsPassivation");
      originalCacheConfig.setValue("originalValue");
     
      JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
      original.setCacheConfig(originalCacheConfig);
     
      // Merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      merged.merge(override, original);
      CacheConfigMetaData cacheConfig = merged.getCacheConfig();
      assertNotNull(cacheConfig);
      assertEquals(Integer.valueOf(5), cacheConfig.getIdleTimeoutSeconds());
      assertEquals(Integer.valueOf(5), cacheConfig.getMaxSize());
      assertEquals(Integer.valueOf(5), cacheConfig.getRemoveTimeoutSeconds());
      assertEquals("overrideName", cacheConfig.getName());
      assertEquals("overridePersistenceManager", cacheConfig.getPersistenceManager());
      assertEquals("overrideReplicationIsPassivation", cacheConfig.getReplicationIsPassivation());
      assertEquals("overrideValue", cacheConfig.getValue());
   }
View Full Code Here

      // @RemoteHomeBinding
      assertEquals("remoteHomeBinding", bean.getHomeJndiName());
     
      // @CacheConfig
      assertNotNull(bean.getCacheConfig());
      CacheConfigMetaData cacheConfig = bean.getCacheConfig();
      assertEquals("test", cacheConfig.getName());
      assertEquals(Integer.valueOf(123), cacheConfig.getIdleTimeoutSeconds());
      assertEquals(Integer.valueOf(234), cacheConfig.getMaxSize());
      assertEquals(Integer.valueOf(345), cacheConfig.getRemoveTimeoutSeconds());
      assertEquals("true", cacheConfig.getReplicationIsPassivation());
     
      // @Clustered
      assertNotNull(bean.getClusterConfig());
      assertTrue(bean.isClustered());
      ClusterConfigMetaData clusterConfig = bean.getClusterConfig();
View Full Code Here

      // @RemoteHomeBinding
      assertEquals("remoteHomeBinding", bean.getHomeJndiName());
     
      // @CacheConfig
      assertNotNull(bean.getCacheConfig());
      CacheConfigMetaData cacheConfig = bean.getCacheConfig();
      assertEquals("test", cacheConfig.getName());
      assertEquals(Integer.valueOf(123), cacheConfig.getIdleTimeoutSeconds());
      assertEquals(Integer.valueOf(234), cacheConfig.getMaxSize());
      assertEquals(Integer.valueOf(345), cacheConfig.getRemoveTimeoutSeconds());
      assertEquals("true", cacheConfig.getReplicationIsPassivation());
     
      // @Clustered
      assertNotNull(bean.getClusterConfig());
      ClusterConfigMetaData clusterConfig = bean.getClusterConfig();
      assertEquals("home", clusterConfig.getHomeLoadBalancePolicy());
View Full Code Here

   private void addCacheAnnotations(EJBContainer container,
         JBossSessionBeanMetaData enterpriseBean) throws Exception
   {
      if (enterpriseBean.getCacheConfig() != null)
      {
         CacheConfigMetaData config = enterpriseBean.getCacheConfig();
         if (config.getValue() != null && !config.getValue().equals(""))
         {
            String cacheValue = config.getValue();
            CacheImpl cacheAnnotation = new CacheImpl(cacheValue);
            addClassAnnotation(container, Cache.class, cacheAnnotation);

            // FIXME: Wolf: what the hell is this?
            // FIXME: ALR: This shouldn't be hardcoded; configuration needs reworking
            if (cacheValue.equals("SimpleStatefulCache"))
            {
               if (!ejbClass.isAnnotationPresent(PersistenceManager.class))
               {
                  PersistenceManagerImpl persistenceAnnotation = new PersistenceManagerImpl();
                  if (config.getPersistenceManager() != null)
                  {
                     persistenceAnnotation.setValue(config.getPersistenceManager());
                  }
                  addClassAnnotation(container, PersistenceManager.class, persistenceAnnotation);
               }
            }
         }

         if (config.getName() != null)
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            configAnnotation.setName(config.getName());

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());

            if (config.getReplicationIsPassivation() != null)
               configAnnotation.setReplicationIsPassivation(Boolean.parseBoolean(config.getReplicationIsPassivation()));

            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());
           
            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
            addClassAnnotation(container, org.jboss.ejb3.annotation.CacheConfig.class, configAnnotation);
         }
         else
         {
            org.jboss.ejb3.annotation.impl.CacheConfigImpl configAnnotation = new org.jboss.ejb3.annotation.impl.CacheConfigImpl();

            if (config.getMaxSize() != null)
               configAnnotation.setMaxSize(config.getMaxSize());

            if (config.getIdleTimeoutSeconds() != null)
               configAnnotation.setIdleTimeoutSeconds(config.getIdleTimeoutSeconds());
           
            if (config.getRemoveTimeoutSeconds() != null)
               configAnnotation.setRemovalTimeoutSeconds(config.getRemoveTimeoutSeconds());

            org.jboss.ejb3.annotation.CacheConfig existingConfig = ejbClass.getAnnotation(org.jboss.ejb3.annotation.CacheConfig.class);
            if (existingConfig != null)
               configAnnotation.merge(existingConfig);
           
View Full Code Here

TOP

Related Classes of org.jboss.metadata.ejb.jboss.CacheConfigMetaData

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.