Package org.jboss.cache.factories

Examples of org.jboss.cache.factories.ComponentRegistry


   {
      Pojo pojo = new Pojo();
      MarshalledValue mv = new MarshalledValue(pojo);

      Configuration c = new Configuration();
      ComponentRegistry cr = new ComponentRegistry(c, new CacheInvocationDelegate());

      Marshaller marshaller = new CacheMarshaller210();
      cr.registerComponent(marshaller, Marshaller.class);

      // Wire the marshaller
      cr.start();

      // start the test
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bout);
      marshaller.objectToObjectStream(mv, out);
View Full Code Here


      threadLocal.set(tl);
      tl.c = new Configuration();
      tl.c.setUseRegionBasedMarshalling(false);
      tl.c.setInactiveOnStartup(false);
      tl.c.setReplVersionString(currentVersion);
      ComponentRegistry cr = new ComponentRegistry(tl.c, new CacheInvocationDelegate());
      crTL.set(cr);
      tl.marshaller = createVAMandRestartCache(new RegionManagerImpl());
      tl.regionManager = cr.getComponent(RegionManager.class);
   }
View Full Code Here

    * @param cache       cache that needs to be altered
    * @param interceptor the first interceptor in the new chain.
    */
   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, CommandInterceptor interceptor)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      // make sure all interceptors here are wired.
      CommandInterceptor i = interceptor;
      do
      {
         cr.wireDependencies(i);
      }
      while ((i = i.getNext()) != null);

      InterceptorChain inch = cr.getComponent(InterceptorChain.class);
      inch.setFirstInChain(interceptor);
   }
View Full Code Here

    * @param cache cache instance for which a remote delegate is to be retrieved
    * @return remote delegate, or null if the cacge is not configured for replication.
    */
   public static CacheInvocationDelegate getInvocationDelegate(CacheSPI cache)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      return cr.getComponent(CacheInvocationDelegate.class);
   }
View Full Code Here

      throw new RuntimeException("Timed out waiting for condition");
   }

   public static void replicateCommand(CacheSPI cache, VisitableCommand command) throws Throwable
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      InterceptorChain ic = cr.getComponent(InterceptorChain.class);
      ic.invoke(command);
   }
View Full Code Here

//      RegionManager rm = new RegionManager();
      final CacheMarshaller200 cm200 = new CacheMarshaller200();
      c.setInactiveOnStartup(false);
      c.setUseRegionBasedMarshalling(true);
      c.setCacheMarshaller(cm200);
      ComponentRegistry cr = crTL.get();     
      cr.registerComponent(cm200, CacheMarshaller200.class);
      cr.rewire();
      cr.start();

      RegionManager rm = cr.getComponent(RegionManager.class);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      final Fqn region = Fqn.fromString("/hello");
      Region r = rm.getRegion(region, true);
      r.registerContextClassLoader(this.getClass().getClassLoader());
View Full Code Here

      RPCManager rpcManager = EasyMock.createNiceMock(RPCManager.class);

      List<Address> memberList = rpcManager1.getMembers();
      expect(rpcManager.getMembers()).andReturn(memberList).anyTimes();
      // inject a mock RPC manager so that we can test whether calls made are sync or async.
      ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache1);
      cr.registerComponent(rpcManager, RPCManager.class);
      cr.rewire();

      // invalidations will not trigger any rpc calls for PFER
      if (!isUsingInvalidation())
      {
         // specify what we expectWithTx called on the mock Rpc Manager.  For params we don't care about, just use ANYTHING.
View Full Code Here

    * @param cache       cache that needs to be altered
    * @param interceptor the first interceptor in the new chain.
    */
   public static void replaceInterceptorChain(CacheSPI<?, ?> cache, CommandInterceptor interceptor)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      // make sure all interceptors here are wired.
      CommandInterceptor i = interceptor;
      do
      {
         cr.wireDependencies(i);
      }
      while ((i = i.getNext()) != null);

      InterceptorChain inch = cr.getComponent(InterceptorChain.class);
      inch.setFirstInChain(interceptor);
   }
View Full Code Here

    * @param cache cache instance for which a remote delegate is to be retrieved
    * @return remote delegate, or null if the cacge is not configured for replication.
    */
   public static CacheInvocationDelegate getInvocationDelegate(CacheSPI cache)
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      return cr.getComponent(CacheInvocationDelegate.class);
   }
View Full Code Here

      throw new RuntimeException("Timed out waiting for condition");
   }

   public static void replicateCommand(CacheSPI cache, VisitableCommand command) throws Throwable
   {
      ComponentRegistry cr = extractComponentRegistry(cache);
      InterceptorChain ic = cr.getComponent(InterceptorChain.class);
      ic.invoke(command);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.factories.ComponentRegistry

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.