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/agent/ActiveEntity.java | 295 --------------------- 1 file changed, 295 deletions(-) delete mode 100644 source/com/c2kernel/entity/agent/ActiveEntity.java (limited to 'source/com/c2kernel/entity/agent/ActiveEntity.java') diff --git a/source/com/c2kernel/entity/agent/ActiveEntity.java b/source/com/c2kernel/entity/agent/ActiveEntity.java deleted file mode 100644 index 3d45e35..0000000 --- a/source/com/c2kernel/entity/agent/ActiveEntity.java +++ /dev/null @@ -1,295 +0,0 @@ -/************************************************************************** - * BasicAgent.java - * - * $Revision: 1.39 $ - * $Date: 2005/04/26 06:48:12 $ - * - * Copyright (C) 2001-2003 CERN - European Organization for Nuclear Research - * All rights reserved. - **************************************************************************/ - -package com.c2kernel.entity.agent; - -import java.util.Iterator; - -import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManageException; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.PersistencyException; -import com.c2kernel.entity.AgentPOA; -import com.c2kernel.entity.C2KLocalObject; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.lookup.InvalidEntityPathException; -import com.c2kernel.lookup.RolePath; -import com.c2kernel.persistency.ClusterStorageException; -import com.c2kernel.persistency.TransactionManager; -import com.c2kernel.process.Gateway; -import com.c2kernel.property.Property; -import com.c2kernel.property.PropertyArrayList; -import com.c2kernel.utils.CastorXMLUtility; -import com.c2kernel.utils.Logger; - -/************************************************************************** - * ActiveEntity - * - * @author $Author: abranson $ $Date: 2005/04/26 06:48:12 $ - * @version $Revision: 1.39 $ - **************************************************************************/ -public class ActiveEntity extends AgentPOA -{ - - /************************************************************************** - * The CORBA Portable Object Adapter which holds the Agent - **************************************************************************/ - private org.omg.PortableServer.POA mPOA = null; - - /************************************************************************** - * The C2Kernel system key of the Agent - **************************************************************************/ - private int mSystemKey = -1; - - /************************************************************************** - * Connection to the persistency backeng - **************************************************************************/ - private TransactionManager mDatabase = null; - - /************************************************************************** - * The agent's joblist - **************************************************************************/ - private JobList currentJobs; - /** - * - * @param key - * @param poa - */ - public ActiveEntity( int key, - org.omg.PortableServer.POA poa ) - { - Logger.msg(5, "ActiveEntity::constructor() - SystemKey:" + key ); - - mSystemKey = key; - mPOA = poa; - mDatabase = Gateway.getStorage(); - - Logger.msg(5, "ActiveEntity::constructor - completed."); - } - - /** - * initialise cristal2 properties & collector - */ - @Override - public void initialise( String agentProps ) - throws AccessRightsException, - InvalidDataException, - PersistencyException - { - PropertyArrayList props = null; - Logger.msg(1, "ActiveEntity::initialise("+mSystemKey+")"); - //initialise cristal2 properties & collector - try - { - props = initProps( agentProps ); - mDatabase.commit( props ); - } - catch( ClusterStorageException ex ) - { - Logger.error("ActiveEntity::init() - Failed to init props/collector, aborting!"); - Logger.error(ex); - - mDatabase.abort( props ); - throw new PersistencyException("Failed to init props => transaction aborted!"); - } - - Logger.msg(5, "ActiveEntity::init() - completed."); - } - - /** - * - * @param propsString - * @return Properties - * @throws InvalidDataException Properties cannot be unmarshalled - * @throws ClusterStorageException - */ - private PropertyArrayList initProps( String propsString ) - throws InvalidDataException, - ClusterStorageException - { - PropertyArrayList props = null; - - // create properties - if( propsString != null && !propsString.equals("") ) - { - try - { - props = (PropertyArrayList)CastorXMLUtility.unmarshall(propsString); - } - catch( Exception ex ) - { - //any exception during unmarshall indicates that data was - //incorrect or the castor mapping was not set up - Logger.error(ex); - throw new InvalidDataException(ex.toString(), null); - } - - Iterator iter = props.list.iterator(); - - while( iter.hasNext() ) - mDatabase.put( mSystemKey, iter.next(), props ); - } - else - { - Logger.warning("ActiveEntity::initProps() - NO Properties!"); - } - - return props; - } - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public org.omg.PortableServer.POA _default_POA() - { - if(mPOA != null) - return mPOA; - else - return super._default_POA(); - } - - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public int getSystemKey() - { - return mSystemKey; - } - - - /************************************************************************** - * - * - **************************************************************************/ - @Override - public String queryData(String xpath) - throws AccessRightsException, - ObjectNotFoundException, - PersistencyException - { - String result = ""; - int allPos = -1; - - Logger.msg(1, "ActiveEntity::queryData("+mSystemKey+") - " + xpath ); - - try - { - if( (allPos=xpath.indexOf("all")) != -1 ) - { - String query = xpath.substring(0,allPos); - String[] ids = mDatabase.getClusterContents( mSystemKey, query ); - - for( int i=0; i