|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.j_spaces.core.client.ClientUIDHandler
public class ClientUIDHandler
This Class enables the client to create entry UIDs by rendering a free-string , and to extract the free-string from a UID.
Method Summary | |
---|---|
static String |
createUIDFromName(Object name,
String className)
This method is used to create a UID given a name (i.e. any free string) and the entry (full) classname. |
static void |
createUIDFromName(StringBuilder sb,
Object name,
String className)
Deprecated. use createUIDFromName(Object, String) instead. |
static String |
getNameFromUID(String uid)
Deprecated. |
static Object |
getObjectFromUID(String uid)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String createUIDFromName(Object name, String className)
This method is used to create a UID given a name (i.e. any free string) and the entry (full) classname. NOTE - it is the caller's responsibility to create a unique UID by supplying a unique name See below example:import net.jini.core.lease.Lease; import net.jini.space.JavaSpace; import com.j_spaces.core.IJSpace; import com.j_spaces.core.LeaseProxy; import com.j_spaces.core.client.EntryInfo; import com.j_spaces.core.client.SpaceFinder; import com.j_spaces.core.client.ClientUIDHandler ; public class MyEntry extends com.j_spaces.core.client.MetaDataEntry { public String myData; public MyEntry() { } public MyEntry(String data) { this.myData = data; } public String toString() { return myData; } public static void main(String[] args) { try { IJSpace space = (IJSpace) SpaceFinder.find(args[0]); space.clean(); // Setting Entry UID MyEntry myentry = new MyEntry("Data"); // ClientUIDHandler allows you to generate Valid UID Entry // you must make sure you provide unique name! String uid1 = ClientUIDHandler.createUIDFromName("MyEntryUID" ,MyEntry.class.getName() ); EntryInfo ei1 = new EntryInfo(uid1 , 0); myentry.__setEntryInfo(ei1); // Write entry to space space.write(myentry, null, Lease.FOREVER); System.out.println("Wrote Object with UID: " + myentry.__getEntryInfo().m_UID ); // Reading Entry using its UID MyEntry template = new MyEntry(); String uid2 = ClientUIDHandler.createUIDFromName("MyEntryUID", MyEntry.class.getName() ); EntryInfo ei2 = new EntryInfo(uid2 , 0); template.__setEntryInfo(ei2); MyEntry m = (MyEntry) space.read(template, null, JavaSpace.NO_WAIT); System.out.println("Read Object with UID: " + m.__getEntryInfo().m_UID + " Data: " + m.myData); } catch (Exception e) { e.printStackTrace(); } } }
name
- any free string;
The following characters are not allowed as part of the entry name: ! @ # $ % ^ & * ( ) _ + = - ? > < , . / " : ; ' | \ } { [ ] ^
className
- full class-name string
@Deprecated public static void createUIDFromName(StringBuilder sb, Object name, String className)
createUIDFromName(Object, String)
instead.
@Deprecated public static String getNameFromUID(String uid)
uid
- A valid uid string
@Deprecated public static Object getObjectFromUID(String uid)
uid
- A valid uid string
getNameFromUID(String)
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |