From 5664fd4644c78f4571a1a72e6b9f0511fb10720a Mon Sep 17 00:00:00 2001 From: abranson Date: Tue, 2 Aug 2011 22:10:28 +0200 Subject: Finished move to generics. Enforced 1.6 compliance for now. No errors or warnings :) --- source/com/c2kernel/entity/proxy/EntityProxy.java | 4 ++-- source/com/c2kernel/entity/proxy/EntityProxyManager.java | 8 ++++---- source/com/c2kernel/entity/proxy/ItemProxy.java | 14 ++++++-------- source/com/c2kernel/entity/proxy/MemberSubscription.java | 15 ++++++--------- .../com/c2kernel/entity/proxy/ProxyClientConnection.java | 4 ++-- 5 files changed, 20 insertions(+), 25 deletions(-) mode change 100755 => 100644 source/com/c2kernel/entity/proxy/EntityProxy.java mode change 100755 => 100644 source/com/c2kernel/entity/proxy/EntityProxyManager.java mode change 100755 => 100644 source/com/c2kernel/entity/proxy/ItemProxy.java mode change 100755 => 100644 source/com/c2kernel/entity/proxy/MemberSubscription.java mode change 100755 => 100644 source/com/c2kernel/entity/proxy/ProxyClientConnection.java (limited to 'source/com/c2kernel/entity/proxy') diff --git a/source/com/c2kernel/entity/proxy/EntityProxy.java b/source/com/c2kernel/entity/proxy/EntityProxy.java old mode 100755 new mode 100644 index a5b6822..b34653f --- a/source/com/c2kernel/entity/proxy/EntityProxy.java +++ b/source/com/c2kernel/entity/proxy/EntityProxy.java @@ -35,7 +35,7 @@ abstract public class EntityProxy implements ManageableEntity protected ManageableEntity mEntity = null; protected org.omg.CORBA.Object mIOR; protected int mSystemKey; - private HashMap mSubscriptions; + private HashMap mSubscriptions; /************************************************************************** * @@ -60,7 +60,7 @@ abstract public class EntityProxy implements ManageableEntity mIOR = ior; mSystemKey = systemKey; - mSubscriptions = new HashMap(); + mSubscriptions = new HashMap(); } diff --git a/source/com/c2kernel/entity/proxy/EntityProxyManager.java b/source/com/c2kernel/entity/proxy/EntityProxyManager.java old mode 100755 new mode 100644 index 386bc2c..3224da7 --- a/source/com/c2kernel/entity/proxy/EntityProxyManager.java +++ b/source/com/c2kernel/entity/proxy/EntityProxyManager.java @@ -27,12 +27,12 @@ import com.c2kernel.utils.server.SimpleTCPIPServer; public class EntityProxyManager { - SoftCache proxyPool = new SoftCache(50); - HashMap treeSubscribers = new HashMap(); - HashMap connections = new HashMap(); + SoftCache proxyPool = new SoftCache(50); + HashMap treeSubscribers = new HashMap(); + HashMap connections = new HashMap(); // server objects - static ArrayList proxyClients = new ArrayList(); + static ArrayList proxyClients = new ArrayList(); static SimpleTCPIPServer proxyServer = null; static String serverName = null; diff --git a/source/com/c2kernel/entity/proxy/ItemProxy.java b/source/com/c2kernel/entity/proxy/ItemProxy.java old mode 100755 new mode 100644 index e816a53..702dd26 --- a/source/com/c2kernel/entity/proxy/ItemProxy.java +++ b/source/com/c2kernel/entity/proxy/ItemProxy.java @@ -152,7 +152,7 @@ public class ItemProxy extends EntityProxy /************************************************************************** * **************************************************************************/ - private ArrayList getJobList(int agentId, boolean filter) + private ArrayList getJobList(int agentId, boolean filter) throws AccessRightsException, ObjectNotFoundException, PersistencyException @@ -163,14 +163,13 @@ public class ItemProxy extends EntityProxy thisJobList = (JobArrayList)CastorXMLUtility.unmarshall(jobs); } catch (Exception e) { - Logger.error("Exception::ItemProxy::getJobList() - Cannot unmarshall the jobs"); Logger.error(e); - return new ArrayList(); + throw new PersistencyException("Exception::ItemProxy::getJobList() - Cannot unmarshall the jobs", null); } return thisJobList.list; } - public ArrayList getJobList(AgentProxy agent) + public ArrayList getJobList(AgentProxy agent) throws AccessRightsException, ObjectNotFoundException, PersistencyException @@ -178,7 +177,7 @@ public class ItemProxy extends EntityProxy return getJobList(agent.getSystemKey()); } - private ArrayList getJobList(int agentId) + private ArrayList getJobList(int agentId) throws AccessRightsException, ObjectNotFoundException, PersistencyException @@ -191,9 +190,8 @@ public class ItemProxy extends EntityProxy ObjectNotFoundException, PersistencyException { - ArrayList jobList = getJobList(agentId); - for (Object jobObj : jobList) { - Job job = (Job)jobObj; + ArrayList jobList = getJobList(agentId); + for (Job job : jobList) { int transition = job.getPossibleTransition(); if (job.getStepName().equals(actName)) if (transition == Transitions.COMPLETE || transition == Transitions.DONE) diff --git a/source/com/c2kernel/entity/proxy/MemberSubscription.java b/source/com/c2kernel/entity/proxy/MemberSubscription.java old mode 100755 new mode 100644 index fdd3e96..ba2d725 --- a/source/com/c2kernel/entity/proxy/MemberSubscription.java +++ b/source/com/c2kernel/entity/proxy/MemberSubscription.java @@ -2,7 +2,6 @@ package com.c2kernel.entity.proxy; import java.lang.ref.WeakReference; import java.util.ArrayList; -import java.util.Iterator; import java.util.StringTokenizer; import com.c2kernel.common.ObjectNotFoundException; @@ -13,8 +12,8 @@ public class MemberSubscription implements Runnable { EntityProxy subject; String interest; // keep the subscriber by weak reference, so it is not kept from the garbage collector if no longer used - WeakReference observerReference; - ArrayList contents = new ArrayList(); + WeakReference observerReference; + ArrayList contents = new ArrayList(); boolean preLoad; public MemberSubscription(EntityProxy subject, String interest, @@ -38,13 +37,12 @@ public class MemberSubscription implements Runnable { // fetch contents of path String children = subject.queryData(interest+"/all"); StringTokenizer tok = new StringTokenizer(children, ","); - ArrayList newContents = new ArrayList(); + ArrayList newContents = new ArrayList(); while (tok.hasMoreTokens()) newContents.add(tok.nextToken()); // look to see what's new - for (Iterator iter = newContents.iterator(); iter.hasNext();) { - String newChild = (String)iter.next(); + for (String newChild: newContents) { // load child object try { @@ -61,8 +59,7 @@ public class MemberSubscription implements Runnable { } } // report what's left in old contents as deleted - for (Iterator iter = contents.iterator(); iter.hasNext();) { - String oldChild = (String)iter.next(); + for (String oldChild: contents) { observer.remove(interest+"/"+oldChild); } //replace contents arraylist @@ -110,7 +107,7 @@ public class MemberSubscription implements Runnable { } public void setObserver(EntityProxyObserver observer) { - observerReference = new WeakReference(observer); + observerReference = new WeakReference(observer); } public EntityProxyObserver getObserver() { diff --git a/source/com/c2kernel/entity/proxy/ProxyClientConnection.java b/source/com/c2kernel/entity/proxy/ProxyClientConnection.java old mode 100755 new mode 100644 index 46f1e3d..f041012 --- a/source/com/c2kernel/entity/proxy/ProxyClientConnection.java +++ b/source/com/c2kernel/entity/proxy/ProxyClientConnection.java @@ -28,7 +28,7 @@ public class ProxyClientConnection implements SocketHandler { Socket clientSocket = null; static int clientId = -1; int thisClientId; - ArrayList sysKeys; + ArrayList sysKeys; PrintWriter response; BufferedReader request; boolean closing = false; @@ -55,7 +55,7 @@ public class ProxyClientConnection implements SocketHandler { newSocket.setSoTimeout(500); clientSocket = newSocket; response = new PrintWriter(clientSocket.getOutputStream(), true); - sysKeys = new ArrayList(); + sysKeys = new ArrayList(); } catch (SocketException ex) { Logger.msg("Could not set socket timeout:"); Logger.error(ex); -- cgit v1.2.3