}
}
}
public static void queryEntry(ObjectGrid grid, String mapName,
String uniqueId) throws Exception {
UserProfile myUserProfile = null;
Session sess = grid.getSession();
ObjectMap map1 = null;
try {
map1 = sess.getMap(mapName);
} catch (UndefinedMapException e){
System.out.printf(
" Map '%s' does not exist on this grid. Exiting \n",
mapName);
System.exit(1);
}
List
String[] mids = null;
if (uniqueId.indexOf(",") >= 0) {
mids = uniqueId.split(",");
} else {
mids = new String[] { uniqueId };
}
for (String mid : mids) {
myUserProfile = (UserProfile) map1.get(mid);
if (myUserProfile == null) {
System.out
.printf("\nOops UserProfile with the MID '%s' has NOT been found in the following system:"
+ "\nHost/port: '%s'"
+ "\nGrid : '%s'"
+ "\nMap : '%s'\n", mid, connectionString,
grid.getName(), map1.getName());
} else {
upList.add(myUserProfile);
System.out.printf(
"\nUserProfile object with the MID '%s' has been found at"
+ "\nHost/port: '%s'" + "\nGrid : '%s'"
+ "\nMap : '%s'\n",
myUserProfile.getUniqueId(), connectionString,
grid.getName(), map1.getName());
System.out.printf("\nObject content is as follows:\n%s\n",
dumpUserProfile(myUserProfile));
}
}
}
public static void deleteEntry(ObjectGrid grid, String mapName,
String uniqueId) throws Exception {
// Get Backing Map
BackingMap bm = grid.getMap(mapName);
if (bm == null) {
System.out.printf(
" Map '%s' does not exist on this grid. Exiting \n",
mapName);
System.exit(1);
}
// Get a session
Session sess = grid.getSession();
// Get the ObjectMap
ObjectMap map1 = null;
try {
map1 = sess.getMap(mapName);
} catch (UndefinedMapException e)
{
System.out.printf(
" Map '%s' does not exist on this grid. Exiting \n",
mapName);
System.exit(1);
}
String[] mids = null;
if (uniqueId.indexOf(",") >= 0) {
mids = uniqueId.split(",");
} else {
mids = new String[] { uniqueId };
}
for (String mid : mids) {
if (!map1.containsKey(mid)) {
System.out
.printf("\nNOTHING HAS BEEN REMOVED-OBJECT WAS NOT FOUND\nUserProfile with the MID '%s' has not been found in the following system:"
+ "\nHost/port: '%s'"
+ "\nGrid : '%s'"
+ "\nMap : '%s'\n", mid, connectionString,
grid.getName(), map1.