Package eu.mosaic_cloud.platform.interop.specs.kvstore

Examples of eu.mosaic_cloud.platform.interop.specs.kvstore.MemcachedMessage


      if (!handle) {
        this.handleKVOperation (message, session, driver, MemcachedResponseTransmitter.class);
      }
      return;
    }
    final MemcachedMessage mcMessage = (MemcachedMessage) message.specification;
    switch (mcMessage) {
      case ADD_REQUEST :
        final MemcachedPayloads.AddRequest addRequest = (AddRequest) message.payload;
        token = addRequest.getToken ();
        key = addRequest.getKey ();
        MemcachedStub.logger.trace (mssgPrefix + mcMessage.toString () + " key: " + key + " - request id: " + token.getMessageId () + " client id: " + token.getClientId ());
        exp = addRequest.getExpTime ();
        data = addRequest.getValue ().toByteArray ();
        messageData = new eu.mosaic_cloud.platform.interop.common.kv.KeyValueMessage (key, data, addRequest.getEnvelope ().getContentEncoding (), addRequest.getEnvelope ().getContentType ());
        callback = new DriverOperationFinishedHandler (token, session, MemcachedDriver.class, MemcachedResponseTransmitter.class);
        resultStore = driver.invokeAddOperation (token.getClientId (), messageData, exp, callback);
        callback.setDetails (KeyValueOperations.ADD, resultStore);
        break;
      case APPEND_REQUEST :
        final MemcachedPayloads.AppendRequest appendRequest = (AppendRequest) message.payload;
        token = appendRequest.getToken ();
        key = appendRequest.getKey ();
        MemcachedStub.logger.trace (mssgPrefix + mcMessage.toString () + " key: " + key + " - request id: " + token.getMessageId () + " client id: " + token.getClientId ());
        data = appendRequest.getValue ().toByteArray ();
        messageData = new eu.mosaic_cloud.platform.interop.common.kv.KeyValueMessage (key, data, appendRequest.getEnvelope ().getContentEncoding (), appendRequest.getEnvelope ().getContentType ());
        callback = new DriverOperationFinishedHandler (token, session, MemcachedDriver.class, MemcachedResponseTransmitter.class);
        resultStore = driver.invokeAppendOperation (token.getClientId (), messageData, callback);
        callback.setDetails (KeyValueOperations.APPEND, resultStore);
        break;
      case PREPEND_REQUEST :
        final MemcachedPayloads.PrependRequest prependRequest = (PrependRequest) message.payload;
        token = prependRequest.getToken ();
        key = prependRequest.getKey ();
        MemcachedStub.logger.trace (mssgPrefix + mcMessage.toString () + " key: " + key + " - request id: " + token.getMessageId () + " client id: " + token.getClientId ());
        data = prependRequest.getValue ().toByteArray ();
        messageData = new eu.mosaic_cloud.platform.interop.common.kv.KeyValueMessage (key, data, prependRequest.getEnvelope ().getContentEncoding (), prependRequest.getEnvelope ().getContentType ());
        callback = new DriverOperationFinishedHandler (token, session, MemcachedDriver.class, MemcachedResponseTransmitter.class);
        resultStore = driver.invokePrependOperation (token.getClientId (), messageData, callback);
        callback.setDetails (KeyValueOperations.PREPEND, resultStore);
        break;
      case REPLACE_REQUEST :
        final MemcachedPayloads.ReplaceRequest replaceRequest = (ReplaceRequest) message.payload;
        token = replaceRequest.getToken ();
        key = replaceRequest.getKey ();
        MemcachedStub.logger.trace (mssgPrefix + mcMessage.toString () + " key: " + key + " - request id: " + token.getMessageId () + " client id: " + token.getClientId ());
        exp = replaceRequest.getExpTime ();
        data = replaceRequest.getValue ().toByteArray ();
        messageData = new eu.mosaic_cloud.platform.interop.common.kv.KeyValueMessage (key, data, replaceRequest.getEnvelope ().getContentEncoding (), replaceRequest.getEnvelope ().getContentType ());
        callback = new DriverOperationFinishedHandler (token, session, MemcachedDriver.class, MemcachedResponseTransmitter.class);
        resultStore = driver.invokeReplaceOperation (token.getClientId (), messageData, exp, callback);
        callback.setDetails (KeyValueOperations.REPLACE, resultStore);
        break;
      case CAS_REQUEST :
        final MemcachedPayloads.CasRequest casRequest = (CasRequest) message.payload;
        token = casRequest.getToken ();
        key = casRequest.getKey ();
        MemcachedStub.logger.trace (mssgPrefix + mcMessage.toString () + " key: " + key + " - request id: " + token.getMessageId () + " client id: " + token.getClientId ());
        data = casRequest.getValue ().toByteArray ();
        messageData = new eu.mosaic_cloud.platform.interop.common.kv.KeyValueMessage (key, data, casRequest.getEnvelope ().getContentEncoding (), casRequest.getEnvelope ().getContentType ());
        callback = new DriverOperationFinishedHandler (token, session, MemcachedDriver.class, MemcachedResponseTransmitter.class);
        resultStore = driver.invokeCASOperation (token.getClientId (), messageData, callback);
        callback.setDetails (KeyValueOperations.CAS, resultStore);
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.platform.interop.specs.kvstore.MemcachedMessage

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.