diff options
| author | ogattaz <olivier@gattaz.com> | 2014-06-05 16:51:07 +0200 |
|---|---|---|
| committer | ogattaz <olivier@gattaz.com> | 2014-06-05 16:51:07 +0200 |
| commit | 2fd193d7936084de91eae46e8c2763914d87ab71 (patch) | |
| tree | b136ed97e535f11d4b3433d16c26570c89430ce4 /src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java | |
| parent | 1225792532f77e6e8f4a9addfc0c0a6cf56e89b8 (diff) | |
| parent | e73468fd08cc27aa31f76a27c916e45d5987c628 (diff) | |
Merge branch 'master' of ssh://dev.cccs.uwe.ac.uk:22/var/git/cristal-kernel
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java | 65 |
1 files changed, 0 insertions, 65 deletions
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 deleted file mode 100644 index 12bbb56..0000000 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewAgent.java +++ /dev/null @@ -1,65 +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.process.module.ModuleImport;
-import com.c2kernel.property.Property;
-import com.c2kernel.property.PropertyArrayList;
-import com.c2kernel.utils.Logger;
-
-public class NewAgent extends ModuleImport implements java.io.Serializable {
-
- public String password;
-
- public ArrayList<String> roles = new ArrayList<String>();
- public ArrayList<Property> properties = new ArrayList<Property>();
-
- public NewAgent() {
- }
-
- public NewAgent(String name, String password) {
- this.name = name;
- this.password = password;
- }
-
- public 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
- properties.add(new com.c2kernel.property.Property("Name", name, true));
- properties.add(new com.c2kernel.property.Property("Type", "Agent", false));
- try {
- newAgentEnt.initialise(Gateway.getMarshaller().marshall(new PropertyArrayList(properties)));
- } 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) {
- throw new ObjectNotFoundException("Role "+role+" does not exist.");
- }
- thisRole.addAgent(newAgent);
- }
-
- }
-
- @Override
- public String getPath(String ns) {
- return null;
- }
-}
|
