From 2827a4b2d5aea32dc3c26a80f47309a6b68ac34b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 19 Jun 2012 21:00:29 +0200 Subject: Refactor modules Support workflows on module resources --- src/main/java/com/c2kernel/process/Bootstrap.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/c2kernel/process/Bootstrap.java') diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index 99b40f3..39a13d2 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -60,9 +60,11 @@ public class Bootstrap Thread.currentThread().setName("Bootstrapper"); // make sure all of the boot items are up-to-date + Logger.msg("Bootstrap.run() - Verifying kernel boot data items"); verifyBootDataItems(); // verify the server item's wf + Logger.msg("Bootstrap.run() - Initialising Server Item Workflow"); initServerItemWf(); // register modules @@ -159,6 +161,18 @@ public class Bootstrap String propVal = propName.equals("Name")?itemName:pd.getDefaultValue(); props.list.add(new Property(propName, propVal)); } + + // HACK: this gives all module resources a workflow. Maybe have a 'debug' flag in the module xml or server config to do this. Normally module resources should be read-only, as they would be reset at next boot. + CompositeActivity ca = new CompositeActivity(); + if (ns!=null) { + String wf; + if (itemType.equals("CA")) wf = "ManageCompositeActDef"; + else if (itemType.equals("EA")) wf = "ManageElementaryActDef"; + else if (itemType.equals("OD")) wf = "ManageSchema"; + else if (itemType.equals("SC")) wf = "ManageScript"; + else throw new Exception("Unknown bootstrap item type: "+itemType); + ca = (CompositeActivity) ((CompositeActivityDef)LocalObjectLoader.getActDef(wf, "last")).instantiate(); + } EntityPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey(); TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entityPath); @@ -166,7 +180,7 @@ public class Bootstrap newItem.initialise( 1, CastorXMLUtility.marshall(props), - CastorXMLUtility.marshall(new CompositeActivity())); + CastorXMLUtility.marshall(ca)); DomainPath newDomPath = new DomainPath(getTypeRoot(itemType).toString()+"/system/"+(ns==null?"kernel":ns)+"/"+itemName); newDomPath.setEntity(entityPath); Gateway.getLDAPLookup().add(newDomPath); -- cgit v1.2.3