GigaSpaces XAP 7.0 API

com.j_spaces.core.client
Class ExternalEntry

java.lang.Object
  extended by com.j_spaces.core.client.ExternalEntry
All Implemented Interfaces:
IGSEntry, Serializable, Cloneable, net.jini.core.entry.Entry
Direct Known Subclasses:
Envelope

public class ExternalEntry
extends Object
implements net.jini.core.entry.Entry, IGSEntry, Cloneable

ExternalEntry is special kind of JavaSpace entry that allows users to fill in data using simple methods to form standard Jini entry without implementing the Entry Interface or define public attribute.
The ExternalEntry objects can be used with all Space operations � write, read, take, notify, update, writeMultiple, readMultiple, writeMultiple, updateMultiple and takeMultiple.
See the example below demonstrating ExternalEntry construction:
The following Entry:


 class Message {
  public Integer id;
  public String content;

  public Message(Integer id, String content) {
      this.id = id;
      this.content = content;
  }
 }
 Message m = new Message( 1, "free text");

Can be defined as ExternalEntry in the following way:


 String[] fieldNames = {"id", "content"};
 Object[] fieldValues = { 1, "free text"};
 String[] fieldsTypes = { Integer.class.getName(), String.class.getName()};
 ExternalEntry xe = new ExternalEntry(Message.class.getName(), fieldValues, fieldNames, fieldsTypes);

Notice: When using the ExternalEntry it is not always required to assign the class field names and types array.
It should be done only when introducing a new Entry class to the Space, see ExternalEntry(String, Object[]).

ExternalEntry supports entry UID based operation.
The following example shows how to read entries from space using UIDs:


 Lease ls = space.write(xe, null, Lease.FOREVER);
 ExternalEntry result = (ExternalEntry)space.read(new ExternalEntry(((LeaseProxy)ls).getUID()),
                                                  null, Long.MAX_VALUE);

UID support can also be used with readMultiple/takeMultiple/updateMultiple operations. See the following example :

5 entries were written into the space. The Lease objects of those entries are kept in array.


 Lease[] leaseArray = new Lease[5];
 .....
 // Now we will construct array of the UIDs:
 String[] ids =
 {((LeaseProxy)leaseArray[0]).getUID(), ((LeaseProxy)leaseArray[1]).getUID(),
 ((LeaseProxy)leaseArray[2]).getUID(), ((LeaseProxy)leaseArray[3]).getUID(),
 ((LeaseProxy)leaseArray[4]).getUID()};

 Using Multiple UID ExternalEntry constructor
 ExternalEntry template = new ExternalEntry(ids);
 Entry[] res = space.takeMultiple(template, null, 5);

Please note, that readMultiple/takeMultiple are synchronous operations that return immediately.

After the completion of the above operations the res variable will contain an array that will have maximum 5 entries.

When setting the m_ReturnOnlyUids flag to true together with the readMutiple operation the res variable will contain one ExternalEntry object.
This ExternalEntry will contain at its m_MultipleUIDs field array of the relevant entry UID. All other fields of this ExternalEntry will be null.
Calling to readMultiple with ExternalEntry that includes UIDs with m_ReturnOnlyUids flag set to false will return the Entries. This approach should be used when large number of entries need to read from the space.

Remark:
If an ExternalEntry object constructed and used to share data with Java application (e.g. C++ or .Net application) that is using regular Entry object (implementing the Entry interface).
The attributes defined at the ExternalEntry field's array should be ordered according their names in alphabetically ascending order. The Class field types and the fields values array should correspond to the fields names order.

For examples � consider the following Entry class defined at the Java application:


 package com.example;
 public MyClass implements Entry {

  public String  A;
  public Integer D;
  public Long    B;
  public String  C;

  MyClass(){}
 }
 
