From 24314dc1699c7e73048fa24e33729f1aa1ec0e86 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 6 Jul 2012 11:00:24 +0200 Subject: Modules serialize with Castor. Just about to remove the parsing. CastorXMLUtility is now a static member of gateway. Domain specific instances can be used by domain applications, but the maps do not interfere with the kernel. --- .../predefined/entitycreation/NewAgent.java | 42 +++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java index 540a6fc..07d2250 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java @@ -3,6 +3,10 @@ package com.c2kernel.lifecycle.instance.predefined.entitycreation; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + import com.c2kernel.common.CannotManageException; import com.c2kernel.common.ObjectAlreadyExistsException; import com.c2kernel.common.ObjectCannotBeUpdated; @@ -11,40 +15,54 @@ import com.c2kernel.entity.agent.ActiveEntity; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.RolePath; import com.c2kernel.process.Gateway; +import com.c2kernel.process.module.Module; +import com.c2kernel.process.module.ModuleImport; +import com.c2kernel.property.Property; import com.c2kernel.property.PropertyArrayList; -import com.c2kernel.utils.CastorXMLUtility; import com.c2kernel.utils.Logger; -public class NewAgent implements java.io.Serializable { - - public String name; +public class NewAgent extends ModuleImport implements java.io.Serializable { public String password; - public ArrayList roles; + public ArrayList roles = new ArrayList(); + public ArrayList properties = new ArrayList(); public NewAgent() { - super(); - roles = new ArrayList(); + super(null); } public NewAgent(String name, String password) { + super(null); this.name = name; this.password = password; } - protected void create(int agentId) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException, CannotManageException, ObjectAlreadyExistsException { + public NewAgent(Element imp) { + super(imp); + password = imp.getAttribute("password"); + NodeList rolenl = imp.getElementsByTagName("Role"); + for (int j=0; j