2022
...
Code Block |
---|
@Override public void open() throws RemoteException { // TODO Auto-generated method stub init(); sessionKey = UUID.randomUUID().toString(); logger.log(Level.INFO, "Hello World AppCode Session opened:" + sessionKey); System.out.println("Hello World AppCode Session opened:" + sessionKey); } |
Now it is time to add the read and write operations
d. ReadHello
In this read method we match the filter passed with that of the initialized parameters in the arraylist and return back the parameter which matches the key and set the value based on the sessionId initialized by prepending it with "Hello" and appending the name: "Hello:"<name>":"<sessionKey>
Code Block |
---|
public List<HelloParameter> readHello(HelloFilter filter){
logger.info("Received Read operation with filter:" + filter.key + ":with session" + sessionKey);
System.out.println("Received Read operation with filter:" + filter.key + ":with session" + sessionKey);
List<HelloParameter> returnList = new ArrayList<HelloWorldSvc.HelloParameter>();
for(HelloParameter initParam : initParams) {
if(filter.key.equalsIgnoreCase(initParam.name)) {
//Now set the value to "Hello":name:sessionId
initParam.value = "Hello:"+initParam.name+":"+sessionKey;
System.out.println("Matched Key:" + initParam.name + ":value:" + initParam.value );
logger.info("Matched Key:" + initParam.name + ":value:" + initParam.value );
returnList.add(initParam);
}
}
return returnList;
}
|