At the C++ or .Net application the ExternalEntry should be constructed in the following way (the following is a .Net example):

 StringArray fNames = null;
 StringArray fTypes = null;
 ObjectArray fValues = null;
 ObjectArray fValuesNull = null;

 fTypes = new StringArray( 4 );
 fNames = new StringArray( 4 );
 fValuesNull = new ObjectArray(4 );
 fValues = new ObjectArray(4 );

 fValuesNull[ 0 ] = null;
 fValuesNull[ 1 ] = null;
 fValuesNull[ 2 ] = null;
 fValuesNull[ 3 ] = null;

 // Here the field names should be ordered in alphabetically ascending order
 fNames[ 0 ] = "A";
 fNames[ 1 ] = "B";
 fNames[ 2 ] = "C";
 fNames[ 3 ] = "D";

 fTypes[ 0 ] = "java.lang.String";
 fTypes[ 1 ] = "java.lang.Long";
 fTypes[ 2 ] = "java.lang.String";
 fTypes[ 3 ] = "java.lang.Integer";

 fValues[ 0 ] = new java.lang.String("A") ;
 fValues[ 1 ] = new java.lang.Long(10) ;
 fValues[ 2 ] = new java.lang.String("C") ;
 fValues[ 3 ] = new java.lang.Integer(10) ;

 // The snapshot call will introduce the class to the space in case it was not done by the Java application.
 // It will also introduce it to the client classes meta data cache
 ExternalEntry ex1 = new ExternalEntry("com.example.MyClass", fValuesNull, fNames, fTypes);
 space.snapshot(ex1);
 ExternalEntry ex2 = new ExternalEntry("com.example.MyClass", fValues);

 space.write(ex2 , null , LeaseImpl.FOREVER); 

See Also:
Serialized Form

Field Summary
 short _objectFormat
          The Object type represented by this ExternalEntry; one of ObjectFormat
 boolean[] _primitiveFields
           
 boolean _returnTrueType
           
 String m_ClassName
          The Entry class name.
 short[] m_ExtendedMatchCodes
          Codes for extending matching.
 String[] m_FieldsNames
          The Entry field names array.
 String[] m_FieldsTypes
          The Entry field Types.
 Object[] m_FieldsValues
          The Entry field values.
 boolean[] m_IndexIndicators
          Contains array of boolean values that indicate which of the class fields are index fields.
 boolean m_isFifo
          FIFO Indication, if true the entry will be returned in a FIFO way.
 boolean m_isTransient
          If true will be transient.
 String[] m_MultipleUIDs
          Contains array of UIDs.
 boolean m_NOWriteLeaseMode
          If true � Lease object would not return from the write/writeMultiple operations.
 String m_PrimaryKeyName
          The field name representing the primary key.
 Object[] m_RangeValues
          range values- correspond to m_ExtendedMatchCodes, this is UP-TO and include values.
 boolean[] m_RangeValuesInclusion
          boolean array that indicates for each range value if it is included in range or not
 boolean m_Replicatable
          Contains a tag that indicates whether the class should be replicated or not.
 boolean m_ReturnOnlyUids
          If true readMultiple/takeMultiple return only UIDs.
 String[] m_SuperClassesNames
          The Entry super classes names array.
 long m_TimeToLive
          Read only field.
 String m_UID
           Store Entry Unique ID.
 int m_VersionID
          Contains a version number that is incremented each time the entry is updated.
 String routingFieldName
          The field name representing routing field name.
 
Constructor Summary
  ExternalEntry()
          Default constructor required for java.io.Externalizable interface.
protected ExternalEntry(ExternalEntry entry)
          Copy constructor, creates a copy of this entry.
  ExternalEntry(String entryUID)
          Constructs an ExternalEntry object that will be used as a template.
  ExternalEntry(String[] multipleUIDs)
          Constructs an ExternalEntry object that will be used as a template for readMultiple/takeMultiple operations.
  ExternalEntry(String className, Object[] fieldsValues)
          Constructs an ExternalEntry object.
  ExternalEntry(String className, Object[] fieldsValues, String[] fieldsNames)
          Constructs an ExternalEntry object.
  ExternalEntry(String className, Object[] fieldsValues, String[] fieldsNames, String[] fieldsTypes)
          Constructs an ExternalEntry object.
 
Method Summary
 Object clone()
          Shallow clone
 boolean equals(Object obj)
          Checks for identical UIDs and field values.
