From b086f57f56bf0eb9dab9cf321a0f69aaaae84347 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 30 May 2012 08:37:45 +0200 Subject: Initial Maven Conversion --- source/com/c2kernel/entity/proxy/ItemProxy.java | 213 ------------------------ 1 file changed, 213 deletions(-) delete mode 100644 source/com/c2kernel/entity/proxy/ItemProxy.java (limited to 'source/com/c2kernel/entity/proxy/ItemProxy.java') diff --git a/source/com/c2kernel/entity/proxy/ItemProxy.java b/source/com/c2kernel/entity/proxy/ItemProxy.java deleted file mode 100644 index 658e0c8..0000000 --- a/source/com/c2kernel/entity/proxy/ItemProxy.java +++ /dev/null @@ -1,213 +0,0 @@ -/************************************************************************** - * ItemProxy.java - * - * $Revision: 1.25 $ - * $Date: 2005/05/10 11:40:09 $ - * - * Copyright (C) 2001 CERN - European Organization for Nuclear Research - * All rights reserved. - **************************************************************************/ - -package com.c2kernel.entity.proxy; - -import java.util.ArrayList; - -import com.c2kernel.common.AccessRightsException; -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.entity.Item; -import com.c2kernel.entity.ItemHelper; -import com.c2kernel.entity.ManageableEntity; -import com.c2kernel.entity.agent.Job; -import com.c2kernel.entity.agent.JobArrayList; -import com.c2kernel.lifecycle.instance.stateMachine.Transitions; -import com.c2kernel.utils.CastorXMLUtility; -import com.c2kernel.utils.Logger; - -/****************************************************************************** - * It is a wrapper for the connection and communication with Item - * It caches data loaded from the Item to reduce communication - * - * @version $Revision: 1.25 $ $Date: 2005/05/10 11:40:09 $ - * @author $Author: abranson $ - ******************************************************************************/ -public class ItemProxy extends EntityProxy -{ - - /************************************************************************** - * - **************************************************************************/ - protected ItemProxy( org.omg.CORBA.Object ior, - int systemKey) - throws ObjectNotFoundException - { - super(ior, systemKey); - - } - - @Override - public ManageableEntity narrow() throws ObjectNotFoundException - { - try { - return ItemHelper.narrow(mIOR); - } catch (org.omg.CORBA.BAD_PARAM ex) { } - throw new ObjectNotFoundException("CORBA Object was not an Item, or the server is down."); - } - /************************************************************************** - * - * - **************************************************************************/ - public void initialise( int agentId, - String itemProps, - String workflow ) - throws AccessRightsException, - InvalidDataException, - PersistencyException, - ObjectNotFoundException - { - Logger.msg(7, "ItemProxy::initialise - started"); - - ((Item)getEntity()).initialise( agentId, itemProps, workflow ); - } - - public void setProperty(AgentProxy agent, String name, String value) - throws AccessRightsException, - PersistencyException - { - String[] params = new String[2]; - params[0] = name; - params[1] = value; - try { - agent.execute(this, "WriteProperty", params); - } catch (AccessRightsException e) { - throw (e); - } catch (PersistencyException e) { - throw (e); - } catch (Exception e) { - Logger.error(e); - throw new PersistencyException("Could not store property"); - } - } - /************************************************************************** - * - **************************************************************************/ - protected void requestAction( Job thisJob ) - throws AccessRightsException, - InvalidTransitionException, - ObjectNotFoundException, - InvalidDataException, - PersistencyException, - ObjectAlreadyExistsException - { - String outcome = thisJob.getOutcomeString(); - // check fields that should have been filled in - if (outcome==null) - if (thisJob.isOutcomeUsed()) - throw new InvalidDataException("Outcome is required.", ""); - else - outcome=""; - - if (thisJob.getAgentId() == -1) - throw new InvalidDataException("No Agent specified.", ""); - - Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName()); - requestAction (thisJob.getAgentId(), thisJob.getStepPath(), - thisJob.getPossibleTransition(), outcome); - } - - //requestData is xmlString - public void requestAction( int agentId, - String stepPath, - int transitionID, - String requestData - ) - throws AccessRightsException, - InvalidTransitionException, - ObjectNotFoundException, - InvalidDataException, - PersistencyException, - ObjectAlreadyExistsException - { - ((Item)getEntity()).requestAction( agentId, - stepPath, - transitionID, - requestData ); - } - - /************************************************************************** - * - **************************************************************************/ - public String queryLifeCycle( int agentId, - boolean filter - ) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - return ((Item)getEntity()).queryLifeCycle( agentId, - filter ); - } - - - /************************************************************************** - * - **************************************************************************/ - private ArrayList getJobList(int agentId, boolean filter) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - JobArrayList thisJobList; - try { - String jobs = queryLifeCycle(agentId, filter); - thisJobList = (JobArrayList)CastorXMLUtility.unmarshall(jobs); - } - catch (Exception e) { - Logger.error(e); - throw new PersistencyException("Exception::ItemProxy::getJobList() - Cannot unmarshall the jobs", null); - } - return thisJobList.list; - } - - public ArrayList getJobList(AgentProxy agent) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - return getJobList(agent.getSystemKey()); - } - - private ArrayList getJobList(int agentId) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - return getJobList(agentId, true); - } - - private Job getJobByName(String actName, int agentId) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException { - - ArrayList jobList = getJobList(agentId); - for (Job job : jobList) { - int transition = job.getPossibleTransition(); - if (job.getStepName().equals(actName)) - if (transition == Transitions.COMPLETE || transition == Transitions.DONE) - return job; - } - return null; - - } - - public Job getJobByName(String actName, AgentProxy agent) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException { - return getJobByName(actName, agent.getSystemKey()); - } -} -- cgit v1.2.3