ZeroPoint ZCacheBean Technical Support

Class ZCacheBean.ZCacheClient

Object
   |
   +----ZCacheBean.ZCacheClient


public class ZCacheClient
extends Object
implements Serializable


Variable Index

 o context
 o curPrvKeyFileName
 o password
 o username
 o zsec

Constructor Index

 o ZCacheBean.ZCacheClient()

Method Index

 o delRecord(String[])
This method deletes a specific record in a table.
 o equals(Object)
 o getContext()
Gets the context name for this client.
 o getData(String[])
This method retrieves a specific record, or block of records from a table.
 o getData(String[], boolean)
 o getData(String, String[], boolean)
 o getData(String, String[])
 o getErrMsg(String)
In the case where a request return null, this method can be used to return the error message associated with the null request.
 o getFile(String)
To get a file, pass in the filename, including the relative path.
 o getFirst()
Gets the first record of the current data context.
 o getFirst(int)
Gets the first record of the current data context.
 o getFirst(String)
Gets the first record of the current data context.
 o getFirst(String, int)
Gets the first record of the current data context.
 o getIPAddress()
Gets the IP address currently assigned to access the target ZCache server.
 o getLast()
This method returns the last record in the table.
 o getLast(String)
This method returns the last record in the table.
 o getLast(String, int)
This method gets a record data set, starting from the last record location in the table, minus the number or records requested, to the last requested position-1.
 o getNext()
This method gets the record data from the next location that immediately follows the previous request.
 o getNext(String)
This method gets the record data from the next location that immediately follows the previous request.
 o getNext(int)
This method gets the record data from the next location that immediately follows the previous request.
 o getNext(String, int)
This method gets the record data from the next location that immediately follows the previous request.
 o getOutputPath()
Gets the currently defined file transfer output path.
 o getPassword()
Gets the user's password.
 o getPort()
Gets the port currently assigned to access the target ZCache server.
 o getPrev()
This method gets the record data from the location that immediately precedes the previous request's position.
 o getPrev(String)
This method gets the record data from the location that immediately precedes the previous request's position.
 o getPrev(int)
This method gets a record data set, starting from the last location that was read, minus the number or records requested, to the last requested position-1.
 o getPrev(String, int)
This method gets a record data set, starting from the last location that was read, minus the number or records requested, to the last requested position-1.
 o getSecureMode()
Sets secure mode state
 o getSecurityString()
Gets the currently defined security token.
 o getUserIdentity()
Gets the currently designated user identity string.
 o getUsername()
Gets the user name used for authentication.
 o putRecord(String, String[])
This method inserts a new record into a table.
 o putUpdate(String, String[])
This api writes an update to the referenced table.
 o setContext(String)
Sets the context name for this client.
 o setIPAddress(String)
Sets the IP address of the target ZCache server.
 o setNewSearchContext(String, String[])
Relative movements through a data set require a current position in order to function.
 o setOutputPath(String)
This sets the path that is needed for file transfer operations.
 o setPassword(String)
Sets the user's password.
 o setPort(int)
Sets the port of the ZCache server that the client is using.
 o setSecureMode(boolean)
Sets secure mode state
 o setSecurityString(String)
Sets the security token that is used to gain entry to the ZCache target server.
 o setUserIdentity(String)
Sets the user identity to be attached to accesses, for error tracking by the server administrator.
 o setUsername(String)
Sets the user name for authentication.
 o toString()

Variables

 o context

public java.lang.String context

 o curPrvKeyFileName

public java.lang.String curPrvKeyFileName

 o password

public java.lang.String password

 o username

public java.lang.String username

 o zsec

protected ZCacheBean.ZPTSecurity zsec

Constructors

 o ZCacheClient

public ZCacheClient()

Methods

 o delRecord

public final synchronized java.lang.String[] delRecord(String[] request)
This method deletes a specific record in a table.
 T:TABLE_NAME
 I:INDEX_VAL
 

Parameters:
String[] - request

 o equals

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

 o getContext

public final synchronized java.lang.String getContext()
Gets the context name for this client.

Returns:
String

 o getData

public final synchronized java.lang.String[] getData(String[] request)
This method retrieves a specific record, or block of records from a table.
 T:TABLE_NAME
 V:VIEW_NAME
 I:INDEX_VAL:766  // There can be multiple indexes
                  // : is used for specific value requests
                  // ; is used for partial match requests
                  // the value used by the index follows immediately after the : or ;
 F:FIELDNAME      // Field names of data to be retuned are defined like this
 N:10000          // number of records to return
 O:0              // offset into this block of data
 

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
String[] - request
Returns:
String[]

 o getData

public final synchronized java.lang.String[] getData(String[] request,
                                                     boolean local)

 o getData