static boolean equals(Object o1, Object o2)
          General equals method that compares two objects considering null values and multi-dimensional arrays.
 String getClassName()
          Entry class Name.
 String getCodebase()
          Entry-class codebase.
 net.jini.core.entry.Entry getEntry(IJSpace space)
          Converts to Entry object.
 com.j_spaces.core.ITypeDescriptor.Type getEntryType()
           
 short getExtendedMatchCode(int index)
          Get extended match code at specified index
 short[] getExtendedMatchCodes()
          Matching codes array.
 ExternalEntry getExternalEntry(IJSpace space)
          Convert to Entry object or ExternalEntry.
 int getFieldPosition(String fieldName)
          Return the the field position in the FieldsValues array.
 String[] getFieldsNames()
          Entry fields names.
 String[] getFieldsTypes()
          Entry Fields Types.
 Object[] getFieldsValues()
          Entry field Values.
 String getFieldType(String fieldName)
          Retries the given field its type class name.
 Object getFieldValue(int index)
          Retrieves the given field value by position.
 Object getFieldValue(String fieldName)
          Retrieves the given field value.
 short getFormat()
          Returns one of the applicable Object formats ObjectFormat.
 boolean[] getIndexIndicators()
          Indexed fields array indication.
 Map.Entry getMapEntry()
          Returns a Map.Entry (key-value pair) representation of this entity.
 String[] getMultipleUIDs()
          Array of Entry UIDs.
 Object getObject(IJSpace space)
          Converts to object.
 String getPrimaryKeyName()
          The field name representing the primary key.
 boolean[] getPrimitiveFields()
           
 Object getRangeValue(int index)
          Get range value at specified index
 boolean getRangeValueInclusion(int index)
          Get range value inclusion indicator at specified index
 Object[] getRangeValues()
          Entry range Values.
 String getRoutingFieldName()
          Get the routing field name that was selected to be the first index for partition.
 String[] getSuperClassesNames()
          Entry Super Classes Names.
 long getTimeToLive()
          Entry time to live.
 String getUID()
          Entry UID.
 int getVersion()
          Ascending version of this Entry Inherited from IGSEntry and is equivalent to calling getVersionID()
 int getVersionID()
          Entry Version ID.
 boolean hasExtendedInfo()
           
 int hashCode()
          Entry UID hashCode.
 boolean isExtended()
          Returns true if external entry has extended matching
 boolean isFifo()
          FIFO Indication.
 boolean isIndexedField(String fieldName)
          Checks if the given field is indexed.
 boolean isNOWriteLeaseMode()
          Check write mode.
 boolean isReplicatable()
          Check if replicatable, applicable only when used with partial replication.
 boolean isReturnOnlyUids()
          ReturnOnlyUids indication.
 boolean isTransient()
          Check if Transient entry.
 void makePersistent()
          Construct Persistent Entry.
 void makeTransient()
          Construct Transient Entry.
 void readExternal(ObjectInput in)
          Restore the class contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 void setClassName(String className)
          This method should be used for new Entry classes introduced to the space.
 void setExtendedMatchCodes(short[] extendedMatchCodes)
          The matching codes.
 void setFieldsNames(String[] fieldsNames)
          Set the entry field names.
 void setFieldsTypes(String[] fieldsTypes)
          Entry fields types to set.
 void setFieldsValues(Object[] fieldsValues)
          Entry field values to set.
 Object setFieldValue(int index, Object value)
          Associates the specified value with the specified field position.
 Object setFieldValue(String fieldName, Object value)
          Associates the specified value with the specified field.
 void setFifo(boolean fifo)
          Set the FIFO indication.
 void setFormat(short format)
          Sets the Object type the ExternalEntry represents, corresponding to one of the applicable ObjectFormat attributes.
 void setIndexIndicators(boolean[] indexIndicators)
          indexed fields array indication to set.
 void setMultipleUIDs(String[] multipleUIDs)
          Array of Entry UIDs to read.
 void setNOWriteLeaseMode(boolean noWriteLeaseMode)
          Set true do not return Lease object after write, false return Lease object after write.
 void setPrimaryKeyName(String fieldName)
          Sets the field name representing the primary key.
 void setRangeValues(Object[] rangeValues)
          Entry range values to set.
 void setReplicatable(boolean replicatable)
          Set the replicatable indication value.
 void setReturnOnlyUids(boolean returnOnlyUids)
          set the ReturnOnlyUids indication.
 void setRoutingFieldName(String routingFieldName)
          Set the routing field name that was selected to be the first index for partition.
 void setSuperClassesNames(String[] superClassesNames)
          set the Super Classes Names Array.
 void setTimeToLive(long timeToLive)
          Set the time left for this entry to live.
 void setTransient(boolean isTransient)
          Sets the entry to be transient (true) or persistent (false).
 void setUID(String m_uid)
          Set Entry UID.
 void setVersionID(int versionID)
          Entry Version ID.
 String toString()
          Returns a string representation of the ExternalEntry.
 void writeExternal(ObjectOutput out)
          Save the object contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

