diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-05-30 08:37:45 +0200 |
| commit | b086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch) | |
| tree | 8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java | |
| parent | 22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff) | |
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java')
| -rw-r--r-- | source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java deleted file mode 100644 index 540a6fc..0000000 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.c2kernel.lifecycle.instance.predefined.entitycreation;
-
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-
-import com.c2kernel.common.CannotManageException;
-import com.c2kernel.common.ObjectAlreadyExistsException;
-import com.c2kernel.common.ObjectCannotBeUpdated;
-import com.c2kernel.common.ObjectNotFoundException;
-import com.c2kernel.entity.agent.ActiveEntity;
-import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.RolePath;
-import com.c2kernel.process.Gateway;
-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 String password;
-
- public ArrayList<String> roles;
-
- public NewAgent() {
- super();
- roles = new ArrayList<String>();
- }
-
- public NewAgent(String name, String password) {
- this.name = name;
- this.password = password;
- }
-
- protected void create(int agentId) throws ObjectNotFoundException, ObjectCannotBeUpdated, NoSuchAlgorithmException, CannotManageException, ObjectAlreadyExistsException {
- AgentPath newAgent = Gateway.getLDAPLookup().getNextKeyManager().generateNextAgentKey();
- newAgent.setAgentName(name);
- newAgent.setPassword(password);
- ActiveEntity newAgentEnt = (ActiveEntity)Gateway.getCorbaServer().createEntity(newAgent);
- Gateway.getLDAPLookup().add(newAgent);
- // assemble properties
- PropertyArrayList propList = new PropertyArrayList();
- propList.list.add(new com.c2kernel.property.Property("Name", name));
- propList.list.add(new com.c2kernel.property.Property("Type", "Agent"));
- try {
- newAgentEnt.initialise(CastorXMLUtility.marshall(propList));
- } catch (Exception ex) {
- Logger.error(ex);
- throw new CannotManageException("Error initialising new agent");
- }
- for (String role : roles) {
- RolePath thisRole;
- try {
- thisRole = Gateway.getLDAPLookup().getRoleManager().getRolePath(role);
- } catch (ObjectNotFoundException ex) {
- thisRole = Gateway.getLDAPLookup().getRoleManager().createRole(role, false);
- }
- thisRole.addAgent(newAgent);
- }
-
- }
-}
|
