Package org.jboss.metadata.spi.repository

Examples of org.jboss.metadata.spi.repository.MutableMetaDataRepository


   }

   public void start()
   {
      KernelMetaDataRepository kmdr = kernel.getMetaDataRepository();
      MutableMetaDataRepository repository = kmdr.getMetaDataRepository();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
      if (retrieval == null)
      {
         retrieval = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
         repository.addMetaDataRetrieval(retrieval);
      }
      if (retrieval instanceof MutableMetaData)
      {
         MutableMetaData mmd = (MutableMetaData)retrieval;
         mmd.addMetaData(tracker, ContextTracker.class);
View Full Code Here


   }

   public void stop()
   {
      KernelMetaDataRepository kmdr = kernel.getMetaDataRepository();
      MutableMetaDataRepository repository = kmdr.getMetaDataRepository();
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(ScopeKey.DEFAULT_SCOPE);
      if (retrieval != null && retrieval instanceof MutableMetaData)
      {
         MutableMetaData mmd = (MutableMetaData)retrieval;
         mmd.removeMetaData(ContextTracker.class);

         if (retrieval.isEmpty())
            repository.removeMetaDataRetrieval(retrieval.getScope());
      }
      else
      {
         log.debug("Ignoring remove/modify default scoped metadata: " + retrieval);
      }
View Full Code Here

         return bmd.getName();
      }
     
      void cleanup()
      {
         MutableMetaDataRepository repository = null;
         DeploymentUnit unit = parent;
         while (repository == null && unit != null)
         {
            repository = unit.getAttachment(MutableMetaDataRepository.class);
            unit = unit.getParent();
         }
         if (repository == null)
         {
            return;
         }
        
         try
         {
            ScopeKey scope = getScope();
            repository.removeMetaDataRetrieval(scope);
         }
         catch (Throwable ignored)
         {
         }

         try
         {
            ScopeKey scope = getMutableScope();
            repository.removeMetaDataRetrieval(scope);
         }
         catch (Throwable ignored)
         {
         }
      }
View Full Code Here

      return new BasicMetaDataRepository();
   }
  
   public void testAutoClassRetrieval() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      ScopeKey key = new ScopeKey(new Scope(CommonLevels.CLASS, TestClass1.class));
      MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(key);
      assertNotNull(retrieval);
      MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval);
      assertNotNull(metaData.getAnnotation(TestAnnotation1.class));
   }
View Full Code Here

   protected abstract MutableMetaDataRepository setupEmpty();
  
   public void testNoMatchEmpty() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
     
      FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1);
      Set<ScopeKey> result = repository.matchScopes(visitor);
      assertNotNull(result);
      assertEquals(0, result.size());
   }
View Full Code Here

      assertEquals(0, result.size());
   }
  
   public void testSimpleMatch() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1);
      repository.addMetaDataRetrieval(loader1);
      MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2);
      repository.addMetaDataRetrieval(loader2);
      MutableMetaDataLoader loader3 = createTestMutableMetaDataLoader(testKey3);
      repository.addMetaDataRetrieval(loader3);
     
      FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1);
      Set<ScopeKey> result = repository.matchScopes(visitor);
     
      HashSet<ScopeKey> expected = new HashSet<ScopeKey>();
      expected.add(testKey1);
     
      assertEquals(expected, result);
View Full Code Here

      assertEquals(expected, result);
   }
  
   public void testNotSimpleMatch() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1);
      repository.addMetaDataRetrieval(loader1);
      MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2);
      repository.addMetaDataRetrieval(loader2);
      MutableMetaDataLoader loader3 = createTestMutableMetaDataLoader(testKey3);
      repository.addMetaDataRetrieval(loader3);
     
      FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey1x);
      Set<ScopeKey> result = repository.matchScopes(visitor);
      assertNotNull(result);
      assertEquals(0, result.size());
   }
View Full Code Here

      assertEquals(0, result.size());
   }
  
   public void testNoMatchAgainstSimple() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1);
      repository.addMetaDataRetrieval(loader1);
      MutableMetaDataLoader loader2 = createTestMutableMetaDataLoader(testKey2);
      repository.addMetaDataRetrieval(loader2);
     
      FuzzyMetaDataRepositoryVisitor visitor = new FuzzyMetaDataRepositoryVisitor(testKey3);
      Set<ScopeKey> result = repository.matchScopes(visitor);
      assertNotNull(result);
      assertEquals(0, result.size());
   }
View Full Code Here

      assertEquals(expected, result);
   }
  
   public void testTwoChild() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1);
      assertAddMetaDataRetrieval(repository, loader1, null);

      MutableMetaDataLoader loader12 = createTestMutableMetaDataLoader(testKey12);
      assertAddMetaDataRetrieval(repository, loader12, null);

      MutableMetaDataLoader loader12Different = createTestMutableMetaDataLoader(testKey12Different);
      assertAddMetaDataRetrieval(repository, loader12Different, null);

      Set<ScopeKey> result = repository.getChildren(testKey1);
      assertNotNull(result);
     
      Set<ScopeKey> expected = new HashSet<ScopeKey>();
      expected.add(testKey12);
      expected.add(testKey12Different);
View Full Code Here

      assertEquals(expected, result);
   }
  
   public void testTooManyScopes() throws Exception
   {
      MutableMetaDataRepository repository = setupEmpty();
      MutableMetaDataLoader loader1 = createTestMutableMetaDataLoader(testKey1);
      assertAddMetaDataRetrieval(repository, loader1, null);
      MutableMetaDataLoader loader123 = createTestMutableMetaDataLoader(testKey123);
      assertAddMetaDataRetrieval(repository, loader123, null);

      Set<ScopeKey> result = repository.getChildren(testKey1);
      assertNotNull(result);
      assertEquals(0, result.size());
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.repository.MutableMetaDataRepository

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.