m_UID

public String m_UID
 Store Entry Unique ID.
 If this field is not null then this UID will be used
 by the Space, otherwise the space will generate it automatically.
 When entry have all its fields null (null template) and its UID is assigned,
 matching will be done using the UID only.

 The UID is a String based identifier and composed of the following parts:
 - Class information � class Hashcode and name size
 - Space node name � At clustered environment combined from �container-name :space name�. At non-clustered environment combined from dummy name.
 - Timestamp
 - Counter
 


m_ClassName

public String m_ClassName
The Entry class name.


m_SuperClassesNames

public String[] m_SuperClassesNames
The Entry super classes names array. The order of the values in the array is the class inheritance hierarchy.


m_FieldsNames

public String[] m_FieldsNames
The Entry field names array.


m_FieldsTypes

public String[] m_FieldsTypes
The Entry field Types.


m_FieldsValues

public Object[] m_FieldsValues
The Entry field values.


m_IndexIndicators

public boolean[] m_IndexIndicators
Contains array of boolean values that indicate which of the class fields are index fields.


m_PrimaryKeyName

public String m_PrimaryKeyName
The field name representing the primary key. Usually the field name of the first indexed field.

See Also:
getPrimaryKeyName()

m_Replicatable

public boolean m_Replicatable
Contains a tag that indicates whether the class should be replicated or not. Used only in the case of partial replication.


m_MultipleUIDs

public String[] m_MultipleUIDs
Contains array of UIDs. Used in readMultiple/takeMultiple operations. holds the UIDs of the Objects that are going to be read or take. when using m_ReturnOnlyUids=true the returned UIDs are are kept here in the first Entry returned.


m_ReturnOnlyUids

public boolean m_ReturnOnlyUids
If true readMultiple/takeMultiple return only UIDs.


m_isFifo

public boolean m_isFifo
FIFO Indication, if true the entry will be returned in a FIFO way.


m_VersionID

public int m_VersionID
Contains a version number that is incremented each time the entry is updated. The initial value to be stored in the space is 1, and is incremented after each update. Value is used for optimistic locking.


m_ExtendedMatchCodes

public short[] m_ExtendedMatchCodes
Codes for extending matching.

See Also:
setExtendedMatchCodes(short[])

m_RangeValues

public Object[] m_RangeValues
range values- correspond to m_ExtendedMatchCodes, this is UP-TO and include values.


m_RangeValuesInclusion

public boolean[] m_RangeValuesInclusion
boolean array that indicates for each range value if it is included in range or not


m_TimeToLive

public long m_TimeToLive
Read only field. Time (in milliseconds) left for this entry to live. This value is correct for the operation time.


m_isTransient

public boolean m_isTransient
If true will be transient.


m_NOWriteLeaseMode

public boolean m_NOWriteLeaseMode
If true � Lease object would not return from the write/writeMultiple operations.


_objectFormat

public short _objectFormat
The Object type represented by this ExternalEntry; one of ObjectFormat

See Also:
getFormat(), setFormat(short)

routingFieldName

public String routingFieldName
The field name representing routing field name. on that is taken as the first index for partition.

See Also:
getRoutingFieldName()

_primitiveFields

public boolean[] _primitiveFields

_returnTrueType

public boolean _returnTrueType
Constructor Detail

ExternalEntry

public ExternalEntry()
Default constructor required for java.io.Externalizable interface.


ExternalEntry

public ExternalEntry(String entryUID)
Constructs an ExternalEntry object that will be used as a template. The template matching will be done based on the entry UId only.

Parameters:
entryUID - entry UID.

ExternalEntry

protected ExternalEntry(ExternalEntry entry)
Copy constructor, creates a copy of this entry.

Parameters:
entry - another ExternalEntry

ExternalEntry

public ExternalEntry(String[] multipleUIDs)
Constructs an ExternalEntry object that will be used as a template for readMultiple/takeMultiple operations.
You can read/take multiple Entries from the space using their UID's in one space operation. You should construct ExternalEntry template that includes array of the Entry's UID and use this template with the readMultiple operation. See below example:
The Entry Class:

public class MyEntry extends MetaDataEntry{
        public MyEntry (){}
        public MyEntry (int num)
        {
                this.attr1 = "attr1 " + num;
                this.attr2 = "attr2 " + num;
        }
        public String attr1,attr2;
        public String toString()
        {
                return "UID:"  + __getEntryInfo().m_UID + " attr1:" + attr1 + " attr2:"+ attr2;
        }
}

The Application code:

IJSpace space = (IJSpace )SpaceFinder.find("/./mySpace");
String uid[] = new String[10];
for (int i=0; i < 10 ;i++ )
{
        uid[i] = ClientUIDHandler.createUIDFromName(i , MyEntry.class.getName());
        MyEntry entry = new MyEntry(i);
        entry.__setEntryInfo(new EntryInfo(uid[i],0));
        space.write(entry , null ,Lease.FOREVER );
}
ExternalEntry multiUIDtemplate = new ExternalEntry(uid);
Entry[] result = space.readMultiple(multiUIDtemplate , null , Integer.MAX_VALUE);
for (int i=0; i < result.length ;i++ )
{
        ExternalEntry ee = (ExternalEntry)result[i];
        System.out.println(ee.getEntry(space));
}


Parameters:
multipleUIDs - Entries UIDs array.

ExternalEntry

public ExternalEntry(String className,
                     Object[] fieldsValues,
                     String[] fieldsNames,
                     String[] fieldsTypes)
Constructs an ExternalEntry object. Use this constructor to introduce a new class to the space.

Parameters:
className - The entry class name
fieldsValues - The entry field values array
fieldsNames - The entry field names array
fieldsTypes - The entry field types array. Field types should be Java full class names.

ExternalEntry

public ExternalEntry(String className,
                     Object[] fieldsValues,
                     String[] fieldsNames)
Constructs an ExternalEntry object. Use this constructor to introduce a new class to the space.

Parameters:
className - The Entry class name
fieldsValues - The Entry field values array
fieldsNames - The Entry field names array

ExternalEntry

public ExternalEntry(String className,
                     Object[] fieldsValues)
Constructs an ExternalEntry object. Do not use this constructor to introduce new the class to the space.

Parameters:
className - The class name
fieldsValues - Entry field values array
Method Detail

getPrimitiveFields

public boolean[] getPrimitiveFields()
Specified by:
getPrimitiveFields in interface IGSEntry

hasExtendedInfo

public boolean hasExtendedInfo()

getEntryType

public com.j_spaces.core.ITypeDescriptor.Type getEntryType()
Specified by:
getEntryType in interface IGSEntry

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Save the object contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Restore the class contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

equals

public boolean equals(Object obj)
Checks for identical UIDs and field values.

Overrides:
equals in class Object
Parameters:
obj - the ExternalEntry to compare
Returns:
Returns true if identical UID and field values.

equals

public static boolean equals(Object o1,
                             Object o2)
General equals method that compares two objects considering null values and multi-dimensional arrays. In case of arrays - their members are compared recursively.

Parameters:
o1 -
o2 -
Returns:
true if two objects are equal

hashCode

public int hashCode()
Entry UID hashCode.

Overrides:
hashCode in class Object
Returns:
Returns the Entry UID hashCode.

getClassName

public String getClassName()
Entry class Name.

Specified by:
getClassName in interface IGSEntry
Returns:
Returns the Entry class Name.

setClassName

public void setClassName(String className)
This method should be used for new Entry classes introduced to the space.

Parameters:
className - The Entry class Name to set.

getExtendedMatchCodes

public short[] getExtendedMatchCodes()
Matching codes array.

Returns:
Returns the Matching codes array.

setExtendedMatchCodes

public void setExtendedMatchCodes(short[] extendedMatchCodes)
The matching codes.

Parameters:
extendedMatchCodes - The matching codes to set for template objects.
 This array should match the field values array.
 Optional Values:
 TemplateMatchCodes.EQ - equal
 TemplateMatchCodes.NE - not equal
 TemplateMatchCodes.GT - greater than
 TemplateMatchCodes.GE - grater-equal
 TemplateMatchCodes.LT - less than
 TemplateMatchCodes.LE - less-equal
 TemplateMatchCodes.IS_NULL - entry field is null (template field not relevant)
 TemplateMatchCodes.NOT_NULL - entry field is not null (template field not relevant)