public final synchronized java.lang.String[] getData(String threadName,
                                                     String[] request,
                                                     boolean local)

 o getData

public final synchronized java.lang.String[] getData(String threadName,
                                                     String[] request)

 o getErrMsg

public final synchronized java.lang.String getErrMsg(String threadName)
In the case where a request return null, this method can be used to return the error message associated with the null request.

Parameters:
threadName - String - Can be null
Returns:
String - An error message associated with the failed request.

 o getFile

public final synchronized int getFile(String filename)
To get a file, pass in the filename, including the relative path. ( i.e. test/hosts.txt ) The file is retrieved from ZappDataServer and placed in the output directory. The output directory is defined by String outputPath

Parameters:
String - filename

 o getFirst

public final synchronized java.lang.String[] getFirst()
Gets the first record of the current data context. The default threadName is assigned as "null".

Returns:
String[] - Returns a single record.

 o getFirst

public final synchronized java.lang.String[] getFirst(int num)
Gets the first record of the current data context.

Parameters:
num - int - The number of records you wish to return.
Returns:
String[] - An array of records results

 o getFirst

public final synchronized java.lang.String[] getFirst(String threadName)
Gets the first record of the current data context.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
Returns:
String[] - Returns a single string.

 o getFirst

public final synchronized java.lang.String[] getFirst(String threadName,
                                                      int num)
Gets the first record of the current data context.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
num - int - Specifies the number of records you want to retrieve, starting with the first record.
Returns:
String[] - Returns a single string.

 o getIPAddress

public java.lang.String getIPAddress()
Gets the IP address currently assigned to access the target ZCache server.

Returns:
String - A string description of the IP Address in dotted notation form.

 o getLast

public final synchronized java.lang.String[] getLast()
This method returns the last record in the table.

Returns:
String[] - A single record data.

 o getLast

public final synchronized java.lang.String[] getLast(String threadName)
This method returns the last record in the table.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
Returns:
String[] - A single record data.

 o getLast

public final synchronized java.lang.String[] getLast(String threadName,
                                                     int num)
This method gets a record data set, starting from the last record location in the table, minus the number or records requested, to the last requested position-1. As an example, you can use this method to request the last 10 recordsint the table.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
num - int - The number of records to retrieve.
Returns:
String[] - An array of record data.

 o getNext

public final synchronized java.lang.String[] getNext()
This method gets the record data from the next location that immediately follows the previous request.

Returns:
String[] - A single record.

 o getNext

public final synchronized java.lang.String[] getNext(String threadName)
This method gets the record data from the next location that immediately follows the previous request.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
Returns:
String[] - A single record data.

 o getNext

public final synchronized java.lang.String[] getNext(int num)
This method gets the record data from the next location that immediately follows the previous request.

Parameters:
num - int - The number of records you wish to return.
Returns:
String[] - A single record data.

 o getNext

public final synchronized java.lang.String[] getNext(String threadName,
                                                     int num)
This method gets the record data from the next location that immediately follows the previous request.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
num - int - The number of records you wish to return.
Returns:
String[] - A single record data.

 o getOutputPath

public java.lang.String getOutputPath()
Gets the currently defined file transfer output path.

Returns:
String

 o getPassword

public final synchronized java.lang.String getPassword()
Gets the user's password.

Returns:
String

 o getPort

public int getPort()
Gets the port currently assigned to access the target ZCache server.

Returns:
int

 o getPrev

public final synchronized java.lang.String[] getPrev()
This method gets the record data from the location that immediately precedes the previous request's position.

Returns:
String[] - A single record data.

 o getPrev

public final synchronized java.lang.String[] getPrev(String threadName)
This method gets the record data from the location that immediately precedes the previous request's position.

Parameters:
threadName - threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
Returns:
String[] - A single record data.

 o getPrev

public final synchronized java.lang.String[] getPrev(int num)
This method gets a record data set, starting from the last location that was read, minus the number or records requested, to the last requested position-1. As an example, you can use this method to request 10 records prior to the last accessed record.

Parameters:
num - int - The number of records to retrieve.
Returns:
String[] - An array of record data.

 o getPrev

public final synchronized java.lang.String[] getPrev(String threadName,
                                                     int num)
This method gets a record data set, starting from the last location that was read, minus the number or records requested, to the last requested position-1. As an example, you can use this method to request 10 records prior to the last accessed record.

Parameters:
String - threadName threadName is a name that identifies the thread that is using the ZCacheClient bean. This is to simplify multi-threaded use of a single bean instance.
int - num
Returns:
String[] - An array of record data.

 o getSecureMode

public boolean getSecureMode()
Sets secure mode state

