com.j_spaces.jca
Class GSInteraction

java.lang.Object
  extended by com.j_spaces.jca.JSInteraction
      extended by com.j_spaces.jca.GSInteraction
All Implemented Interfaces:
Interaction

public class GSInteraction
extends JSInteraction

JCA Interaction Enhanced Class - contain extended JavaSpaces methods


Field Summary
 
Fields inherited from class com.j_spaces.jca.JSInteraction
CLEAN_OPERATION, CLEAR_OPERATION, COUNT_OPERATION, EXCEPTIONTYPE_REMOTEEXCEPTION, EXCEPTIONTYPE_TX, INSTANCE_COUNT_OPERATION, NOTIFY_OPERATION, READ_OPERATION, SNAPSHOT_OPERATION, TAKE_OPERATION, WRITE_OPERATION
 
Method Summary
 IMap getCache()
          Returns the interface to IMap.
 int instanceCount(String clazz)
          Returns class instance count.
 void ping()
          Checks whether the space is alive and accessible.
 Object[] readMultiple(Object template, boolean isTx, int maxEntries)
          Reads all the pojos matching the specified template from this space.
 Object[] readMultiple(Object template, int maxEntries)
          Reads all the pojos matching the specified template from this space.
 void setSecurityContext(SecurityContext sc)
          Set Security Context.
 Object[] takeMultiple(Object template, boolean isTx, int maxEntries)
          Takes all the pojos matching the specified template from this space.
 Object[] takeMultiple(Object template, int maxEntries)
          Takes all the pojos matching the specified template from this space.
 LeaseContext update(Object pojo, boolean isTx, long timeout)
          Deprecated. Use instead #update(Entry, Entry, long, long) (@link #update(Entry, long, long) }
 Object update(Object updatedEntry, boolean isTx, long lease, long timeout)
          Updates the first entry matching the specified template, if found and there is no transaction conflict.
 LeaseContext update(Object pojo, long timeout)
          Deprecated. Use instead #update(Entry, Entry, long, long) (@link #update(Entry, long, long) }
 Object update(Object updatedEntry, long lease, long timeout)
          Updates the first pojo matching the specified template, if found and there is no transaction conflict.
 Object update(Object template, Object newObject, boolean isTx, long lease, long timeout)
          Updates the first pojo matching the specified template, if found and there is no transaction conflict.
 Object update(Object template, Object newPojo, long lease, long timeout)
          Updates the first pojo matching the specified template, if found and there is no transaction conflict.
 Object[] updateMultiple(Object[] pojos, boolean isTx, long[] leases)
          Performs batch update for the specified pojos
 Object[] updateMultiple(Object[] pojos, long[] leases)
          Performs batch update for the specified pojos
 LeaseContext[] writeMultiple(Object[] pojos, boolean isTx, long timeout)
          Writes the specified pojos to this space.
 LeaseContext[] writeMultiple(Object[] pojos, long timeout)
          Writes the specified pojos to this space.
 
Methods inherited from class com.j_spaces.jca.JSInteraction
clean, clear, clear, clearWarnings, close, count, count, execute, execute, getConnection, getSpaceAdmin, getSpaceURL, getWarnings, isSecured, notify, read, read, readIfExists, readIfExists, snapshot, take, take, takeIfExists, takeIfExists, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readMultiple

public Object[] readMultiple(Object template,
                             int maxEntries)
                      throws ResourceException
Reads all the pojos matching the specified template from this space.

Parameters:
template - the template to use for matching.
maxEntries - a limit on the number of pojos to be read. Use Integer.MAX_VALUE for the maximum value.
Returns:
an array of pojos that match the template.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

readMultiple

public Object[] readMultiple(Object template,
                             boolean isTx,
                             int maxEntries)
                      throws ResourceException
Reads all the pojos matching the specified template from this space.

Parameters:
template - the template to use for matching.
isTx - true indicates method to be done under transaction. false - without transcation
maxEntries - a limit on the number of pojos to be read. Use Integer.MAX_VALUE for the maximum value.
Returns:
an array of pojos that match the template.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

writeMultiple

public LeaseContext[] writeMultiple(Object[] pojos,
                                    long timeout)
                             throws ResourceException
Writes the specified pojos to this space.

Parameters:
pojos - the pojos to write.
timeout - the requested lease time, in milliseconds
Returns:
the leases for the written pojos.
Throws:
TransactionException
java.rmi.ResourceException
ResourceException

writeMultiple

public LeaseContext[] writeMultiple(Object[] pojos,
                                    boolean isTx,
                                    long timeout)
                             throws ResourceException
Writes the specified pojos to this space.