getFieldsNames

public String[] getFieldsNames()
Entry fields names.

Specified by:
getFieldsNames in interface IGSEntry
Returns:
Returns the entry fields names.

setFieldsNames

public void setFieldsNames(String[] fieldsNames)
Set the entry field names.

Parameters:
fieldsNames - The entry field names

getFieldsTypes

public String[] getFieldsTypes()
Entry Fields Types.

Specified by:
getFieldsTypes in interface IGSEntry
Returns:
Returns The entry Fields Types

setFieldsTypes

public void setFieldsTypes(String[] fieldsTypes)
Entry fields types to set.

Parameters:
fieldsTypes - The Entry fields types to set. Field types are Java classes full names.

getFieldsValues

public Object[] getFieldsValues()
Entry field Values.

Specified by:
getFieldsValues in interface IGSEntry
Returns:
Returns the entry field Values

setFieldsValues

public void setFieldsValues(Object[] fieldsValues)
Entry field values to set.

Parameters:
fieldsValues - Entry field values to set

getRangeValues

public Object[] getRangeValues()
Entry range Values.

Returns:
Returns the entry range Values

setRangeValues

public void setRangeValues(Object[] rangeValues)
Entry range values to set.

Parameters:
rangeValues - Entry range values to set

isFifo

public boolean isFifo()
FIFO Indication.

Specified by:
isFifo in interface IGSEntry
Returns:
Returns the FIFO Indication.

setFifo

public void setFifo(boolean fifo)
Set the FIFO indication.

Parameters:
fifo - FIFO indication. This method should be used for new Entry Classes introduced to the space and for templates objects used for matching.

getIndexIndicators

public boolean[] getIndexIndicators()
Indexed fields array indication.

Specified by:
getIndexIndicators in interface IGSEntry
Returns:
Returns the indexed fields array indication

setIndexIndicators

public void setIndexIndicators(boolean[] indexIndicators)
indexed fields array indication to set.

Parameters:
indexIndicators - Array of fields to Index. The values of this array should match the fields array

getPrimaryKeyName

public String getPrimaryKeyName()
The field name representing the primary key. Usually the field name of the first indexed field (can be null).

Specified by:
getPrimaryKeyName in interface IGSEntry
Returns:
field name of the primary key.
See Also:
setPrimaryKeyName(String)

setPrimaryKeyName

public void setPrimaryKeyName(String fieldName)
Sets the field name representing the primary key. Usually the field name of the first indexed field.

Parameters:
fieldName - field name of the primary key.
See Also:
getPrimaryKeyName()

getMultipleUIDs

public String[] getMultipleUIDs()
Array of Entry UIDs.

Returns:
Returns Array of Entry UIDs

setMultipleUIDs

public void setMultipleUIDs(String[] multipleUIDs)
Array of Entry UIDs to read.

Parameters:
multipleUIDs - Array of Entry UIDs to read.

isReplicatable

public boolean isReplicatable()
Check if replicatable, applicable only when used with partial replication.

Specified by:
isReplicatable in interface IGSEntry
Returns:
true if this entry is replicatable.
See Also:
IReplicatable

setReplicatable

public void setReplicatable(boolean replicatable)
Set the replicatable indication value.

Parameters:
replicatable - The replicatable indication value. This method should be used with clustered spaces.

isReturnOnlyUids

public boolean isReturnOnlyUids()
ReturnOnlyUids indication.

Returns:
Returns the ReturnOnlyUids indication

setReturnOnlyUids

public void setReturnOnlyUids(boolean returnOnlyUids)
set the ReturnOnlyUids indication.

Parameters:
returnOnlyUids - set the returnOnlyUids indication value

getSuperClassesNames

public String[] getSuperClassesNames()
Entry Super Classes Names.

Specified by:
getSuperClassesNames in interface IGSEntry
Returns:
Returns the Entry Super Classes Names.

getCodebase

public String getCodebase()
Entry-class codebase.

Specified by:
getCodebase in interface IGSEntry
Returns:
default implementation returns null.

