Fixed add/remove to/from context return
This commit is contained in:
parent
676e90dcc9
commit
122cdb8288
|
@ -81,37 +81,34 @@ public class EServiceManager {
|
||||||
public void addToContext() throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
public void addToContext() throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
HostingNode hostingNode = applicationContext.container().properties()
|
HostingNode hostingNode = applicationContext.container().properties()
|
||||||
.lookup(Constants.HOSTING_NODE_MANAGER_PROPERTY).value(HostingNodeManager.class).getHostingNode();
|
.lookup(Constants.HOSTING_NODE_MANAGER_PROPERTY).value(HostingNodeManager.class).getHostingNode();
|
||||||
boolean added = resourceRegistryPublisher.addResourceToCurrentContext(hostingNode);
|
try {
|
||||||
if (added) {
|
resourceRegistryPublisher.addResourceToCurrentContext(hostingNode);
|
||||||
logger.info("{} successfully added to current context ({})", eService,
|
logger.info("{} successfully added to current context ({})", eService, ContextUtility.getCurrentContextName());
|
||||||
ContextUtility.getCurrentContextName());
|
} catch (Exception e) {
|
||||||
} else {
|
logger.error("Unable to add {} to current context ({})", eService, ContextUtility.getCurrentContextName(), e);
|
||||||
logger.error("Unable to add {} to current context ({})", eService, ContextUtility.getCurrentContextName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromContext()
|
public void removeFromContext()
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
boolean removed = false;
|
try {
|
||||||
removed = resourceRegistryPublisher.removeResourceFromCurrentContext(eService);
|
resourceRegistryPublisher.removeResourceFromCurrentContext(eService);
|
||||||
if (removed) {
|
|
||||||
logger.info("{} successfully removed from current context ({})", eService,
|
logger.info("{} successfully removed from current context ({})", eService,
|
||||||
ContextUtility.getCurrentContextName());
|
ContextUtility.getCurrentContextName());
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to remove {} from current context ({})", eService,
|
logger.error("Unable to remove {} from current context ({})", eService,
|
||||||
ContextUtility.getCurrentContextName());
|
ContextUtility.getCurrentContextName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromContext(UUID contextUUID)
|
public void removeFromContext(UUID contextUUID)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
boolean removed = false;
|
|
||||||
String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID);
|
String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID);
|
||||||
removed = resourceRegistryPublisher.removeResourceFromContext(eService, contextUUID);
|
try {
|
||||||
if (removed) {
|
resourceRegistryPublisher.removeResourceFromContext(eService, contextUUID);
|
||||||
logger.info("{} successfully removed from context ({})", eService, contextFullName);
|
logger.info("{} successfully removed from context ({})", eService, contextFullName);
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to remove {} from current context ({})", eService, contextFullName);
|
logger.error("Unable to remove {} from current context ({})", eService, contextFullName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,38 +100,33 @@ public class HostingNodeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToContext() throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
public void addToContext() throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
boolean added = resourceRegistryPublisher.addResourceToCurrentContext(hostingNode);
|
try {
|
||||||
if (added) {
|
resourceRegistryPublisher.addResourceToCurrentContext(hostingNode);
|
||||||
logger.info("{} successfully added to current context ({})", hostingNode,
|
logger.info("{} successfully added to current context ({})", hostingNode, ContextUtility.getCurrentContextName());
|
||||||
ContextUtility.getCurrentContextName());
|
} catch (Exception e) {
|
||||||
} else {
|
logger.error("Unable to add {} to current context ({})", hostingNode, ContextUtility.getCurrentContextName(), e);
|
||||||
logger.error("Unable to add {} to current context ({})", hostingNode,
|
|
||||||
ContextUtility.getCurrentContextName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromContext()
|
public void removeFromContext()
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
boolean removed = false;
|
try {
|
||||||
removed = resourceRegistryPublisher.removeResourceFromCurrentContext(hostingNode);
|
resourceRegistryPublisher.removeResourceFromCurrentContext(hostingNode);
|
||||||
if (removed) {
|
|
||||||
logger.info("{} successfully removed from current context ({})", hostingNode,
|
logger.info("{} successfully removed from current context ({})", hostingNode,
|
||||||
ContextUtility.getCurrentContextName());
|
ContextUtility.getCurrentContextName());
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to remove {} from current context ({})", hostingNode,
|
logger.error("Unable to remove {} from current context ({})", hostingNode, ContextUtility.getCurrentContextName(), e);
|
||||||
ContextUtility.getCurrentContextName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromContext(UUID contextUUID)
|
public void removeFromContext(UUID contextUUID)
|
||||||
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
throws ResourceNotFoundException, ContextNotFoundException, ResourceRegistryException {
|
||||||
boolean removed = false;
|
|
||||||
String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID);
|
String contextFullName = ContextCache.getInstance().getContextFullNameByUUID(contextUUID);
|
||||||
removed = resourceRegistryPublisher.removeResourceFromContext(hostingNode, contextUUID);
|
try {
|
||||||
if (removed) {
|
resourceRegistryPublisher.removeResourceFromContext(hostingNode, contextUUID);
|
||||||
logger.info("{} successfully removed from context ({})", hostingNode, contextFullName);
|
logger.info("{} successfully removed from context ({})", hostingNode, contextFullName);
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
logger.error("Unable to remove {} from current context ({})", hostingNode, contextFullName);
|
logger.error("Unable to remove {} from current context ({})", hostingNode, contextFullName, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue