diff options
7 files changed, 47 insertions, 8 deletions
diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index 67685e7..077ddf8 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -177,6 +177,15 @@ public class ItemProxy extends EntityProxy return thisJobList.list;
}
+ /**
+ * Returns all Jobs (possible state transitions in all active Activities) that the given Agent may perform in this Item.
+ *
+ * @param agent - the Agent who will perform the execution
+ * @return ArrayList of Jobs
+ * @throws AccessRightsException
+ * @throws ObjectNotFoundException
+ * @throws PersistencyException
+ */
public ArrayList<Job> getJobList(AgentProxy agent)
throws AccessRightsException,
ObjectNotFoundException,
@@ -221,6 +230,16 @@ public class ItemProxy extends EntityProxy return (Viewpoint)getObject(ClusterStorage.VIEWPOINT+"/"+schemaName+"/"+viewName);
}
+ /**
+ * Queries for DONE or COMPLETE Jobs in the named Activity
+ *
+ * @param actName The activity name to search for
+ * @param agent The agent who will be performing the transition
+ * @return A Job object to complete the named Activity
+ * @throws AccessRightsException
+ * @throws ObjectNotFoundException
+ * @throws PersistencyException
+ */
public Job getJobByName(String actName, AgentProxy agent)
throws AccessRightsException,
ObjectNotFoundException,
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java index ce5ec73..77a3aa5 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java @@ -110,9 +110,9 @@ public class CreateItemFromDescription extends PredefinedStep try {
wfDef = (CompositeActivityDef)LocalObjectLoader.getActDef(wfDefName, wfDefVer);
} catch (ObjectNotFoundException ex) {
- throw new InvalidDataException("Workflow def '"+wfDefName+"' item not found", "");
+ throw new InvalidDataException("Workflow def '"+wfDefName+"' v"+wfDefVer+" item not found", "");
} catch (ClassCastException ex) {
- throw new InvalidDataException("Activity def '"+wfDefName+"' was not Composite", "");
+ throw new InvalidDataException("Activity def '"+wfDefName+"' v"+wfDefVer+" was not Composite", "");
}
diff --git a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java index b143e4c..1b9a696 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java +++ b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java @@ -166,6 +166,8 @@ public class Outcome implements C2KLocalObject { }
public String getField(String name) {
+ if (getDOM() == null) return null;
+ if (getDOM().getDocumentElement() == null) return null;
NodeList elements = getDOM().getDocumentElement().getElementsByTagName(name);
if (elements.getLength() == 1 && elements.item(0).hasChildNodes() && elements.item(0).getFirstChild() instanceof Text)
return ((Text)elements.item(0).getFirstChild()).getData();
diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index 4af01aa..4f29b87 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -9,6 +9,7 @@ import java.util.StringTokenizer; import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
+import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.TraceableEntity;
import com.c2kernel.entity.proxy.ItemProxy;
@@ -29,6 +30,7 @@ import com.c2kernel.lookup.Path; import com.c2kernel.lookup.RolePath;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Outcome;
+import com.c2kernel.persistency.outcome.OutcomeValidator;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.resource.DefaultResourceImportHandler;
import com.c2kernel.process.resource.ResourceImportHandler;
@@ -184,6 +186,15 @@ public class Bootstrap Logger.msg("Bootstrap.verifyResource() - Item "+itemName+" exists but version "+version+" not found! Attempting to insert new.");
}
// data was missing or doesn't match
+ // validate it
+ OutcomeValidator validator = OutcomeValidator.getValidator(LocalObjectLoader.getSchema(newOutcome.getSchemaType(), newOutcome.getSchemaVersion()));
+ String error = validator.validate(newOutcome.getData());
+ if (error.length() > 0) {
+ Logger.error("Outcome not valid: \n " + error);
+ throw new InvalidDataException(error, "");
+ }
+
+ // store
Logger.msg("Bootstrap.verifyResource() - Writing new version "+version+" to "+newOutcome.getSchemaType()+" "+itemName);
History hist = new History(thisProxy.getSystemKey(), thisProxy);
Event newEvent = hist.addEvent("system", "Admin", Transitions.DONE, "Bootstrap", "Bootstrap", "Bootstrap", newOutcome.getSchemaType(), 0, String.valueOf(version), States.FINISHED);
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index 8182bf8..5ad6e87 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -145,7 +145,8 @@ public class Gateway //TODO: externalize this (or replace corba completely)
sysProps.put("com.sun.CORBA.POA.ORBServerId", "1");
sysProps.put("com.sun.CORBA.POA.ORBPersistentServerPort", serverPort);
-
+ sysProps.put("com.sun.CORBA.codeset.charsets", "0x05010001, 0x00010109"); // need to force UTF-8 in the Sun ORB
+ sysProps.put("com.sun.CORBA.codeset.wcharsets", "0x00010109, 0x05010001");
//Standard initialisation of the ORB
mORB = org.omg.CORBA.ORB.init(new String[0], sysProps);
@@ -358,8 +359,13 @@ public class Gateway static public org.omg.CORBA.ORB getORB()
{
if (orbDestroyed) throw new RuntimeException("Gateway has been closed. ORB is destroyed.");
- if (mORB == null)
- mORB = org.omg.CORBA.ORB.init(new String[0], null);
+ if (mORB == null) {
+ java.util.Properties sysProps = System.getProperties();
+ sysProps.put("com.sun.CORBA.codeset.charsets", "0x05010001, 0x00010109"); // need to force UTF-8 in the Sun ORB
+ sysProps.put("com.sun.CORBA.codeset.wcharsets", "0x00010109, 0x05010001");
+ mORB = org.omg.CORBA.ORB.init(new String[0], sysProps);
+ }
+
return mORB;
}
diff --git a/src/main/java/com/c2kernel/process/module/Module.java b/src/main/java/com/c2kernel/process/module/Module.java index eb3c614..f148491 100644 --- a/src/main/java/com/c2kernel/process/module/Module.java +++ b/src/main/java/com/c2kernel/process/module/Module.java @@ -82,6 +82,7 @@ public class Module { thisRes.resourceType, thisRes.resourceLocation, reset);
} catch (Exception ex) {
Logger.error(ex);
+ Logger.die("Error importing module resources. Unsafe to continue.");
}
}
diff --git a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java index 98ebbda..4b0a8b0 100644 --- a/src/main/java/com/c2kernel/utils/CastorXMLUtility.java +++ b/src/main/java/com/c2kernel/utils/CastorXMLUtility.java @@ -69,13 +69,13 @@ public class CastorXMLUtility mappingContext.addMapping(thisMapping);
} catch (MappingException ex) {
Logger.error(ex);
- throw new InvalidDataException("XML Mapping files are not valid: "+ex.getMessage());
+ throw new InvalidDataException("XML Mapping files are not valid: "+ex.getMessage(), "");
} catch (MalformedURLException ex) {
Logger.error(ex);
- throw new InvalidDataException("Mapping file location invalid: "+ex.getMessage());
+ throw new InvalidDataException("Mapping file location invalid: "+ex.getMessage(), "");
} catch (IOException ex) {
Logger.error(ex);
- throw new InvalidDataException("Could not read XML mapping files: "+ex.getMessage());
+ throw new InvalidDataException("Could not read XML mapping files: "+ex.getMessage(), "");
}
Logger.msg(1, "Loaded all maps from "+mapURL.toString());
|