setSuperClassesNames

public void setSuperClassesNames(String[] superClassesNames)
set the Super Classes Names Array.

Parameters:
superClassesNames - The Super Classes Names Array

getTimeToLive

public long getTimeToLive()
Entry time to live.

Specified by:
getTimeToLive in interface IGSEntry
Returns:
the Entry's time to live in milliseconds.
See Also:
Lease

setTimeToLive

public void setTimeToLive(long timeToLive)
Set the time left for this entry to live.

Parameters:
timeToLive - in milliseconds

getVersion

public int getVersion()
Ascending version of this Entry Inherited from IGSEntry and is equivalent to calling getVersionID()

Specified by:
getVersion in interface IGSEntry
Returns:
the version of this entry.
See Also:
getVersionID(), setVersionID(int)

isTransient

public boolean isTransient()
Check if Transient entry.

Specified by:
isTransient in interface IGSEntry
Returns:
Returns true if Transient Entry.

setTransient

public void setTransient(boolean isTransient)
Sets the entry to be transient (true) or persistent (false).

Parameters:
isTransient -

makeTransient

public void makeTransient()
Construct Transient Entry. This method should be used with Persistent spaces. This method should be used with new entries.


makePersistent

public void makePersistent()
Construct Persistent Entry. This method should be used with Persistent spaces. This method should be used with new entries.


getMapEntry

public Map.Entry getMapEntry()
Returns a Map.Entry (key-value pair) representation of this entity. Relevant when interacting with the Space using Map API; otherwise a null is returned.

Specified by:
getMapEntry in interface IGSEntry
Returns:
a Map.Entry representation of this entity; null if no representation.
See Also:
Map.Entry

getFormat

public short getFormat()
Returns one of the applicable Object formats ObjectFormat.

Specified by:
getFormat in interface IGSEntry
Returns:
the format represented by this instance;

Default is ObjectFormat.ENTRY


setFormat

public void setFormat(short format)
Sets the Object type the ExternalEntry represents, corresponding to one of the applicable ObjectFormat attributes.

Parameters:
format - a format; Default is ObjectFormat.DEFAULT

getUID

public String getUID()
Entry UID.

Specified by:
getUID in interface IGSEntry
Returns:
Returns the Entry UID

setUID

public void setUID(String m_uid)
Set Entry UID.

Parameters:
m_uid - The Entry UID to set. When using this method make sure you are using unique value. This method should get as input returned value from ClientUIDHandler.createUIDFromName
 The UID is a String based identifier and composed of the following parts:
 - Class information � class Hashcode and name size
 - Space node name � At clustered environment combined from �container-name :space name�. At non-clustered environment combined from dummy name.
 - Timestamp
 - Counter
 

getVersionID

public int getVersionID()
Entry Version ID.

Returns:
Returns the Entry Version ID. The version number is incremented each time an entry is updated. The initial value to be stored in the space is 1, and is incremented after each update. This value is used when running in optimistic locking mode.

setVersionID

public void setVersionID(int versionID)
Entry Version ID.

Parameters:
versionID - The Entry Version ID to set.

setNOWriteLeaseMode

public void setNOWriteLeaseMode(boolean noWriteLeaseMode)
Set true do not return Lease object after write, false return Lease object after write.

Parameters:
noWriteLeaseMode - write mode.

isNOWriteLeaseMode

public boolean isNOWriteLeaseMode()
Check write mode.

Returns:
true if do not return Lease object after write, otherwise false.

getFieldValue

public Object getFieldValue(String fieldName)
Retrieves the given field value.

