From 0ed2c1124cf1b9e49a2ec1fa0126a8df09f9e758 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 7 Oct 2014 09:18:11 +0200 Subject: Repackage to org.cristalise --- .../com/c2kernel/entity/agent/ActiveEntity.java | 155 ------- .../com/c2kernel/entity/agent/ActiveLocator.java | 99 ----- .../c2kernel/entity/agent/AgentImplementation.java | 136 ------ src/main/java/com/c2kernel/entity/agent/Job.java | 483 --------------------- .../com/c2kernel/entity/agent/JobArrayList.java | 41 -- .../java/com/c2kernel/entity/agent/JobList.java | 137 ------ .../com/c2kernel/entity/agent/package-info.java | 32 -- 7 files changed, 1083 deletions(-) delete mode 100644 src/main/java/com/c2kernel/entity/agent/ActiveEntity.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/ActiveLocator.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/AgentImplementation.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/Job.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/JobArrayList.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/JobList.java delete mode 100644 src/main/java/com/c2kernel/entity/agent/package-info.java (limited to 'src/main/java/com/c2kernel/entity/agent') diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java b/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java deleted file mode 100644 index e497c07..0000000 --- a/src/main/java/com/c2kernel/entity/agent/ActiveEntity.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - -import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManageException; -import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.InvalidTransitionException; -import com.c2kernel.common.ObjectAlreadyExistsException; -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.PersistencyException; -import com.c2kernel.common.SystemKey; -import com.c2kernel.entity.AgentPOA; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.utils.Logger; - -/************************************************************************** - * ActiveEntity - the CORBA object representing the Agent. All functionality - * is delegated to the AgentImplementation, which extends ItemImplementation, - * as this cannot extend its equivalent TraceableEntity - * - **************************************************************************/ -public class ActiveEntity extends AgentPOA -{ - - private final org.omg.PortableServer.POA mPoa; - private final AgentImplementation mAgentImpl; - - public ActiveEntity( AgentPath key, - org.omg.PortableServer.POA poa ) - { - Logger.msg(5, "ActiveEntity::constructor() - SystemKey:" + key ); - mPoa = poa; - mAgentImpl = new AgentImplementation(key); - } - - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public org.omg.PortableServer.POA _default_POA() - { - if(mPoa != null) - return mPoa; - else - return super._default_POA(); - } - - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public SystemKey getSystemKey() - { - return mAgentImpl.getSystemKey(); - } - - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public String queryData(String path) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - synchronized (this) { - return mAgentImpl.queryData(path); - } - } - - - - /** - * Called by an activity when it reckons we need to update our joblist for it - */ - - @Override - public void refreshJobList(SystemKey sysKey, String stepPath, String newJobs) { - synchronized (this) { - mAgentImpl.refreshJobList(sysKey, stepPath, newJobs); - } - } - - @Override - public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException { - synchronized (this) { - mAgentImpl.addRole(roleName); - } - } - - @Override - public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException { - synchronized (this) { - mAgentImpl.removeRole(roleName); - } - } - - @Override - public void initialise(SystemKey agentId, String propString, String initWfString, - String initCollsString) throws AccessRightsException, - InvalidDataException, PersistencyException, ObjectNotFoundException { - synchronized (this) { - mAgentImpl.initialise(agentId, propString, initWfString, initCollsString); - } - - } - - @Override - public String requestAction(SystemKey agentID, String stepPath, int transitionID, - String requestData) throws AccessRightsException, - InvalidTransitionException, ObjectNotFoundException, - InvalidDataException, PersistencyException, - ObjectAlreadyExistsException, InvalidCollectionModification { - - synchronized (this) { - return mAgentImpl.requestAction(agentID, stepPath, transitionID, requestData); - } - - } - - @Override - public String queryLifeCycle(SystemKey agentId, boolean filter) - throws AccessRightsException, ObjectNotFoundException, - PersistencyException { - synchronized (this) { - return mAgentImpl.queryLifeCycle(agentId, filter); - } - } -} diff --git a/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java b/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java deleted file mode 100644 index ecc9d42..0000000 --- a/src/main/java/com/c2kernel/entity/agent/ActiveLocator.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - - -import java.nio.ByteBuffer; -import java.sql.Timestamp; - -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.SystemKey; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.lookup.InvalidItemPathException; -import com.c2kernel.process.Gateway; -import com.c2kernel.utils.Logger; - - -/************************************************************************** - * - * @author $Author: abranson $ $Date: 2005/10/05 07:39:36 $ - * @version $Revision: 1.9 $ - **************************************************************************/ -public class ActiveLocator extends org.omg.PortableServer.ServantLocatorPOA -{ - - /************************************************************************** - * - **************************************************************************/ - public ActiveLocator() - { - } - - - /************************************************************************** - * - **************************************************************************/ - @Override - public org.omg.PortableServer.Servant preinvoke( - byte[] oid, - org.omg.PortableServer.POA poa, - String operation, - org.omg.PortableServer.ServantLocatorPackage.CookieHolder cookie ) - { - - try - { - ByteBuffer bb = ByteBuffer.wrap(oid); - long msb = bb.getLong(); - long lsb = bb.getLong(); - AgentPath syskey = new AgentPath(new SystemKey(msb, lsb)); - - Logger.msg(1,"==========================================================="); - Logger.msg(1,"Agent called at "+new Timestamp( System.currentTimeMillis()) +": " + operation + - "(" + syskey + ")." ); - - return Gateway.getCorbaServer().getAgent(syskey); - - } - catch (ObjectNotFoundException ex) - { - Logger.error("ObjectNotFoundException::ActiveLocator::preinvoke() "+ex.toString()); - throw new org.omg.CORBA.OBJECT_NOT_EXIST(); - } catch (InvalidItemPathException ex) { - Logger.error("InvalidItemPathException::ActiveLocator::preinvoke() "+ex.toString()); - throw new org.omg.CORBA.INV_OBJREF(); - } - } - - - /************************************************************************** - * - **************************************************************************/ - @Override - public void postinvoke( - byte[] oid, - org.omg.PortableServer.POA poa, - String operation, - java.lang.Object the_cookie, - org.omg.PortableServer.Servant the_servant ) - { - } -} diff --git a/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java b/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java deleted file mode 100644 index e59c731..0000000 --- a/src/main/java/com/c2kernel/entity/agent/AgentImplementation.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - -import com.c2kernel.common.CannotManageException; -import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.SystemKey; -import com.c2kernel.entity.AgentOperations; -import com.c2kernel.entity.ItemImplementation; -import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer; -import com.c2kernel.lifecycle.instance.predefined.agent.AgentPredefinedStepContainer; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.lookup.ItemPath; -import com.c2kernel.lookup.RolePath; -import com.c2kernel.process.Gateway; -import com.c2kernel.utils.Logger; - -/** - * Implementation of Agent, though called from the CORBA implementation ActiveEntity. - * - *

The Agent is an extension of the Item that can execute Jobs, and in doing so - * change the state of Item workflows, submit data to them in the form of Outcomes - * and run any scripts associated with those activities. In this server object, - * none of this specific Agent work is performed - it all must be done using the - * client API. The server implementation only manages the Agent's data: its roles - * and persistent Jobs. - */ -public class AgentImplementation extends ItemImplementation implements - AgentOperations { - - private JobList currentJobs; - private final AgentPath mAgentPath; - - public AgentImplementation(AgentPath path) { - super(path); - mAgentPath = path; - } - - - /** - * Updates an Agent's list of Jobs relating to a particular activity. Only - * Activities that are assigned to a Role that is flagged to push Jobs do this. - * - */ - @Override - public synchronized void refreshJobList(SystemKey sysKey, String stepPath, String newJobs) { - try { - ItemPath itemPath = new ItemPath(sysKey); - JobArrayList newJobList = (JobArrayList)Gateway.getMarshaller().unmarshall(newJobs); - - // get our joblist - if (currentJobs == null) - currentJobs = new JobList( itemPath, null); - - // remove old jobs for this item - currentJobs.removeJobsForStep( itemPath, stepPath ); - - // merge new jobs in - for (Object name : newJobList.list) { - Job newJob = (Job)name; - Logger.msg(6, "Adding job for "+newJob.getItemPath()+"/"+newJob.getStepPath()+":"+newJob.getTransition().getId()); - currentJobs.addJob(newJob); - } - - } catch (Throwable ex) { - Logger.error("Could not refresh job list."); - Logger.error(ex); - } - - } - - /** Adds the given Role to this Agent. Called from the SetAgentRoles - * predefined step. - * - * @param roleName - the new Role to add - * @throws CannotManageException When the process has no lookup manager - * @throws ObjectNotFoundException - * - */ - @Override - public void addRole(String roleName) throws CannotManageException, ObjectNotFoundException { - RolePath newRole = Gateway.getLookup().getRolePath(roleName); - try { - Gateway.getLookupManager().addRole(mAgentPath, newRole); - } catch (ObjectCannotBeUpdated ex) { - throw new CannotManageException("Could not update role"); - } - } - - /** - * Removes the given Role from this Agent. Called by the SetAgentRoles - * predefined step. - * - * @param roleName - */ - @Override - public void removeRole(String roleName) throws CannotManageException, ObjectNotFoundException { - RolePath rolePath = Gateway.getLookup().getRolePath(roleName); - try { - Gateway.getLookupManager().removeRole(mAgentPath, rolePath); - } catch (ObjectCannotBeUpdated ex) { - throw new CannotManageException("Could not update role"); - } - } - - /** - * Agents have their own predefined step containers. They contain the standard - * predefined steps, plus special Agent ones related to Agent management and - * instantiation. - * - * @see com.c2kernel.lifecycle.instance.predefined.agent.AgentPredefinedStepContainer - */ - @Override - protected PredefinedStepContainer getNewPredefStepContainer() { - return new AgentPredefinedStepContainer(); - } -} diff --git a/src/main/java/com/c2kernel/entity/agent/Job.java b/src/main/java/com/c2kernel/entity/agent/Job.java deleted file mode 100644 index 72c46eb..0000000 --- a/src/main/java/com/c2kernel/entity/agent/Job.java +++ /dev/null @@ -1,483 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - -import java.util.HashMap; - -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.PersistencyException; -import com.c2kernel.entity.C2KLocalObject; -import com.c2kernel.entity.proxy.ItemProxy; -import com.c2kernel.lifecycle.instance.Activity; -import com.c2kernel.lifecycle.instance.stateMachine.Transition; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.lookup.InvalidAgentPathException; -import com.c2kernel.lookup.InvalidItemPathException; -import com.c2kernel.lookup.ItemPath; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.persistency.outcome.Outcome; -import com.c2kernel.persistency.outcome.OutcomeInitiator; -import com.c2kernel.persistency.outcome.Schema; -import com.c2kernel.persistency.outcome.Viewpoint; -import com.c2kernel.process.Gateway; -import com.c2kernel.scripting.ErrorInfo; -import com.c2kernel.utils.CastorHashMap; -import com.c2kernel.utils.KeyValuePair; -import com.c2kernel.utils.Logger; - -/******************************************************************************* - * @author $Author: abranson $ $Date: 2005/05/20 13:07:49 $ - * @version $Revision: 1.62 $ - ******************************************************************************/ - -public class Job implements C2KLocalObject -{ - // persistent - - private int id; - - private ItemPath itemPath; - - private String stepName; - - private String stepPath; - - private String stepType; - - private Transition transition; - - private String originStateName; - - private String targetStateName; - - private String agentRole; - - private CastorHashMap actProps = new CastorHashMap(); - - // non-persistent - - private String name; - - private AgentPath agentPath; - - private String agentName; - - private String outcomeData; - - private ErrorInfo error; - - private ItemProxy item = null; - - private boolean outcomeSet; - - // outcome initiator cache - - static private HashMap ocInitCache = new HashMap(); - - /*************************************************************************** - * Empty constructor for Castor - **************************************************************************/ - public Job() - { - } - - public Job(Activity act, ItemPath itemPath, Transition transition, AgentPath agent, String role) throws InvalidDataException, ObjectNotFoundException, InvalidAgentPathException { - - setItemPath(itemPath); - setStepPath(act.getPath()); - setTransition(transition); - setOriginStateName(act.getStateMachine().getState(transition.getOriginStateId()).getName()); - setTargetStateName(act.getStateMachine().getState(transition.getTargetStateId()).getName()); - setStepName(act.getName()); - setActProps(act.getProperties()); - setStepType(act.getType()); - if (agent != null) setAgentName(agent.getAgentName()); - setAgentRole(role); - } - - - // Castor persistent fields - - public String getOriginStateName() { - return originStateName; - } - - public void setOriginStateName(String originStateName) { - this.originStateName = originStateName; - } - - public String getTargetStateName() { - return targetStateName; - } - - public void setTargetStateName(String targetStateName) { - this.targetStateName = targetStateName; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - name = String.valueOf(id); - } - - public ItemPath getItemPath() { - return itemPath; - } - - public void setItemPath(ItemPath path) { - itemPath = path; - item = null; - } - - public void setItemUUID( String uuid ) throws InvalidItemPathException - { - setItemPath(new ItemPath(uuid)); - } - - public String getItemUUID() { - return getItemPath().getUUID().toString(); - } - - public String getStepName() { - return stepName; - } - - public void setStepName(String string) { - stepName = string; - } - - public String getStepPath() { - return stepPath; - } - - public void setStepPath(String string) { - stepPath = string; - } - - public String getStepType() { - return stepType; - } - - public void setStepType(String actType) { - stepType = actType; - } - - public Transition getTransition() { - return transition; - } - - public void setTransition(Transition transition) { - this.transition = transition; - } - - public AgentPath getAgentPath() throws ObjectNotFoundException { - if (agentPath == null && getAgentName() != null) { - agentPath = Gateway.getLookup().getAgentPath(getAgentName()); - } - return agentPath; - } - - public void setAgentPath(AgentPath agentPath) { - this.agentPath = agentPath; - agentName = agentPath.getAgentName(); - } - - public void setAgentUUID( String uuid ) - { - if (uuid != null) - try { - setAgentPath(AgentPath.fromUUIDString(uuid)); - } catch (InvalidAgentPathException e) { - Logger.error("Invalid agent path in Job: "+uuid); - } - } - - public String getAgentUUID() { - try { - if (getAgentPath() != null) - return getAgentPath().getUUID().toString(); - } catch (ObjectNotFoundException e) { } - return null; - } - - public String getAgentName() - { - if (agentName == null) - agentName = (String) actProps.get("Agent Name"); - return agentName; - } - - public void setAgentName(String agentName) throws ObjectNotFoundException - { - this.agentName = agentName; - agentPath = Gateway.getLookup().getAgentPath(agentName); - } - - public String getAgentRole() { - return agentRole; - } - - public void setAgentRole(String role) { - agentRole = role; - } - - public String getSchemaName() throws InvalidDataException, ObjectNotFoundException { - if (transition.hasOutcome(actProps)) { - Schema schema = transition.getSchema(actProps); - return schema.docType; - } - return null; - } - - public int getSchemaVersion() throws InvalidDataException, ObjectNotFoundException { - if (transition.hasOutcome(actProps)) { - Schema schema = transition.getSchema(actProps); - return schema.docVersion; - } - return -1; - } - - public boolean isOutcomeRequired() - { - return transition.hasOutcome(actProps) && transition.getOutcome().isRequired(); - } - - public String getScriptName() { - if (transition.hasScript(actProps)) { - return transition.getScript().getScriptName(); - } - return null; - } - - public int getScriptVersion() throws InvalidDataException { - if (transition.hasScript(actProps)) { - return transition.getScriptVersion(actProps); - } - return -1; - } - - public KeyValuePair[] getKeyValuePairs() { - return actProps.getKeyValuePairs(); - } - - public void setKeyValuePairs(KeyValuePair[] pairs) { - actProps.setKeyValuePairs(pairs); - } - - // Non-persistent fields - - @Override - public String getName() { - return name; - } - - @Override - public void setName(String name) { - this.name = name; - try { - id = Integer.parseInt(name); - } catch (NumberFormatException ex) { - id = -1; - } - } - - public ItemProxy getItemProxy() throws ObjectNotFoundException, InvalidItemPathException { - if (item == null) - item = Gateway.getProxyManager().getProxy(itemPath); - return item; - } - - public String getDescription() - { - String desc = (String) actProps.get("Description"); - if (desc == null) - desc = "No Description"; - return desc; - } - public void setOutcome(String outcome) - { - outcomeData = outcome; - outcomeSet = !(outcomeData == null); - } - - public void setError(ErrorInfo errors) - { - error = errors; - try { - outcomeData = Gateway.getMarshaller().marshall(error); - } catch (Exception e) { - Logger.error("Error marshalling ErrorInfo in job"); - Logger.error(e); - } - } - - public String getLastView() throws InvalidDataException { - String viewName = (String) getActProp("Viewpoint"); - if (viewName.length() > 0) { - // find schema - String schemaName; - try { - schemaName = getSchemaName(); - } catch (ObjectNotFoundException e1) { - throw new InvalidDataException("Schema "+getActProp("SchemaType")+" v"+getActProp("SchemaVersion")+" not found"); - } - - try { - Viewpoint view = (Viewpoint) Gateway.getStorage().get(itemPath, - ClusterStorage.VIEWPOINT + "/" + schemaName + "/" + viewName, null); - return view.getOutcome().getData(); - } catch (ObjectNotFoundException ex) { // viewpoint doesn't exist yet - return null; - } catch (PersistencyException e) { - Logger.error(e); - throw new InvalidDataException("ViewpointOutcomeInitiator: PersistencyException loading viewpoint " - + ClusterStorage.VIEWPOINT + "/" + schemaName + "/" + viewName+" in item "+itemPath.getUUID()); - } - } - else - return null; - } - - public OutcomeInitiator getOutcomeInitiator() throws InvalidDataException { - String ocInitName = (String) getActProp("OutcomeInit"); - OutcomeInitiator ocInit; - if (ocInitName.length() > 0) { - String ocPropName = "OutcomeInit."+ocInitName; - synchronized (ocInitCache) { - ocInit = ocInitCache.get(ocPropName); - if (ocInit == null) { - Object ocInitObj; - if (!Gateway.getProperties().containsKey(ocPropName)) { - throw new InvalidDataException("Outcome instantiator "+ocPropName+" isn't defined"); - } - try { - ocInitObj = Gateway.getProperties().getInstance(ocPropName); - } catch (Exception e) { - Logger.error(e); - throw new InvalidDataException("Outcome instantiator "+ocPropName+" couldn't be instantiated"); - } - ocInit = (OutcomeInitiator)ocInitObj; // throw runtime class cast if it isn't one - ocInitCache.put(ocPropName, ocInit); - } - } - return ocInit; - } - else - return null; - } - - public String getOutcomeString() throws InvalidDataException - { - if (outcomeData == null && transition.hasOutcome(actProps)) { - outcomeData = getLastView(); - if (outcomeData == null) { - OutcomeInitiator ocInit = getOutcomeInitiator(); - if (ocInit != null) - outcomeData = ocInit.initOutcome(this); - } - if (outcomeData != null) outcomeSet = true; - } - return outcomeData; - } - - public Outcome getOutcome() throws InvalidDataException, ObjectNotFoundException - { - return new Outcome(-1, getOutcomeString(), getSchemaName(), getSchemaVersion()); - } - - public boolean hasOutcome() { - return transition.hasOutcome(actProps); - } - - public boolean hasScript() { - return transition.hasScript(actProps); - } - - public boolean isOutcomeSet() { - return outcomeSet; - } - - @Override - public String getClusterType() - { - return ClusterStorage.JOB; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((itemPath == null) ? 0 : itemPath.hashCode()); - result = prime * result - + ((stepPath == null) ? 0 : stepPath.hashCode()); - result = prime * result - + ((transition == null) ? 0 : transition.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Job other = (Job) obj; - if (itemPath == null) { - if (other.itemPath != null) - return false; - } else if (!itemPath.equals(other.itemPath)) - return false; - if (stepPath == null) { - if (other.stepPath != null) - return false; - } else if (!stepPath.equals(other.stepPath)) - return false; - if (transition == null) { - if (other.transition != null) - return false; - } else if (!transition.equals(other.transition)) - return false; - return true; - } - - - private void setActProps(CastorHashMap actProps) { - this.actProps = actProps; - } - - public Object getActProp(String name) - { - return actProps.get(name); - } - - public String getActPropString(String name) - { - Object obj = getActProp(name); - return obj==null?null:String.valueOf(obj); - } -} \ No newline at end of file diff --git a/src/main/java/com/c2kernel/entity/agent/JobArrayList.java b/src/main/java/com/c2kernel/entity/agent/JobArrayList.java deleted file mode 100644 index b296714..0000000 --- a/src/main/java/com/c2kernel/entity/agent/JobArrayList.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - -import java.util.ArrayList; - -import com.c2kernel.utils.CastorArrayList; - -public class JobArrayList extends CastorArrayList -{ - - public JobArrayList() - { - super(); - } - - public JobArrayList(ArrayList aList) - { - super(aList); - } - - -} diff --git a/src/main/java/com/c2kernel/entity/agent/JobList.java b/src/main/java/com/c2kernel/entity/agent/JobList.java deleted file mode 100644 index bd7013e..0000000 --- a/src/main/java/com/c2kernel/entity/agent/JobList.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.entity.agent; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Vector; - -import com.c2kernel.lookup.ItemPath; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.persistency.RemoteMap; -import com.c2kernel.utils.Logger; - - -/************************************************************************** -* -* @author $Author: abranson $ $Date: 2006/03/03 13:52:21 $ -* @version $Revision: 1.15 $ -***************************************************************************/ -public class JobList extends RemoteMap -{ - - /************************************************************************** - * Empty constructor for Castor - **************************************************************************/ - public JobList(ItemPath itemPath, Object locker) - { - super(itemPath, ClusterStorage.JOB, locker); - } - - - /************************************************************************** - * - **************************************************************************/ - public void addJob( Job job ) - { - synchronized(this) { - int jobId = getLastId()+1; - job.setId(jobId); - put(String.valueOf(jobId), job); - } - } - - /** - * Cannot be stored - */ - @Override - public String getClusterType() { - return null; - } - - - public Job getJob(int id) { - return get(String.valueOf(id)); - } - - - /** - * @param job - */ - public void removeJobsForItem( ItemPath itemPath ) - { - Iterator currentMembers = values().iterator(); - Job j = null; - - while( currentMembers.hasNext() ) - { - j = currentMembers.next(); - - if( j.getItemPath().equals(itemPath) ) - remove( String.valueOf(j.getId()) ); - } - - Logger.msg(5, "JobList::removeJobsWithSysKey() - " + itemPath + " DONE." ); - } - - public void removeJobsForStep( ItemPath itemPath, String stepPath ) - { - ArrayList staleJobs = new ArrayList(); - Iterator jobIter = keySet().iterator(); - while( jobIter.hasNext() ) - { - String jid = jobIter.next(); - Job j = get(jid); - if( j.getItemPath().equals(itemPath) && j.getStepPath().equals(stepPath)) - staleJobs.add(jid); - } - - Logger.msg(3, "JobList.removeJobsForStep() - removing "+staleJobs.size()); - - for (String jid : staleJobs) { - remove(jid); - } - Logger.msg(5, "JobList::removeJobsForStep() - " + itemPath + " DONE." ); - } - /** - * @param itemKey - * @param string - * @return - */ - public Vector getJobsOfItem( ItemPath itemPath ) - { - Iterator currentMembers = values().iterator(); - Job j = null; - Vector jobs = new Vector(); - - while( currentMembers.hasNext() ) - { - j = currentMembers.next(); - - if( j.getItemPath().equals(itemPath) ) - jobs.add(j); - } - - Logger.msg(5, "JobList::getJobsOfSysKey() - returning " + jobs.size() + " Jobs." ); - - return jobs; - } -} \ No newline at end of file diff --git a/src/main/java/com/c2kernel/entity/agent/package-info.java b/src/main/java/com/c2kernel/entity/agent/package-info.java deleted file mode 100644 index 4ee9b29..0000000 --- a/src/main/java/com/c2kernel/entity/agent/package-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -/** - * The implementation of Agents, and their Jobs. - * - *

This package contains the classes for the implementation of - * Agents on the CRISTAL server. They correspond to the Item implementations in - * the parent package. - *

This package also contains the {@link Job} object implementation, as well - * as the RemoteMap JobList, and the marshallable container JobArrayList. - * - */ - -package com.c2kernel.entity.agent; \ No newline at end of file -- cgit v1.2.3