org.infinispan.query.clustered
Class ClusteredQueryCommand

java.lang.Object
  extended by org.infinispan.commands.remote.BaseRpcCommand
      extended by org.infinispan.query.clustered.ClusteredQueryCommand
All Implemented Interfaces:
CacheRpcCommand, ReplicableCommand

public class ClusteredQueryCommand
extends BaseRpcCommand
implements ReplicableCommand

Encapsulates all rpc calls for distributed queries actions

Since:
5.1
Author:
Israel Lacerra

Field Summary
static byte COMMAND_ID
           
 
Fields inherited from class org.infinispan.commands.remote.BaseRpcCommand
cacheName
 
Constructor Summary
ClusteredQueryCommand(String cacheName)
          For CommandFactory only.
 
Method Summary
static ClusteredQueryCommand createEagerIterator(org.hibernate.search.query.engine.spi.HSQuery query, Cache<?,?> cache)
           
static ClusteredQueryCommand createLazyIterator(org.hibernate.search.query.engine.spi.HSQuery query, Cache<?,?> cache, UUID id)
           
static ClusteredQueryCommand destroyLazyQuery(Cache<?,?> cache, UUID id)
           
 boolean equals(Object obj)
           
 byte getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 Object[] getParameters()
          Used by marshallers to stream this command across a network
static ClusteredQueryCommand getResultSize(org.hibernate.search.query.engine.spi.HSQuery query, Cache<?,?> cache)
           
 int hashCode()
           
 void initialize(Cache<?,?> localInstance)
           
 void injectComponents(Cache<?,?> cache)
           
 boolean isReturnValueExpected()
          If true, a return value will be provided when performed remotely.
 QueryResponse perform(Cache<?,?> cache)
           
 Object perform(InvocationContext context)
          Invokes a query on a (remote) cache and returns results (list of keys).
static ClusteredQueryCommand retrieveKeyFromLazyQuery(Cache<?,?> cache, UUID id, int docIndex)
           
 void setCache(Cache<?,?> cache)
           
 void setParameters(int commandId, Object[] args)
          Used by the CommandsFactory to create a command from raw data read off a stream.
 String toString()
           
 
Methods inherited from class org.infinispan.commands.remote.BaseRpcCommand
getCacheName, getOrigin, setOrigin
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMAND_ID

public static final byte COMMAND_ID
See Also:
Constant Field Values
Constructor Detail

ClusteredQueryCommand

public ClusteredQueryCommand(String cacheName)
For CommandFactory only. To create a ClusteredQueryCommand, use createLazyIterator(), destroyLazyQuery(), getResultSize() or retrieveKeyFromLazyQuery()

Method Detail

injectComponents

public void injectComponents(Cache<?,?> cache)

createLazyIterator

public static ClusteredQueryCommand createLazyIterator(org.hibernate.search.query.engine.spi.HSQuery query,
                                                       Cache<?,?> cache,
                                                       UUID id)

getResultSize

public static ClusteredQueryCommand getResultSize(org.hibernate.search.query.engine.spi.HSQuery query,
                                                  Cache<?,?> cache)

createEagerIterator

public static ClusteredQueryCommand createEagerIterator(org.hibernate.search.query.engine.spi.HSQuery query,
                                                        Cache<?,?> cache)

destroyLazyQuery

public static ClusteredQueryCommand destroyLazyQuery(Cache<?,?> cache,
                                                     UUID id)

retrieveKeyFromLazyQuery

public static ClusteredQueryCommand retrieveKeyFromLazyQuery(Cache<?,?> cache,
                                                             UUID id,
                                                             int docIndex)

initialize

public void initialize(Cache<?,?> localInstance)

setCache

public void setCache(Cache<?,?> cache)

perform

public Object perform(InvocationContext context)
               throws Throwable
Invokes a query on a (remote) cache and returns results (list of keys).

Specified by:
perform in interface ReplicableCommand
Parameters:
context - invocation context, ignored.
Returns:
returns an List.
Throws:
Throwable - in the event of problems.

perform

public QueryResponse perform(Cache<?,?> cache)

getCommandId

public byte getCommandId()
Description copied from interface: ReplicableCommand
Used by marshallers to convert this command into an id for streaming.

Specified by:
getCommandId in interface ReplicableCommand
Returns:
the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.

getParameters

public Object[] getParameters()
Description copied from interface: ReplicableCommand
Used by marshallers to stream this command across a network

Specified by:
getParameters in interface ReplicableCommand
Returns:
an object array of arguments, compatible with pre-2.2.0 MethodCall args.

setParameters

public void setParameters(int commandId,
                          Object[] args)
Description copied from interface: ReplicableCommand
Used by the CommandsFactory to create a command from raw data read off a stream.

Specified by:
setParameters in interface ReplicableCommand
Parameters:
commandId - command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as PutKeyValueCommand.
args - object array of args

toString

public String toString()
Overrides:
toString in class BaseRpcCommand

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

isReturnValueExpected

public boolean isReturnValueExpected()
Description copied from interface: ReplicableCommand
If true, a return value will be provided when performed remotely. Otherwise, a remote ResponseGenerator may choose to simply return null to save on marshalling costs.

Specified by:
isReturnValueExpected in interface ReplicableCommand
Returns:
true or false

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.