Specified by:
getFieldValue in interface IGSEntry
Parameters:
fieldName - name of the field (e.g. Field.getName().
Returns:
the field value.

setFieldValue

public Object setFieldValue(String fieldName,
                            Object value)
Associates the specified value with the specified field.

Specified by:
setFieldValue in interface IGSEntry
Parameters:
fieldName - the field name.
value - value to be associated with the specified field.
Returns:
the value that was associated with the specified field.

getFieldType

public String getFieldType(String fieldName)
Retries the given field its type class name.

Specified by:
getFieldType in interface IGSEntry
Parameters:
fieldName - the field name.
Returns:
the field type class name.

isIndexedField

public boolean isIndexedField(String fieldName)
Checks if the given field is indexed.

Specified by:
isIndexedField in interface IGSEntry
Parameters:
fieldName - the field name.
Returns:
true if the the field is indexed.

getFieldValue

public Object getFieldValue(int index)
                     throws IllegalArgumentException,
                            IllegalStateException
Retrieves the given field value by position.

Specified by:
getFieldValue in interface IGSEntry
Parameters:
index - the field position.
Returns:
the field value.
Throws:
IllegalArgumentException - if field name is not avaliable
IllegalStateException - if field values array was not properly set

setFieldValue

public Object setFieldValue(int index,
                            Object value)
                     throws IllegalArgumentException,
                            IllegalStateException
Associates the specified value with the specified field position.

Specified by:
setFieldValue in interface IGSEntry
Parameters:
index - the field position.
value - value to be associated with the specified field.
Returns:
the value that was associated with the specified field.
Throws:
IllegalArgumentException - if field name is not avaliable
IllegalStateException - if field values array was not properly set

getFieldPosition

public int getFieldPosition(String fieldName)
Return the the field position in the FieldsValues array.

Specified by:
getFieldPosition in interface IGSEntry
Parameters:
fieldName - name of the field (e.g. Field.getName().
Returns:
the field position in the field values array returned by {IGSEntry.getFieldsValues().

getEntry

public net.jini.core.entry.Entry getEntry(IJSpace space)
                                   throws net.jini.core.entry.UnusableEntryException
Converts to Entry object.
Notice: The returned entry is a transformation of this IGSEntry and each change in entry fields should be using IGSEntry.setFieldValue(int, Object) or IGSEntry.setFieldValue(String, Object).

Specified by:
getEntry in interface IGSEntry
Parameters:
space - Space proxy.
Returns:
Returns converted Entry.
Throws:
net.jini.core.entry.UnusableEntryException - One or more fields in the entry cannot be deserialized, or the class for the entry type itself cannot be deserialized.

getObject

public Object getObject(IJSpace space)
                 throws net.jini.core.entry.UnusableEntryException
Converts to object.
Notice: The returned object is a transformation of this IGSEntry and each change in entry fields should be using IGSEntry.setFieldValue(int, Object) or IGSEntry.setFieldValue(String, Object).

Specified by:
getObject in interface IGSEntry
Parameters:
space - Space proxy.
Returns:
Returns converted Object.
Throws:
net.jini.core.entry.UnusableEntryException - One or more fields in the entry cannot be deserialized, or the class for the entry type itself cannot be deserialized.

getExternalEntry

public ExternalEntry getExternalEntry(IJSpace space)
                               throws net.jini.core.entry.UnusableEntryException
Convert to Entry object or ExternalEntry. Notice: The returned entry is a transformation of this IGSEntry and each change in entry fields should be using IGSEntry.setFieldValue(int, Object) or IGSEntry.setFieldValue(String, Object).

Specified by:
getExternalEntry in interface IGSEntry
Parameters:
space - Space proxy.
Returns:
Returns converted ExternalEntry.
Throws:
net.jini.core.entry.UnusableEntryException - One or more fields in the entry cannot be deserialized, or the class for the entry type itself cannot be deserialized.

getRoutingFieldName

public String getRoutingFieldName()
Get the routing field name that was selected to be the first index for partition.

Specified by:
getRoutingFieldName in interface IGSEntry
Returns:
the routing field name

setRoutingFieldName

public void setRoutingFieldName(String routingFieldName)
Set the routing field name that was selected to be the first index for partition.

Parameters:
routingFieldName - the routing field name

clone

public Object clone()
Shallow clone

Overrides:
clone in class Object
Returns:
a shallow copy of this instance

getExtendedMatchCode

public short getExtendedMatchCode(int index)
Get extended match code at specified index

Parameters:
index -
Returns:

getRangeValue

public Object getRangeValue(int index)
Get range value at specified index

Parameters:
index -
Returns:

getRangeValueInclusion

public boolean getRangeValueInclusion(int index)
Get range value inclusion indicator at specified index

Parameters:
index -
Returns:

isExtended

public boolean isExtended()
Returns true if external entry has extended matching

Returns:

toString

public String toString()
Returns a string representation of the ExternalEntry.

Overrides:
toString in class Object
Returns:
a string representation of the ExternalEntry.

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.