cacheRunner
Class CacheRunner

java.lang.Object
  extended by cacheRunner.CacheRunner

public class CacheRunner
extends Object

This class is a command-line application that allows the user to exercise GemFire's cache API. The example allows the user to specify a cache.xml file that specifies a parent region with certain properties and then allows the user to exercise the cache API

Since:
3.0
Author:
GemStone Systems, Inc.

Constructor Summary
CacheRunner()
           
 
Method Summary
(package private)  void attr(String command)
          Prints out the current region attributes
(package private)  void begin(String command)
          Begins a transaction in the current thread
(package private)  void chrgn(String command)
          Changes the current region to another as specified by command.
(package private)  void commit(String command)
          Commits the transaction associated with the current thread.
(package private)  void create(String command)
          Creates a new entry in the current region
(package private)  void des(String command)
          Destroys (local or distributed) a region or entry in the current region.
(package private)  void exec(String command)
          Executes a Query.
(package private)  void forceRolling()
           
(package private)  void get(String command)
          Gets a cached object from the current region and prints out its String value.
(package private)  void go()
          Prompts the user for input and executes the command accordingly.
(package private)  void indexes(String command)
          Prints out information about all of the indexes built in the cache.
(package private)  void initialize()
          Initializes the Cache for this example program.
(package private)  void inv(String command)
          Invalidates (either local or distributed) a region or region entry depending on the contents of command.
(package private)  void load(String command)
          Specifies the cache.xml file to use when creating the Cache.
(package private)  void lock(String command)
          Locks the current region or an entry in the current region based on the given command.
(package private)  void ls(String command)
          Lists the contents of the current region.
(package private)  void lsAtts(String command)
          Lists the map of region attributes templates that are stored in the cache
static void main(String[] args)
          Parses the command line and runs the CacheRunner example.
(package private)  void mkidx(String command)
          Creates an index.
(package private)  void mkrgn(String command)
          Creates a new subregion of the current region
(package private)  void open(String command)
          Opens the Cache and sets the current region to the "root" region.
(package private)  void printEntry(String key, Object valueBytes)
          Prints the key/value pair for an entry This method recognizes a subset of all possible object types.
(package private)  void put(String command)
          Puts an entry into the current region
(package private)  void registerInterest(String command)
          Registers interst with the server in the specific key.
(package private)  void reset()
          Reset the pending region attributes to the current region
(package private)  void rmidx(String command)
          Removes an index.
(package private)  void rollback(String command)
          Rolls back the transaction associated with the current thread
(package private)  void save()
          Save the region attributes of the current region
 void setEcho(boolean echo)
          Sets whether commands from input should be echoed to output.
(package private)  void setExpirationAttr(String command)
          Sets an expiration attribute of the current region
(package private)  void setRgnAttr(String command)
          Sets a region attribute of the current region
 void setXmlFile(File xmlFile)
          Sets the cache.xml file used to declaratively initialize the cache in this example.
(package private)  void showHelp()
          Prints information on how this program should be used.
(package private)  void showlocks()
          Prints out information about the region entries that are currently locked.
(package private)  void status(String command)
          Prints out information about the current region
(package private)  void unlock(String command)
          Unlocks the current region or an entry in the current region based on the given command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheRunner

public CacheRunner()
Method Detail

showHelp

void showHelp()
Prints information on how this program should be used.


initialize

void initialize()
          throws Exception
Initializes the Cache for this example program. Uses the LoggingCacheListener, LoggingCacheLoader, and LoggingCacheWriter.

Throws:
Exception

setEcho

public void setEcho(boolean echo)
Sets whether commands from input should be echoed to output. Default is false.


setXmlFile

public void setXmlFile(File xmlFile)
Sets the cache.xml file used to declaratively initialize the cache in this example.


main

public static void main(String[] args)
                 throws Exception
Parses the command line and runs the CacheRunner example.

Throws:
Exception

go

void go()
Prompts the user for input and executes the command accordingly.


exec

void exec(String command)
    throws QueryException
Executes a Query.

Throws:
QueryException
See Also:
Query

mkidx

void mkidx(String command)
     throws QueryException
Creates an index. Arguments are type, name, idxExpr, fromClause

Throws:
QueryException

rmidx

void rmidx(String command)
     throws QueryException
Removes an index. Argument is type

Throws:
QueryException

indexes

void indexes(String command)
Prints out information about all of the indexes built in the cache.


status

void status(String command)
      throws CacheException
Prints out information about the current region

Throws:
CacheException
See Also:
Region.getStatistics()

mkrgn

void mkrgn(String command)
     throws CacheException
Creates a new subregion of the current region

Throws:
CacheException
See Also:
Region.createSubregion(java.lang.String, com.gemstone.gemfire.cache.RegionAttributes)

showlocks

void showlocks()
Prints out information about the region entries that are currently locked.


lock

void lock(String command)
Locks the current region or an entry in the current region based on the given command.

See Also:
Region.getRegionDistributedLock(), Region.getDistributedLock(java.lang.Object)

unlock

void unlock(String command)
Unlocks the current region or an entry in the current region based on the given command.

See Also:
Lock.unlock()

chrgn

void chrgn(String command)
     throws CacheException
Changes the current region to another as specified by command.

Throws:
CacheException
See Also:
Cache.getRegion(java.lang.String), Region.getSubregion(java.lang.String), Region.getParentRegion()

inv

void inv(String command)
   throws CacheException
Invalidates (either local or distributed) a region or region entry depending on the contents of command.

Throws:
CacheException
See Also:
Region.invalidateRegion(), Region.invalidate(Object)

reset

void reset()
     throws CacheException
Reset the pending region attributes to the current region

Throws:
CacheException

save

void save()
    throws CacheException
Save the region attributes of the current region

Throws:
CacheException

attr

void attr(String command)
    throws CacheException
Prints out the current region attributes

Throws:
CacheException
See Also:
Region.getAttributes()

registerInterest

void registerInterest(String command)
                throws CacheException
Registers interst with the server in the specific key. This is only applicable to client regions and the call throws an exception if there is no BridgeWriter installed. We just let that pop up for the user of this app so they can see what their program will get.

Throws:
CacheException
See Also:
Region.registerInterest(Object)

get

void get(String command)
   throws CacheException
Gets a cached object from the current region and prints out its String value.

Throws:
CacheException
See Also:
Region.get(Object)

create

void create(String command)
      throws CacheException
Creates a new entry in the current region

Throws:
CacheException
See Also:
Region.create(Object, Object)

put

void put(String command)
   throws CacheException
Puts an entry into the current region

Throws:
CacheException
See Also:
Region.put(Object, Object)

des

void des(String command)
   throws CacheException
Destroys (local or distributed) a region or entry in the current region.

Throws:
CacheException
See Also:
Region.destroyRegion()

ls

void ls(String command)
  throws CacheException
Lists the contents of the current region.

Throws:
CacheException
See Also:
Region.entries(boolean)

lsAtts

void lsAtts(String command)
      throws CacheException
Lists the map of region attributes templates that are stored in the cache

Throws:
CacheException

printEntry

void printEntry(String key,
                Object valueBytes)
Prints the key/value pair for an entry This method recognizes a subset of all possible object types.


setExpirationAttr

void setExpirationAttr(String command)
                 throws Exception
Sets an expiration attribute of the current region

Throws:
Exception
See Also:
Region.getAttributesMutator()

setRgnAttr

void setRgnAttr(String command)
          throws Exception
Sets a region attribute of the current region

Throws:
Exception
See Also:
setExpirationAttr(java.lang.String), Region.getAttributesMutator()

load

void load(String command)
    throws CacheException
Specifies the cache.xml file to use when creating the Cache. If the Cache has already been open, then the existing one is closed.

Throws:
CacheException
See Also:
CacheFactory.create(com.gemstone.gemfire.distributed.DistributedSystem)

open

void open(String command)
    throws Exception
Opens the Cache and sets the current region to the "root" region.

Throws:
Exception
See Also:
Cache.getRegion(java.lang.String)

begin

void begin(String command)
Begins a transaction in the current thread


commit

void commit(String command)
Commits the transaction associated with the current thread. If the commit fails, information about which region entries caused the conflict can be obtained from the TransactionListener.


rollback

void rollback(String command)
Rolls back the transaction associated with the current thread


forceRolling

void forceRolling()


Copyright © 2002-2008 GemStone Systems, Inc. All Rights Reserved.