// so name
String name = message.getName();
// whether or not the incoming so is persistent
boolean persistent = message.isPersistent();
// shared object service
ISharedObjectService sharedObjectService = (ISharedObjectService) ScopeUtils.getScopeService(scope, ISharedObjectService.class, SharedObjectService.class, false);
if (!sharedObjectService.hasSharedObject(scope, name)) {
log.debug("Shared object service doesnt have requested object, creation will be attempted");
ISharedObjectSecurityService security = (ISharedObjectSecurityService) ScopeUtils.getScopeService(scope, ISharedObjectSecurityService.class);
if (security != null) {
// Check handlers to see if creation is allowed
for (ISharedObjectSecurity handler : security.getSharedObjectSecurity()) {
if (!handler.isCreationAllowed(scope, name, persistent)) {
log.debug("Shared object create failed, creation is not allowed");
sendSOCreationFailed(conn, message);
return;
}
}
}
if (!sharedObjectService.createSharedObject(scope, name, persistent)) {
log.debug("Shared object create failed");
sendSOCreationFailed(conn, message);
return;
}
}
ISharedObject so = sharedObjectService.getSharedObject(scope, name);
if (so != null) {
if (so.isPersistent() == persistent) {
log.debug("Dispatch persistent shared object");
so.dispatchEvent(message);
} else {