Parameters:
pojos - the pojos to write.
isTx - true indicates method to be done under transaction. false - without transaction
timeout - the requested lease time, in milliseconds
Returns:
the leases for the written pojos.
Throws:
TransactionException
java.rmi.ResourceException
ResourceException

takeMultiple

public Object[] takeMultiple(Object template,
                             int maxEntries)
                      throws ResourceException
Takes all the pojos matching the specified template from this space.

Parameters:
template - the template to use for matching.
maxEntries - a limit on the number of pojos to be taken. Use Integer.MAX_VALUE for the maximum value.
Returns:
an array of pojos that match the template.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

takeMultiple

public Object[] takeMultiple(Object template,
                             boolean isTx,
                             int maxEntries)
                      throws ResourceException
Takes all the pojos matching the specified template from this space.

Parameters:
template - the template to use for matching.
isTx - true indicates method to be done under transaction. false - without transcation
maxEntries - a limit on the number of pojos to be taken. Use Integer.MAX_VALUE for the maximum value.
Returns:
an array of pojos that match the template.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

update

public Object update(Object template,
                     Object newPojo,
                     long lease,
                     long timeout)
              throws ResourceException
Updates the first pojo matching the specified template, if found and there is no transaction conflict.

Parameters:
template - the template to use for matching.
newEntry - the new value of the pojo.
lease - the lease time of the new pojo
timeout - the timeout to wait for available pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

update

public Object update(Object template,
                     Object newObject,
                     boolean isTx,
                     long lease,
                     long timeout)
              throws ResourceException
Updates the first pojo matching the specified template, if found and there is no transaction conflict.

Parameters:
template - the template to use for matching.
newEntry - the new value of the pojo.
isTx - true indicates method to be done under transaction. false - without transcation
lease - the lease time of the new pojo
timeout - the timeout to wait for available pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

update

public LeaseContext update(Object pojo,
                           long timeout)
                    throws ResourceException
Deprecated. Use instead #update(Entry, Entry, long, long) (@link #update(Entry, long, long) }

Updates existing pojo . If the pojo is a new pojo it will be written to the space

Parameters:
Object - to update
timeout - - The lease timeout of the new pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
ResourceException

update

public LeaseContext update(Object pojo,
                           boolean isTx,
                           long timeout)
                    throws ResourceException
Deprecated. Use instead #update(Entry, Entry, long, long) (@link #update(Entry, long, long) }

Updates existing entry . If the entry is a new pojo it will be written to the space

Parameters:
pojo - to update
isTx - true indicates method to be done under transaction. false - without transcation
timeout - - The lease timeout of the new pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
ResourceException

update

public Object update(Object updatedEntry,
                     long lease,
                     long timeout)
              throws ResourceException
Updates the first pojo matching the specified template, if found and there is no transaction conflict.

Parameters:
updatedEntry - the updated pojo.
lease - the lease time of the new pojo
timeout - the timeout to wait for available pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

update

public Object update(Object updatedEntry,
                     boolean isTx,
                     long lease,
                     long timeout)
              throws ResourceException
Updates the first entry matching the specified template, if found and there is no transaction conflict.

Parameters:
updatedEntry - the updated pojo.
lease - the lease time of the new pojo
timeout - the timeout to wait for available pojo
Returns:
new Entry lease. If not matching pojo was found, null is returned.
Throws:
TransactionException
UnusableEntryException
java.rmi.ResourceException
ResourceException

updateMultiple

public Object[] updateMultiple(Object[] pojos,
                               long[] leases)
                        throws ResourceException
Performs batch update for the specified pojos

Parameters:
pojos - array of updated pojos
leases - array of new leases for updated pojos
Returns:
array of objects, each member in array can represent ...
Throws:
ResourceException

updateMultiple

public Object[] updateMultiple(Object[] pojos,
                               boolean isTx,
                               long[] leases)
                        throws ResourceException
Performs batch update for the specified pojos

Parameters:
pojos - array of updated pojos
isTx - true indicates method to be done under transaction. false - without transcation
leases - array of new leases for updated pojos
Returns:
array of objects, each member in array can represent ...
Throws:
ResourceException

instanceCount

public int instanceCount(String clazz)
                  throws ResourceException
Returns class instance count. This is not transactional method

Parameters:
clazz - Class Name
Returns:
the number of pojos for specified class
Throws:
ResourceException

ping

public void ping()
          throws ResourceException
Checks whether the space is alive and accessible.

Throws:
ResourceException

getCache

public IMap getCache()
              throws ResourceException
Returns the interface to IMap.

Returns:
an IMap
Throws:
ResourceException

setSecurityContext

public void setSecurityContext(SecurityContext sc)
                        throws ResourceException
Set Security Context.

Parameters:
sc - The Security Context object.
Throws:
ResourceException