Package org.infinispan.query.remote

Examples of org.infinispan.query.remote.ProtobufMetadataManager


      clientBuilder.marshaller(new ProtoStreamMarshaller());
      remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
      remoteCache = remoteCacheManager.getCache();

      //initialize server-side serialization context
      ProtobufMetadataManager protobufMetadataManager = manager(0).getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
      protobufMetadataManager.registerProtofiles("/infinispan/indexing.proto", "/sample_bank_account/bank.proto", "/google/protobuf/descriptor.proto");

      //initialize client-side serialization context
      MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(remoteCacheManager));
   }
View Full Code Here


        final String cacheContainerName = address.getElement(address.size() - 1).getValue();
        final ServiceController<?> controller = context.getServiceRegistry(false).getService(
              EmbeddedCacheManagerService.getServiceName(cacheContainerName));

        EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue();
        ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
        if (protoManager != null) {
           try {
              List<ModelNode> descriptorsNodes = newValue.asList();
              String[] nameArray = new String[descriptorsNodes.size()];
              String[] contentArray = new String[descriptorsNodes.size()];
              int i = 0;
              for(ModelNode modelNode : descriptorsNodes) {
                 String urlString = modelNode.asString();
                 nameArray[i] = extractFile(urlString);
                 contentArray[i] = Util.read(new URL(urlString).openStream());
                 i++;  
              }
              protoManager.registerProtofiles(nameArray,contentArray);
           } catch (Exception e) {
              throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage())));
           }
        }
        context.stepCompleted();
View Full Code Here

      final String cacheContainerName = address.getElement(address.size() - 1).getValue();
      final ServiceController<?> controller = context.getServiceRegistry(false).getService(
              EmbeddedCacheManagerService.getServiceName(cacheContainerName));

      EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue();
      ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
      if (protoManager != null) {
         try {
            String nameParameter = CacheContainerResource.PROTO_NAMES.getName();
            String contentParameter = CacheContainerResource.PROTO_CONTENTS.getName();
            ModelNode names = operation.require(nameParameter);
            ModelNode contents = operation.require(contentParameter);
            validateParameters(names, contents);
            List<ModelNode> descriptorsNames = names.asList();
            List<ModelNode> descriptorsContents = contents.asList();
            String[] nameArray = new String[descriptorsNames.size()];
            String[] contentArray = new String[descriptorsNames.size()];
            int i = 0;
            for (ModelNode modelNode : descriptorsNames) {
               nameArray[i] = modelNode.asString();
               contentArray[i] = descriptorsContents.get(i).asString();
               i++;
            }
            protoManager.registerProtofiles(nameArray, contentArray);
         } catch (Exception e) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage())));
         }
      }
      context.stepCompleted();
View Full Code Here

      RemoteCache<String, String> metadataCache = remoteCacheManager.getCache(ProtobufMetadataManager.PROTOBUF_METADATA_CACHE_NAME);
      metadataCache.put("google/protobuf/descriptor.proto", Util.read(Util.getResourceAsStream("/google/protobuf/descriptor.proto", getClass().getClassLoader())));
      metadataCache.put("infinispan/indexing.proto", Util.read(Util.getResourceAsStream("/infinispan/indexing.proto", getClass().getClassLoader())));
      metadataCache.put("sample_bank_account/bank.proto", Util.read(Util.getResourceAsStream("/sample_bank_account/bank.proto", getClass().getClassLoader())));

      ProtobufMetadataManager protobufMetadataManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
      protobufMetadataManager.registerMarshaller(new EmbeddedAccountMarshaller());

      return cacheManager;
   }
View Full Code Here

   }

   @BeforeClass(alwaysRun = true)
   protected void populateCache() throws Exception {
      //initialize server-side serialization context
      ProtobufMetadataManager protobufMetadataManager = manager(0).getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
      protobufMetadataManager.registerProtofiles(MarshallerRegistration.PROTOBUF_RES);

      //initialize client-side serialization context
      for (RemoteCacheManager rcm : clients) {
         MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(rcm));
      }
View Full Code Here

TOP

Related Classes of org.infinispan.query.remote.ProtobufMetadataManager

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.