Returns:
boolean

 o getSecurityString

public java.lang.String getSecurityString()
Gets the currently defined security token.

Returns:
String

 o getUserIdentity

public java.lang.String getUserIdentity()
Gets the currently designated user identity string.

Returns:
String

 o getUsername

public final synchronized java.lang.String getUsername()
Gets the user name used for authentication.

Returns:
String

 o putRecord

public final synchronized java.lang.String[] putRecord(String threadName,
                                                       String[] request)
This method inserts a new record into a table.
 T:TABLE_NAME                   // The table alias
 F:NAME:George Strait           // The fields are specified with the desired values
 F:ADDRESS:1401 Milky Way Blvd  // Note that the assigned values follow right after the :
 F:CITY:Des Moines
 F:STATE:IA
 F:ZIP:46344
 

Parameters:
String - threadName
String[] - request

 o putUpdate

public final synchronized java.lang.String[] putUpdate(String threadName,
                                                       String[] request)
This api writes an update to the referenced table. The request is in the form of a string array. Each array element is a line of the request as documented.
 T:ALIAS_NAME     // The database alias.
 I:ID:133         // The index to use for the update
 F:NAME_FLD:NAME  // The field to be modified, and the new value after the colon
 

Parameters:
String - threadName
String[] - request

 o setContext

public final synchronized void setContext(String str)
Sets the context name for this client.

Parameters:
String - contextName

 o setIPAddress

public synchronized void setIPAddress(String ipstr)
Sets the IP address of the target ZCache server.

Parameters:
ipstr - IP is a string in the dotted notation form "00.00.00.00"

 o setNewSearchContext

public final synchronized int setNewSearchContext(String threadName,
                                                  String[] request)
 Relative movements through a data set require a current position in order to
 function.  The position information needed is returned by each valid request.

 In single threaded applications, there is no need to pass in the thread name, and so
 each method is available without the thread name as a passed parameter.

 However, in multi-threaded search operations, position information is specific to each
 thread in a multiple threaded application.  For this reason, each relative position
 method requires that the thread name be passed in as a part of the request, since
 different threads might be accessing a different portion (and position) of the same data set.

 Another important problem this bean addresses is that of Zapp being restarted, which would
 invalidate currently held position information.  In order to reestablish correct positioning,
 an array that describes the base search criteria is part of a PositionInfo object that is
 maintained by the bean, so that on a failed access a new context can automatically be
 reestablished.  This greatly simplifies behaviour for users of the bean.

 setNewSearchContext (or any other specific getData() request) establishes a PositionInfo
 state for the first record, and will fill in the PositionInfo object which establishes
 a fresh context.  Once this data is returned, you can navigate relative to your current
 position using (getNext, getPrev, etc.) positioning methods.

 If you design an application that uses relative positioning it is important to remember that
 you are moving by records, and any filtering of results become your responsibility.  This is easily
 accomplished using Java's internal methods. (i.e. String.startsWith())  You can use a partial
 search to get you started, which will give you the necessary positional information the bean needs
 and then just 'getNext' until you are out of range.
 

Parameters:
threadName - String threadName, which can be set to null
request - String[] which consists of the search information, but which is not used to actually perform a search, but instead provides context information needed by ZCache. Usually this is not used, instead a getData() request will establish context. However, in the case where you want to do a getFirst(), this API will provide context without doing an extraneous search.
Returns:
String[] which will be empty.

 o setOutputPath

public synchronized void setOutputPath(String sopstr)
This sets the path that is needed for file transfer operations. The default is the current working directory of the application.

Parameters:
sopstr - String

 o setPassword

public final synchronized void setPassword(String str)
Sets the user's password.

Parameters:
String - pwd

 o setPort

public synchronized void setPort(int portnum)
Sets the port of the ZCache server that the client is using.

Parameters:
int - portnum

 o setSecureMode

public synchronized void setSecureMode(boolean state)
Sets secure mode state

Parameters:
boolean - state

 o setSecurityString

public synchronized void setSecurityString(String str)
Sets the security token that is used to gain entry to the ZCache target server. This token can be as long as you like (but must not contain a '\n'). You should use only printable characters enterable from the keyboard. The key is case sensitive. The default value is: NoNe

Parameters:
str - String

 o setUserIdentity

public synchronized void setUserIdentity(String costr)
Sets the user identity to be attached to accesses, for error tracking by the server administrator. This identity can be modified by the application to provide in depth debug information. Properly used, this feature can help identify current process information critical to error identification.

Parameters:
costr - String

 o setUsername

public final synchronized void setUsername(String str)
Sets the user name for authentication.

Parameters:
String - name

©Copyright 2007, ZeroPoint, LLC.      Questions? Comments? Email Us.