use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class Script method parseIncludeTag.
private void parseIncludeTag(NodeList includeList) throws ScriptParsingException {
for (int i = 0; i < includeList.getLength(); i++) {
Element include = (Element) includeList.item(i);
if (!(include.hasAttribute("name") && include.hasAttribute("version")))
throw new ScriptParsingException("Script include declaration incomplete, must have name and version");
String includeName = include.getAttribute("name");
String includeVersion = include.getAttribute("version");
try {
Script includedScript = LocalObjectLoader.getScript(includeName, Integer.parseInt(includeVersion));
includedScript.setContext(context);
mIncludes.add(includedScript);
for (Parameter includeParam : includedScript.getInputParams().values()) {
addIncludedInputParam(includeParam.getName(), includeParam.getType());
}
} catch (NumberFormatException e) {
throw new ScriptParsingException("Invalid version in imported script name:'" + includeName + "', version:'" + includeVersion + "'");
} catch (ScriptingEngineException e) {
Logger.error(e);
throw new ScriptParsingException("Error parsing imported script " + includeName + " v" + includeVersion + ": " + e.getMessage());
} catch (ObjectNotFoundException e) {
Logger.error(e);
throw new ScriptParsingException("Error parsing imported script " + includeName + " v" + includeVersion + " not found.");
} catch (InvalidDataException e) {
Logger.error(e);
throw new ScriptParsingException("Error parsing imported script " + includeName + " v" + includeVersion + " was invalid: " + e.getMessage());
}
}
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class CorbaServer method getItem.
/**
* Returns a CORBA servant for a pre-existing entity
*
* @param itemPath the ItemPath representing the Item
* @return the servant
* @throws ObjectNotFoundException itemPath was not found
*/
public TraceableEntity getItem(ItemPath itemPath) throws ObjectNotFoundException {
Servant item = null;
if (!itemPath.exists())
throw new ObjectNotFoundException(itemPath + " does not exist");
synchronized (mItemCache) {
item = mItemCache.get(itemPath);
if (item == null) {
Logger.msg(7, "Creating new servant for " + itemPath);
item = new TraceableEntity(itemPath, mItemPOA);
mItemCache.put(itemPath, item);
}
}
return (TraceableEntity) item;
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class ItemImplementation method queryLifeCycle.
/**
*/
@Override
public String queryLifeCycle(SystemKey agentId, boolean filter) throws AccessRightsException, ObjectNotFoundException, PersistencyException {
Logger.msg(1, "ItemImplementation::queryLifeCycle(" + mItemPath + ") - agent: " + agentId);
try {
AgentPath agent;
try {
agent = new AgentPath(agentId);
} catch (InvalidItemPathException e) {
throw new AccessRightsException("Agent " + agentId + " doesn't exist");
}
Workflow wf = (Workflow) mStorage.get(mItemPath, ClusterType.LIFECYCLE + "/workflow", null);
JobArrayList jobBag = new JobArrayList();
CompositeActivity domainWf = (CompositeActivity) wf.search("workflow/domain");
jobBag.list = filter ? domainWf.calculateJobs(agent, mItemPath, true) : domainWf.calculateAllJobs(agent, mItemPath, true);
Logger.msg(1, "ItemImplementation::queryLifeCycle(" + mItemPath + ") - Returning " + jobBag.list.size() + " jobs.");
try {
return Gateway.getMarshaller().marshall(jobBag);
} catch (Exception e) {
Logger.error(e);
throw new PersistencyException("Error marshalling job bag");
}
} catch (AccessRightsException | ObjectNotFoundException | PersistencyException e) {
Logger.error(e);
throw e;
} catch (Throwable ex) {
Logger.error("ItemImplementation::queryLifeCycle(" + mItemPath + ") - Unknown error");
Logger.error(ex);
throw new PersistencyException("Unknown error querying jobs. Please see server log.");
}
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class TraceableLocator method preinvoke.
/**
************************************************************************
*
*************************************************************************
*/
@Override
public org.omg.PortableServer.Servant preinvoke(byte[] oid, org.omg.PortableServer.POA poa, String operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) {
ByteBuffer bb = ByteBuffer.wrap(oid);
long msb = bb.getLong();
long lsb = bb.getLong();
ItemPath syskey = new ItemPath(new SystemKey(msb, lsb));
Logger.msg(1, "===========================================================");
Logger.msg(1, "Item called at " + new Timestamp(System.currentTimeMillis()) + ": " + operation + "(" + syskey + ").");
try {
return Gateway.getCorbaServer().getItem(syskey);
} catch (ObjectNotFoundException ex) {
Logger.error("ObjectNotFoundException::TraceableLocator::preinvoke() " + ex.toString());
throw new org.omg.CORBA.OBJECT_NOT_EXIST();
}
}
use of org.cristalise.kernel.common.ObjectNotFoundException in project kernel by cristal-ise.
the class ActiveLocator method preinvoke.
/**
************************************************************************
*
*************************************************************************
*/
@Override
public org.omg.PortableServer.Servant preinvoke(byte[] oid, org.omg.PortableServer.POA poa, String operation, org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie) {
try {
ByteBuffer bb = ByteBuffer.wrap(oid);
long msb = bb.getLong();
long lsb = bb.getLong();
AgentPath syskey = new AgentPath(new SystemKey(msb, lsb));
Logger.msg(1, "===========================================================");
Logger.msg(1, "Agent called at " + new Timestamp(System.currentTimeMillis()) + ": " + operation + "(" + syskey + ").");
return Gateway.getCorbaServer().getAgent(syskey);
} catch (ObjectNotFoundException ex) {
Logger.error("ObjectNotFoundException::ActiveLocator::preinvoke() " + ex.toString());
throw new org.omg.CORBA.OBJECT_NOT_EXIST();
} catch (InvalidItemPathException ex) {
Logger.error("InvalidItemPathException::ActiveLocator::preinvoke() " + ex.toString());
throw new org.omg.CORBA.INV_OBJREF();
}
}
Aggregations