use of org.apache.geode.cache.operations.RegionCreateOperationContext in project geode by apache.
the class CacheClientProxy method getOperationContext.
private OperationContext getOperationContext(ClientMessage cmsg, String[] regionNameHolder) {
ClientUpdateMessageImpl cmsgimpl = (ClientUpdateMessageImpl) cmsg;
OperationContext opctxt = null;
// TODO SW: Special handling for DynamicRegions; this should be reworked
// when DynamicRegion API is deprecated
String regionName = cmsgimpl.getRegionName();
regionNameHolder[0] = regionName;
if (cmsgimpl.isCreate()) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
opctxt = new RegionCreateOperationContext(true);
} else {
PutOperationContext tmp = new PutOperationContext(cmsgimpl.getKeyOfInterest(), cmsgimpl.getValue(), cmsgimpl.valueIsObject(), PutOperationContext.CREATE, true);
tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
opctxt = tmp;
}
} else if (cmsgimpl.isUpdate()) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
opctxt = new RegionCreateOperationContext(true);
} else {
PutOperationContext tmp = new PutOperationContext(cmsgimpl.getKeyOfInterest(), cmsgimpl.getValue(), cmsgimpl.valueIsObject(), PutOperationContext.UPDATE, true);
tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
opctxt = tmp;
}
} else if (cmsgimpl.isDestroy()) {
if (DynamicRegionFactory.regionIsDynamicRegionList(regionName)) {
regionNameHolder[0] = (String) cmsgimpl.getKeyOfInterest();
opctxt = new RegionDestroyOperationContext(true);
} else {
DestroyOperationContext tmp = new DestroyOperationContext(cmsgimpl.getKeyOfInterest(), true);
tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
opctxt = tmp;
}
} else if (cmsgimpl.isDestroyRegion()) {
opctxt = new RegionDestroyOperationContext(true);
} else if (cmsgimpl.isInvalidate()) {
InvalidateOperationContext tmp = new InvalidateOperationContext(cmsgimpl.getKeyOfInterest(), true);
tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
opctxt = tmp;
} else if (cmsgimpl.isClearRegion()) {
RegionClearOperationContext tmp = new RegionClearOperationContext(true);
tmp.setCallbackArg(cmsgimpl.getCallbackArgument());
opctxt = tmp;
}
return opctxt;
}
Aggregations