diff options
| author | abranson <andrew.branson@cern.ch> | 2011-08-02 22:10:28 +0200 |
|---|---|---|
| committer | abranson <andrew.branson@cern.ch> | 2011-08-02 22:10:28 +0200 |
| commit | 5664fd4644c78f4571a1a72e6b9f0511fb10720a (patch) | |
| tree | 7be1c346d1d001bf6b079089f995a60c52b955c1 /source | |
| parent | 29bbf451a22916d39017ec1a3f53f4e0f0e65ee0 (diff) | |
Finished move to generics. Enforced 1.6 compliance for now. No errors or
warnings :)
Diffstat (limited to 'source')
91 files changed, 321 insertions, 319 deletions
diff --git a/source/com/c2kernel/collection/CollectionMemberList.java b/source/com/c2kernel/collection/CollectionMemberList.java index 35f4134..3f9345e 100755..100644 --- a/source/com/c2kernel/collection/CollectionMemberList.java +++ b/source/com/c2kernel/collection/CollectionMemberList.java @@ -11,7 +11,7 @@ package com.c2kernel.collection; import com.c2kernel.utils.CastorArrayList;
-public class CollectionMemberList extends CastorArrayList
+public class CollectionMemberList extends CastorArrayList<CollectionMember>
{
public CollectionMemberList()
diff --git a/source/com/c2kernel/entity/CorbaServer.java b/source/com/c2kernel/entity/CorbaServer.java index 948b1a6..883bb1b 100755..100644 --- a/source/com/c2kernel/entity/CorbaServer.java +++ b/source/com/c2kernel/entity/CorbaServer.java @@ -31,14 +31,14 @@ import com.c2kernel.utils.SoftCache; public class CorbaServer {
- private Map mEntityCache;
+ private Map<EntityPath, Servant> mEntityCache;
private POA mRootPOA;
private POA mItemPOA;
private POA mAgentPOA;
private POAManager mPOAManager;
public CorbaServer() throws InvalidDataException {
- mEntityCache = new SoftCache(50);
+ mEntityCache = new SoftCache<EntityPath, Servant>(50);
// init POA
try {
diff --git a/source/com/c2kernel/entity/agent/JobArrayList.java b/source/com/c2kernel/entity/agent/JobArrayList.java index b6eb2c2..fa85368 100755..100644 --- a/source/com/c2kernel/entity/agent/JobArrayList.java +++ b/source/com/c2kernel/entity/agent/JobArrayList.java @@ -13,7 +13,7 @@ import java.util.ArrayList; import com.c2kernel.utils.CastorArrayList;
-public class JobArrayList extends CastorArrayList
+public class JobArrayList extends CastorArrayList<Job>
{
public JobArrayList()
@@ -21,7 +21,7 @@ public class JobArrayList extends CastorArrayList super();
}
- public JobArrayList(ArrayList aList)
+ public JobArrayList(ArrayList<Job> aList)
{
super(aList);
}
diff --git a/source/com/c2kernel/entity/agent/JobList.java b/source/com/c2kernel/entity/agent/JobList.java index d0d05d5..15ce0dd 100755..100644 --- a/source/com/c2kernel/entity/agent/JobList.java +++ b/source/com/c2kernel/entity/agent/JobList.java @@ -108,7 +108,7 @@ public class JobList extends RemoteMap {
Iterator currentMembers = values().iterator();
Job j = null;
- Vector jobs = new Vector();
+ Vector<Job> jobs = new Vector<Job>();
while( currentMembers.hasNext() )
{
diff --git a/source/com/c2kernel/entity/proxy/EntityProxy.java b/source/com/c2kernel/entity/proxy/EntityProxy.java index a5b6822..b34653f 100755..100644 --- 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<MemberSubscription, EntityProxyObserver> mSubscriptions;
/**************************************************************************
*
@@ -60,7 +60,7 @@ abstract public class EntityProxy implements ManageableEntity mIOR = ior;
mSystemKey = systemKey;
- mSubscriptions = new HashMap();
+ mSubscriptions = new HashMap<MemberSubscription, EntityProxyObserver>();
}
diff --git a/source/com/c2kernel/entity/proxy/EntityProxyManager.java b/source/com/c2kernel/entity/proxy/EntityProxyManager.java index 386bc2c..3224da7 100755..100644 --- 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<Integer, EntityProxy> proxyPool = new SoftCache<Integer, EntityProxy>(50);
+ HashMap<DomainPathSubscriber, DomainPath> treeSubscribers = new HashMap<DomainPathSubscriber, DomainPath>();
+ HashMap<String, ProxyServerConnection> connections = new HashMap<String, ProxyServerConnection>();
// server objects
- static ArrayList proxyClients = new ArrayList();
+ static ArrayList<ProxyClientConnection> proxyClients = new ArrayList<ProxyClientConnection>();
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 index e816a53..702dd26 100755..100644 --- 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<Job> 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<Job> 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<Job> 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<Job> 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 index fdd3e96..ba2d725 100755..100644 --- 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<EntityProxyObserver> observerReference;
+ ArrayList<String> contents = new ArrayList<String>();
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<String> newContents = new ArrayList<String>();
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<EntityProxyObserver>(observer);
}
public EntityProxyObserver getObserver() {
diff --git a/source/com/c2kernel/entity/proxy/ProxyClientConnection.java b/source/com/c2kernel/entity/proxy/ProxyClientConnection.java index 46f1e3d..f041012 100755..100644 --- 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<Integer> 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<Integer>();
} catch (SocketException ex) {
Logger.msg("Could not set socket timeout:");
Logger.error(ex);
diff --git a/source/com/c2kernel/entity/transfer/TransferItem.java b/source/com/c2kernel/entity/transfer/TransferItem.java index a869741..e4e84ec 100755..100644 --- a/source/com/c2kernel/entity/transfer/TransferItem.java +++ b/source/com/c2kernel/entity/transfer/TransferItem.java @@ -14,7 +14,7 @@ import com.c2kernel.property.*; import com.c2kernel.utils.*;
public class TransferItem {
- public ArrayList domainPaths;
+ public ArrayList<String> domainPaths;
public int sysKey;
static int importAgentId;
@@ -29,7 +29,7 @@ public class TransferItem { public TransferItem(int sysKey) throws Exception {
this.sysKey = sysKey;
- domainPaths = new ArrayList();
+ domainPaths = new ArrayList<String>();
Property name = (Property)Gateway.getStorage().get(sysKey, ClusterStorage.PROPERTY + "/Name", null);
Enumeration paths = Gateway.getLDAPLookup().search(new DomainPath(), name.getValue());
while (paths.hasMoreElements()) {
@@ -69,7 +69,7 @@ public class TransferItem { ArrayList events, outcomes, viewpoints = new ArrayList();
// retrieve objects
ArrayList objectFiles = FileStringUtility.listDir(dir.getCanonicalPath(), false, true);
- ArrayList objects = new ArrayList();
+ ArrayList<C2KLocalObject> objects = new ArrayList<C2KLocalObject>();
for (Iterator iter = objectFiles.iterator(); iter.hasNext();) {
String element = (String)iter.next();
String xmlFile = FileStringUtility.file2String(element);
@@ -95,7 +95,7 @@ public class TransferItem { for (Iterator iter = objects.iterator(); iter.hasNext();) {
C2KLocalObject obj = (C2KLocalObject)iter.next();
if (obj instanceof Property)
- props.list.add(obj);
+ props.list.add((Property)obj);
else if (obj instanceof Workflow)
wf = (Workflow)obj;
}
diff --git a/source/com/c2kernel/entity/transfer/TransferSet.java b/source/com/c2kernel/entity/transfer/TransferSet.java index ee98f8d..f67ba9c 100755..100644 --- a/source/com/c2kernel/entity/transfer/TransferSet.java +++ b/source/com/c2kernel/entity/transfer/TransferSet.java @@ -22,13 +22,13 @@ import com.c2kernel.utils.Logger; public class TransferSet {
- public ArrayList items;
+ public ArrayList<TransferItem> items;
public TransferSet() {
}
public TransferSet(int[] sysKeys) {
- items = new ArrayList();
+ items = new ArrayList<TransferItem>();
for (int i = 0; i < sysKeys.length; i++) {
try {
items.add(new TransferItem(sysKeys[i]));
diff --git a/source/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java b/source/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java index e243817..4b429fa 100755..100644 --- a/source/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java +++ b/source/com/c2kernel/graph/layout/DefaultGraphLayoutGenerator.java @@ -19,7 +19,7 @@ public class DefaultGraphLayoutGenerator { public static void layoutGraph(GraphModel graphModel) {
Vertex start = graphModel.getStartVertex();
- Vector rowVector = new Vector(10, 10);
+ Vector<Vector<Vertex>> rowVector = new Vector<Vector<Vertex>>(10, 10);
int[] midPoints = null;
IntegerWrapper valueOfLargestMidPoint = new IntegerWrapper(0);
if (start == null) {
@@ -35,7 +35,7 @@ public class DefaultGraphLayoutGenerator { graphModel.forceNotify();
}
- private static void visitVertex(GraphModel graphModel, Vertex vertex, int rowIndex, Vector rowVector, Object tag) {
+ private static void visitVertex(GraphModel graphModel, Vertex vertex, int rowIndex, Vector<Vector<Vertex>> rowVector, Object tag) {
int i = 0;
Vertex[] children = graphModel.getOutVertices(vertex);
vertex.setTag(tag);
@@ -47,24 +47,24 @@ public class DefaultGraphLayoutGenerator { }
}
- private static void addVertexToRow(Vertex vertex, int rowIndex, Vector rowVector) {
- Vector rowsVertices = null;
+ private static void addVertexToRow(Vertex vertex, int rowIndex, Vector<Vector<Vertex>> rowVector) {
+ Vector<Vertex> rowsVertices = null;
// If there is no vector of vertices already created for this row,
// then create one
if (rowVector.size() == rowIndex) {
- rowVector.add(new Vector(10, 10));
+ rowVector.add(new Vector<Vertex>(10, 10));
}
// Add the vertex to the row's vector of vertices
- rowsVertices = (Vector)rowVector.elementAt(rowIndex);
+ rowsVertices = rowVector.elementAt(rowIndex);
rowsVertices.add(vertex);
}
- private static void calculateRowMidPoints(Vector rowVector, int[] midPoints, IntegerWrapper valueOfLargestMidPoint) {
+ private static void calculateRowMidPoints(Vector<Vector<Vertex>> rowVector, int[] midPoints, IntegerWrapper valueOfLargestMidPoint) {
Vector rowsVertices = null;
int rowsWidth = 0;
int i = 0;
for (i = 0; i < midPoints.length; i++) {
- rowsVertices = (Vector)rowVector.elementAt(i);
+ rowsVertices = rowVector.elementAt(i);
rowsWidth = mHorzGap * (rowsVertices.size() - 1);
midPoints[i] = rowsWidth / 2;
if (midPoints[i] > valueOfLargestMidPoint.mValue) {
@@ -73,7 +73,7 @@ public class DefaultGraphLayoutGenerator { }
}
- private static void fillInVertexLocations(GraphModel graphModel, Vector rowVector,
+ private static void fillInVertexLocations(GraphModel graphModel, Vector<Vector<Vertex>> rowVector,
IntegerWrapper valueOfLargestMidPoint, int[] midPoints) {
Vector rowsVertices = null;
Vertex vertex = null;
@@ -82,7 +82,7 @@ public class DefaultGraphLayoutGenerator { int rowsLeftMargin = 0;
GraphPoint point = new GraphPoint(0, 0);
for (rowIndex = 0; rowIndex < rowVector.size(); rowIndex++) {
- rowsVertices = (Vector)rowVector.elementAt(rowIndex);
+ rowsVertices = rowVector.elementAt(rowIndex);
rowsLeftMargin = mLeftMargin + valueOfLargestMidPoint.mValue - midPoints[rowIndex];
for (column = 0; column < rowsVertices.size(); column++) {
vertex = (Vertex)rowsVertices.elementAt(column);
diff --git a/source/com/c2kernel/graph/model/GraphModel.java b/source/com/c2kernel/graph/model/GraphModel.java index 7a546eb..e9ae02f 100755..100644 --- a/source/com/c2kernel/graph/model/GraphModel.java +++ b/source/com/c2kernel/graph/model/GraphModel.java @@ -16,8 +16,8 @@ public class GraphModel implements Serializable{ private int mHeight = 0;
private int mNextId = 0;
protected int mStartVertexId = -1;
- protected Hashtable mVertexHashtable = new Hashtable();
- protected Hashtable mEdgeHashtable = new Hashtable();
+ protected Hashtable<String, Vertex> mVertexHashtable = new Hashtable<String, Vertex>();
+ protected Hashtable<String, DirectedEdge> mEdgeHashtable = new Hashtable<String, DirectedEdge>();
private GraphableVertex mContainingVertex;
/* Transient data */
@@ -168,7 +168,7 @@ public class GraphModel implements Serializable{ }
public void setVertices(Vertex[] vertices) {
- mVertexHashtable = new Hashtable();
+ mVertexHashtable = new Hashtable<String, Vertex>();
for (int i = 0; i < vertices.length; i++) {
mVertexHashtable.put(String.valueOf(vertices[i].getID()), vertices[i]);
checkSize(vertices[i]);
@@ -189,7 +189,7 @@ public class GraphModel implements Serializable{ }
public void setEdges(DirectedEdge[] edges) {
- mEdgeHashtable = new Hashtable();
+ mEdgeHashtable = new Hashtable<String, DirectedEdge>();
for (int i = 0; i < edges.length; i++) {
mEdgeHashtable.put(String.valueOf(edges[i].getID()), edges[i]);
}
@@ -212,7 +212,7 @@ public class GraphModel implements Serializable{ public Vertex getVertex(GraphPoint p) {
Object[] vertexObjs = mVertexHashtable.values().toArray();
Vertex vertex = null;
- Vector vertexVector = new Vector(10, 10);
+ Vector<Vertex> vertexVector = new Vector<Vertex>(10, 10);
int numVerticesFound = 0;
Vertex smallestVertex = null;
int sizeOfSmallestVertex = 0;
@@ -514,8 +514,8 @@ public class GraphModel implements Serializable{ }
public void clear() {
- mVertexHashtable = new Hashtable();
- mEdgeHashtable = new Hashtable();
+ mVertexHashtable = new Hashtable<String, Vertex>();
+ mEdgeHashtable = new Hashtable<String, DirectedEdge>();
mStartVertexId = -1;
setChanged();
notifyObservers(mClearedEvent);
@@ -627,7 +627,7 @@ public class GraphModel implements Serializable{ Polygon bandPolygon = new Polygon();
Vertex[] allVertices = getVertices();
GraphPoint centrePoint = null;
- Vector verticesInside = new Vector(10, 10);
+ Vector<Vertex> verticesInside = new Vector<Vertex>(10, 10);
int i = 0;
// Create a polygon representing the elastic band
bandPolygon.addPoint(mElasticBand.mFixedCorner.x, mElasticBand.mFixedCorner.y);
@@ -842,13 +842,13 @@ public class GraphModel implements Serializable{ }
}
// Create and populate the vertex hashtable
- mVertexHashtable = new Hashtable();
+ mVertexHashtable = new Hashtable<String, Vertex>();
for (i = 0; i < data.mVertexImpls.length; i++) {
mVertexHashtable.put(String.valueOf(data.mVertexImpls[i].getID()), data.mVertexImpls[i]);
checkSize(data.mVertexImpls[i]);
}
// Create and populate the edge hastable
- mEdgeHashtable = new Hashtable();
+ mEdgeHashtable = new Hashtable<String, DirectedEdge>();
for (i = 0; i < data.mEdgeImpls.length; i++) {
mEdgeHashtable.put(String.valueOf(data.mEdgeImpls[i].getID()), data.mEdgeImpls[i]);
}
diff --git a/source/com/c2kernel/graph/model/GraphModelManager.java b/source/com/c2kernel/graph/model/GraphModelManager.java index 19f2dc3..3146c24 100755..100644 --- a/source/com/c2kernel/graph/model/GraphModelManager.java +++ b/source/com/c2kernel/graph/model/GraphModelManager.java @@ -20,8 +20,8 @@ public class GraphModelManager extends Observable private VertexOutlineCreator mVertexOutlineCreator;
private EntireModelChangedEvent mEntireModelChangedEvent = new EntireModelChangedEvent();
private ForcedNotifyEvent mForcedNotifyEvent = new ForcedNotifyEvent();
- private Stack mParentModels = new Stack();
- private ArrayList mParentIds = new ArrayList();
+ private Stack<GraphModel> mParentModels = new Stack<GraphModel>();
+ private ArrayList<Integer> mParentIds = new ArrayList<Integer>();
private boolean mEditable = true;
// Calling this constructor does not create a vertex outline creator
diff --git a/source/com/c2kernel/graph/model/GraphableVertex.java b/source/com/c2kernel/graph/model/GraphableVertex.java index 6efd298..6efd298 100755..100644 --- a/source/com/c2kernel/graph/model/GraphableVertex.java +++ b/source/com/c2kernel/graph/model/GraphableVertex.java diff --git a/source/com/c2kernel/graph/model/Vertex.java b/source/com/c2kernel/graph/model/Vertex.java index 1e8399b..a9a5238 100755..100644 --- a/source/com/c2kernel/graph/model/Vertex.java +++ b/source/com/c2kernel/graph/model/Vertex.java @@ -12,9 +12,9 @@ public class Vertex implements Serializable private GraphPoint mCentrePoint = new GraphPoint(0, 0);
private int mHeight = 0;
private int mWidth = 0;
- private Vector mInEdgeIdVector = new Vector();
- private Vector mOutEdgeIdVector = new Vector();
- private Vector mTags = new Vector();
+ private Vector<Integer> mInEdgeIdVector = new Vector<Integer>();
+ private Vector<Integer> mOutEdgeIdVector = new Vector<Integer>();
+ private Vector<Object> mTags = new Vector<Object>();
// The Java Polygon class is used to determine if a point
// lies within the outline of a vertex. Unfortunately
@@ -170,7 +170,7 @@ public class Vertex implements Serializable {
int i = 0;
- mInEdgeIdVector = new Vector(10, 10);
+ mInEdgeIdVector = new Vector<Integer>(10, 10);
for(i=0; i<ids.length; i++)
mInEdgeIdVector.add(new Integer(ids[i]));
}
@@ -186,7 +186,7 @@ public class Vertex implements Serializable {
int i = 0;
- mOutEdgeIdVector = new Vector(10, 10);
+ mOutEdgeIdVector = new Vector<Integer>(10, 10);
for(i=0; i<ids.length; i++)
mOutEdgeIdVector.add(new Integer(ids[i]));
}
diff --git a/source/com/c2kernel/graph/traversal/GraphTraversal.java b/source/com/c2kernel/graph/traversal/GraphTraversal.java index abf30f7..b50030d 100755..100644 --- a/source/com/c2kernel/graph/traversal/GraphTraversal.java +++ b/source/com/c2kernel/graph/traversal/GraphTraversal.java @@ -20,7 +20,7 @@ public class GraphTraversal public static Vertex[] getTraversal(GraphModel graphModel, Vertex startVertex, int direction, boolean ignoreBackLinks)
{
- Vector path = new Vector(10, 10);
+ Vector<Vertex> path = new Vector<Vertex>(10, 10);
graphModel.clearTags(startVertex);
visitVertex(startVertex, graphModel, path, direction, startVertex, ignoreBackLinks);
@@ -29,7 +29,7 @@ public class GraphTraversal }
- private static void visitVertex(Vertex vertex, GraphModel graphModel, Vector path, int direction, Object tag, boolean ignoreBackLinks)
+ private static void visitVertex(Vertex vertex, GraphModel graphModel, Vector<Vertex> path, int direction, Object tag, boolean ignoreBackLinks)
{
Vertex[] children = null;
int i = 0;
diff --git a/source/com/c2kernel/graph/view/EditorToolBar.java b/source/com/c2kernel/graph/view/EditorToolBar.java index 2730ab7..e01056f 100755..100644 --- a/source/com/c2kernel/graph/view/EditorToolBar.java +++ b/source/com/c2kernel/graph/view/EditorToolBar.java @@ -56,9 +56,9 @@ public class EditorToolBar extends Box implements Printable }
}
// Vertex types and ids
- protected JComboBox mVertexTypeBox = new JComboBox();
+ protected JComboBox<TypeNameAndConstructionInfo> mVertexTypeBox = new JComboBox<TypeNameAndConstructionInfo>();
// Edge types and ids
- protected JComboBox mEdgeTypeBox = new JComboBox();
+ protected JComboBox<TypeNameAndConstructionInfo> mEdgeTypeBox = new JComboBox<TypeNameAndConstructionInfo>();
// Mode buttons
protected ButtonGroup mModeButtonGroup = new ButtonGroup();
protected JToggleButton mVertexModeButton = new JToggleButton(Resource.getImageResource("graph/newvertex.png"));
@@ -74,7 +74,7 @@ public class EditorToolBar extends Box implements Printable protected StartVertexController mStartVertexController = new StartVertexController();
protected DeletionController mDeletionController = new DeletionController();
// Editor mode listeners
- protected Vector mListenerVector = new Vector(10, 10);
+ protected Vector<EditorModeListener> mListenerVector = new Vector<EditorModeListener>(10, 10);
public EditorToolBar(boolean edgeCreationMode, // True if edges can be created
JButton[] otherButtons, GraphPanel graphP)
{
diff --git a/source/com/c2kernel/graph/view/PropertyTableModel.java b/source/com/c2kernel/graph/view/PropertyTableModel.java index 9755cf6..22ba4f3 100755..100644 --- a/source/com/c2kernel/graph/view/PropertyTableModel.java +++ b/source/com/c2kernel/graph/view/PropertyTableModel.java @@ -20,8 +20,8 @@ import com.c2kernel.utils.Language; public class PropertyTableModel extends AbstractTableModel {
private String[] mColumnNames = { Language.translate("Name"), Language.translate("Value") };
- HashMap sourceMap = new HashMap();
- ArrayList sortedNameList = new ArrayList();
+ HashMap<String, Object> sourceMap = new HashMap<String, Object>();
+ ArrayList<String> sortedNameList = new ArrayList<String>();
boolean isEditable = false;
public PropertyTableModel() {
@@ -45,7 +45,7 @@ public class PropertyTableModel extends AbstractTableModel { public Object getValueAt(int rowIndex, int colIndex)
{
synchronized (sourceMap) {
- String rowName = (String)sortedNameList.get(rowIndex);
+ String rowName = sortedNameList.get(rowIndex);
if (colIndex == 0)
return rowName;
else
@@ -57,7 +57,7 @@ public class PropertyTableModel extends AbstractTableModel { {
synchronized (sourceMap) {
if (colIndex == 0) return;
- String rowName = (String)sortedNameList.get(rowIndex);
+ String rowName = sortedNameList.get(rowIndex);
Class oldElement = sourceMap.get(rowName).getClass();
if (oldElement == Float.class && value.getClass() == String.class)
try {
@@ -72,16 +72,16 @@ public class PropertyTableModel extends AbstractTableModel { }
}
- public void setMap(HashMap props) {
+ public void setMap(HashMap<String, Object> props) {
synchronized (sourceMap) {
sourceMap = props;
- sortedNameList = new ArrayList(props.size());
- for (Iterator keys = props.keySet().iterator(); keys.hasNext();)
+ sortedNameList = new ArrayList<String>(props.size());
+ for (Iterator<String> keys = props.keySet().iterator(); keys.hasNext();)
sortedNameList.add(keys.next());
- Collections.sort(sortedNameList, new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((String)o1).compareToIgnoreCase((String)o2);
+ Collections.sort(sortedNameList, new Comparator<String>() {
+ public int compare(String o1, String o2) {
+ return (o1.compareToIgnoreCase(o2));
}
});
}
diff --git a/source/com/c2kernel/graph/view/VertexPropertyPanel.java b/source/com/c2kernel/graph/view/VertexPropertyPanel.java index be08b53..dd5fbd2 100755..100644 --- a/source/com/c2kernel/graph/view/VertexPropertyPanel.java +++ b/source/com/c2kernel/graph/view/VertexPropertyPanel.java @@ -43,7 +43,7 @@ public class VertexPropertyPanel extends JPanel implements Observer, TableModelL JButton delPropButton;
Box newPropBox;
private JTextField newPropName;
- private JComboBox newPropType;
+ private JComboBox<String> newPropType;
String[] typeOptions = { "String", "Boolean", "Integer", "Float" };
String[] typeInitVal = { "", "false", "0", "0.0"};
SelectedVertexPanel mSelPanel;
@@ -125,7 +125,7 @@ public class VertexPropertyPanel extends JPanel implements Observer, TableModelL public void clear() {
selObjName.setText("");
selObjClass.setText("Nothing Selected");
- mPropertyModel.setMap(new HashMap());
+ mPropertyModel.setMap(new HashMap<String, Object>());
if (mSelPanel != null) mSelPanel.clear();
addPropButton.setEnabled(false);
delPropButton.setEnabled(false);
@@ -184,7 +184,7 @@ public class VertexPropertyPanel extends JPanel implements Observer, TableModelL newPropBox.add(Box.createHorizontalGlue());
newPropName = new JTextField(15);
newPropBox.add(newPropName);
- newPropType = new JComboBox(typeOptions);
+ newPropType = new JComboBox<String>(typeOptions);
newPropBox.add(newPropType);
newPropBox.add(Box.createHorizontalStrut(1));
addPropButton = new JButton("Add");
@@ -224,7 +224,7 @@ public class VertexPropertyPanel extends JPanel implements Observer, TableModelL mPropertyTable.getCellEditor().stopCellEditing();
try {
- Class newPropClass = Class.forName("java.lang."+typeOptions[newPropType.getSelectedIndex()]);
+ Class<?> newPropClass = Class.forName("java.lang."+typeOptions[newPropType.getSelectedIndex()]);
Class[] params = {String.class};
Constructor init = newPropClass.getConstructor(params);
Object[] initParams = { typeInitVal[newPropType.getSelectedIndex()] };
diff --git a/source/com/c2kernel/gui/EntityDetails.java b/source/com/c2kernel/gui/EntityDetails.java index b6c5245..5eb812f 100755..100644 --- a/source/com/c2kernel/gui/EntityDetails.java +++ b/source/com/c2kernel/gui/EntityDetails.java @@ -30,7 +30,7 @@ public class EntityDetails extends JPanel implements ChangeListener, Runnable { protected JPanel itemTitlePanel;
private EntityTabManager desktopManager;
protected NodeEntity myEntity;
- protected HashMap childPanes = new HashMap();
+ protected HashMap<EntityTabPane, Boolean> childPanes = new HashMap<EntityTabPane, Boolean>();
protected String startTab;
protected String startCommand = null;
protected boolean initialized = false;
diff --git a/source/com/c2kernel/gui/EntityTabManager.java b/source/com/c2kernel/gui/EntityTabManager.java index 208ae89..1e01ad0 100755..100644 --- a/source/com/c2kernel/gui/EntityTabManager.java +++ b/source/com/c2kernel/gui/EntityTabManager.java @@ -22,7 +22,7 @@ public class EntityTabManager extends JPanel {
private MainFrame mMainframe;
- protected HashMap openItems = new HashMap();
+ protected HashMap<Integer, EntityDetails> openItems = new HashMap<Integer, EntityDetails>();
protected JTabbedPaneWithCloseIcons tabbedPane = new JTabbedPaneWithCloseIcons();
//JTabbedPane tabbedPane = new JTabbedPane();
MenuBuilder myMenuBuilder;
@@ -74,7 +74,7 @@ public class EntityTabManager extends JPanel }
public void closeAll(boolean keepOpen) {
- ArrayList toRemove = new ArrayList();
+ ArrayList<Integer> toRemove = new ArrayList<Integer>();
for (Iterator iter = openItems.keySet().iterator(); iter.hasNext();) {
Integer element = (Integer) iter.next();
if (keepOpen && openItems.get(element).equals(tabbedPane.getSelectedComponent())) continue;
diff --git a/source/com/c2kernel/gui/MainFrame.java b/source/com/c2kernel/gui/MainFrame.java index 99a1fab..e561f1f 100755..100644 --- a/source/com/c2kernel/gui/MainFrame.java +++ b/source/com/c2kernel/gui/MainFrame.java @@ -267,7 +267,7 @@ public class MainFrame extends javax.swing.JFrame { }
public static JComboBox getExecutionPlugins() {
- JComboBox plugins = new JComboBox();
+ JComboBox<Executor> plugins = new JComboBox<Executor>();
// create execution selector
Executor defaultExecutor = new DefaultExecutor();
plugins.addItem(defaultExecutor);
diff --git a/source/com/c2kernel/gui/MenuBuilder.java b/source/com/c2kernel/gui/MenuBuilder.java index c385dbe..bf27287 100755..100644 --- a/source/com/c2kernel/gui/MenuBuilder.java +++ b/source/com/c2kernel/gui/MenuBuilder.java @@ -33,7 +33,7 @@ public class MenuBuilder extends JMenuBar implements ActionListener, ItemListene protected JMenu styleMenu;
protected JMenu prefMenu;
protected JMenu helpMenu;
- protected HashMap availableMenus = new HashMap();
+ protected HashMap<String, JMenu> availableMenus = new HashMap<String, JMenu>();
public MenuBuilder()
{}
diff --git a/source/com/c2kernel/gui/data/Node.java b/source/com/c2kernel/gui/data/Node.java index b82ee92..79eb3ad 100755..100644 --- a/source/com/c2kernel/gui/data/Node.java +++ b/source/com/c2kernel/gui/data/Node.java @@ -31,8 +31,8 @@ public abstract class Node implements Runnable { protected String type = "";
protected Icon icon;
protected boolean isExpandable = false;
- protected HashMap childNodes = new HashMap();
- protected ArrayList subscribers = new ArrayList();
+ protected HashMap<Path, Node> childNodes = new HashMap<Path, Node>();
+ protected ArrayList<NodeSubscriber> subscribers = new ArrayList<NodeSubscriber>();
protected DynamicTreeBuilder loader = null;
private boolean loaded = false;
private String iconName;
diff --git a/source/com/c2kernel/gui/data/NodeAgent.java b/source/com/c2kernel/gui/data/NodeAgent.java index 9ef738a..138b576 100755..100644 --- a/source/com/c2kernel/gui/data/NodeAgent.java +++ b/source/com/c2kernel/gui/data/NodeAgent.java @@ -21,9 +21,9 @@ public class NodeAgent extends NodeEntity { public void loadChildren() {
}
- public ArrayList getTabs() {
+ public ArrayList<String> getTabs() {
- ArrayList requiredTabs = super.getTabs();
+ ArrayList<String> requiredTabs = super.getTabs();
requiredTabs.add("AgentProperties");
requiredTabs.add("JobList");
return requiredTabs;
diff --git a/source/com/c2kernel/gui/data/NodeEntity.java b/source/com/c2kernel/gui/data/NodeEntity.java index adff241..8c05afd 100755..100644 --- a/source/com/c2kernel/gui/data/NodeEntity.java +++ b/source/com/c2kernel/gui/data/NodeEntity.java @@ -73,8 +73,8 @@ public abstract class NodeEntity extends Node { desktop.add(this);
}
- public ArrayList getTabs() {
- ArrayList requiredTabs = new ArrayList();
+ public ArrayList<String> getTabs() {
+ ArrayList<String> requiredTabs = new ArrayList<String>();
return requiredTabs;
}
}
diff --git a/source/com/c2kernel/gui/data/NodeItem.java b/source/com/c2kernel/gui/data/NodeItem.java index 410f13a..84cba97 100755..100644 --- a/source/com/c2kernel/gui/data/NodeItem.java +++ b/source/com/c2kernel/gui/data/NodeItem.java @@ -53,7 +53,7 @@ public class NodeItem extends NodeEntity { popup.addSeparator();
try {
ArrayList jobList = ((ItemProxy)myEntity).getJobList(MainFrame.userAgent);
- ArrayList already = new ArrayList();
+ ArrayList<String> already = new ArrayList<String>();
if (jobList.size() > 0) {
for (Iterator e = jobList.iterator(); e.hasNext();) {
Job thisJob = (Job)e.next();
@@ -91,9 +91,9 @@ public class NodeItem extends NodeEntity { thisDetail.runCommand("Execution", stepName);
}
- public ArrayList getTabs() {
+ public ArrayList<String> getTabs() {
- ArrayList requiredTabs = super.getTabs();
+ ArrayList<String> requiredTabs = super.getTabs();
requiredTabs.add("Properties");
try {
String collNames = myEntity.queryData(ClusterStorage.COLLECTION+"/all");
diff --git a/source/com/c2kernel/gui/tabs/DomainPathAdmin.java b/source/com/c2kernel/gui/tabs/DomainPathAdmin.java index 35104d7..2e81121 100755..100644 --- a/source/com/c2kernel/gui/tabs/DomainPathAdmin.java +++ b/source/com/c2kernel/gui/tabs/DomainPathAdmin.java @@ -102,11 +102,11 @@ public class DomainPathAdmin extends Box implements ActionListener { }
private class DomainPathTableModel extends AbstractTableModel {
- ArrayList domPaths;
+ ArrayList<DomainPath> domPaths;
DomainPathAdmin parent;
public DomainPathTableModel(DomainPathAdmin parent) {
this.parent = parent;
- domPaths = new ArrayList();
+ domPaths = new ArrayList<DomainPath>();
}
public void loadPaths() {
@@ -134,7 +134,7 @@ public class DomainPathAdmin extends Box implements ActionListener { }
}
- public Class getColumnClass(int columnIndex) {
+ public Class<?> getColumnClass(int columnIndex) {
return String.class;
}
diff --git a/source/com/c2kernel/gui/tabs/HistoryPane.java b/source/com/c2kernel/gui/tabs/HistoryPane.java index 091ef5e..be7f8b2 100755..100644 --- a/source/com/c2kernel/gui/tabs/HistoryPane.java +++ b/source/com/c2kernel/gui/tabs/HistoryPane.java @@ -182,7 +182,7 @@ public class HistoryPane extends EntityTabPane implements ActionListener, Entity /**
* @see javax.swing.table.TableModel#getColumnClass(int)
*/
- public Class getColumnClass(int columnIndex) {
+ public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex) {
case 0:
return Integer.class;
diff --git a/source/com/c2kernel/gui/tabs/JobListPane.java b/source/com/c2kernel/gui/tabs/JobListPane.java index ea14222..b9ff0e5 100755..100644 --- a/source/com/c2kernel/gui/tabs/JobListPane.java +++ b/source/com/c2kernel/gui/tabs/JobListPane.java @@ -209,7 +209,7 @@ public class JobListPane extends EntityTabPane implements ActionListener, Entity /**
* @see javax.swing.table.TableModel#getColumnClass(int)
*/
- public Class getColumnClass(int columnIndex) {
+ public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex) {
case 0:
return Integer.class;
diff --git a/source/com/c2kernel/gui/tabs/PropertiesPane.java b/source/com/c2kernel/gui/tabs/PropertiesPane.java index 5666ae9..6b21804 100755..100644 --- a/source/com/c2kernel/gui/tabs/PropertiesPane.java +++ b/source/com/c2kernel/gui/tabs/PropertiesPane.java @@ -40,7 +40,7 @@ public class PropertiesPane extends EntityTabPane implements EntityProxyObserver Box propertyBox;
boolean subbed = false;
- HashMap loadedProps = new HashMap();
+ HashMap<String, JLabel> loadedProps = new HashMap<String, JLabel>();
JLabel domTitle;
DomainPathAdmin domAdmin;
@@ -89,7 +89,7 @@ public class PropertiesPane extends EntityTabPane implements EntityProxyObserver public void reload() {
Gateway.getStorage().clearCache(sourceEntity.getSysKey(), ClusterStorage.PROPERTY);
- loadedProps = new HashMap();
+ loadedProps = new HashMap<String, JLabel>();
initForEntity(sourceEntity);
}
diff --git a/source/com/c2kernel/gui/tabs/ViewpointPane.java b/source/com/c2kernel/gui/tabs/ViewpointPane.java index 7bb6176..31e18c3 100755..100644 --- a/source/com/c2kernel/gui/tabs/ViewpointPane.java +++ b/source/com/c2kernel/gui/tabs/ViewpointPane.java @@ -10,6 +10,7 @@ import java.awt.event.ItemListener; import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.StringTokenizer;
@@ -40,16 +41,16 @@ import com.c2kernel.utils.Logger; public class ViewpointPane extends EntityTabPane implements ItemListener, ActionListener, EntityProxyObserver {
- JComboBox schemas;
- JComboBox views;
- JComboBox events;
+ JComboBox<String> schemas;
+ JComboBox<Viewpoint> views;
+ JComboBox<EventItem> events;
JLabel eventDetails;
JButton exportButton;
JButton viewButton;
- ArrayList schemaList;
- ArrayList viewpointList;
- ArrayList eventList;
+ ArrayList<String> schemaList;
+ ArrayList<Viewpoint> viewpointList;
+ ArrayList<EventItem> eventList;
String currentSchema = null;
Outcome currentOutcome = null;
OutcomeHandler thisOutcome;
@@ -82,7 +83,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action viewBox.add(label);
viewBox.add(Box.createHorizontalStrut(7));
- schemas = new JComboBox();
+ schemas = new JComboBox<String>();
viewBox.add(schemas);
viewBox.add(Box.createHorizontalGlue());
schemas.addItemListener(this);
@@ -91,7 +92,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action viewBox.add(label);
viewBox.add(Box.createHorizontalStrut(7));
- views = new JComboBox();
+ views = new JComboBox<Viewpoint>();
viewBox.add(views);
viewBox.add(Box.createHorizontalGlue());
views.addItemListener(this);
@@ -107,7 +108,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action eventBox.add(label);
eventBox.add(Box.createHorizontalStrut(7));
- events = new JComboBox();
+ events = new JComboBox<EventItem>();
eventBox.add(events);
eventBox.add(Box.createHorizontalStrut(7));
events.addItemListener(this);
@@ -163,7 +164,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action clearView();
schemas.addItem("--");
currentSchema = null;
- schemaList = new ArrayList();
+ schemaList = new ArrayList<String>();
try {
String outcomeTypes = sourceEntity.getEntity().queryData(ClusterStorage.VIEWPOINT+"/all");
StringTokenizer tok = new StringTokenizer(outcomeTypes, ",");
@@ -197,8 +198,8 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action suspendSelection = true;
views.removeAllItems();
events.removeAllItems();
- viewpointList = new ArrayList();
- eventList = new ArrayList();
+ viewpointList = new ArrayList<Viewpoint>();
+ eventList = new ArrayList<EventItem>();
currentSchema = schemaName;
@@ -233,8 +234,12 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action }
eventList.add(newEvent);
}
- Collections.sort(eventList);
- for (Iterator iter = eventList.iterator(); iter.hasNext();)
+ Collections.sort(eventList, new Comparator<EventItem>() {
+ public int compare(EventItem o1, EventItem o2) {
+ return o1.compareTo(o2);
+ }
+ });
+ for (Iterator<EventItem> iter = eventList.iterator(); iter.hasNext();)
events.addItem(iter.next());
}
@@ -435,7 +440,7 @@ public class ViewpointPane extends EntityTabPane implements ItemListener, Action class EventItem implements Comparable {
public int eventId;
public int schemaVersion;
- public ArrayList viewNames = new ArrayList();
+ public ArrayList<String> viewNames = new ArrayList<String>();
public String viewList = "";
public EventItem(int eventId, int schemaVersion) {
diff --git a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java index ef20a1a..bb71cd8 100755..100644 --- a/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java +++ b/source/com/c2kernel/gui/tabs/collection/CollectionHistoryWindow.java @@ -48,17 +48,16 @@ public class CollectionHistoryWindow extends JFrame { private class HistoryTableModel extends AbstractTableModel implements EntityProxyObserver {
ItemProxy item;
- ArrayList collEvents, collEventData;
+ ArrayList<Object> collEvents, collEventData;
Collection coll;
public HistoryTableModel(ItemProxy item, Collection coll) {
this.item = item;
this.coll = coll;
- collEvents = new ArrayList();
- collEventData = new ArrayList();
+ collEvents = new ArrayList<Object>();
+ collEventData = new ArrayList<Object>();
item.subscribe(this, ClusterStorage.HISTORY, true);
}
public int getColumnCount() {
- // TODO Auto-generated method stub
return 4;
}
@@ -72,7 +71,6 @@ public class CollectionHistoryWindow extends JFrame { }
}
public int getRowCount() {
- // TODO Auto-generated method stub
return collEvents.size();
}
public Object getValueAt(int rowIndex, int columnIndex) {
diff --git a/source/com/c2kernel/gui/tabs/execution/ActivityItem.java b/source/com/c2kernel/gui/tabs/execution/ActivityItem.java index 051f1dc..ba5e76b 100644 --- a/source/com/c2kernel/gui/tabs/execution/ActivityItem.java +++ b/source/com/c2kernel/gui/tabs/execution/ActivityItem.java @@ -8,7 +8,7 @@ public class ActivityItem { public String stepPath;
public int state;
public String name;
- ArrayList<Job> jobs = new ArrayList<>();
+ ArrayList<Job> jobs = new ArrayList<Job>();
public ActivityItem() {
stepPath = "";
diff --git a/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java b/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java index 4250a37..b0417f4 100755..100644 --- a/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java +++ b/source/com/c2kernel/gui/tabs/execution/ActivityViewer.java @@ -40,7 +40,7 @@ public class ActivityViewer extends JPanel implements Runnable { OutcomeHandler outcomePanel;
JPanel outcomeView = new JPanel(new GridLayout(1,1));
ActivityItem thisAct;
- ArrayList requestButtons = new ArrayList();
+ ArrayList<RequestButton> requestButtons = new ArrayList<RequestButton>();
JLabel noOutcome = new JLabel(Language.translate("No outcome data is required for this activity"));
ExecutionPane parent;
JLabel status;
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java b/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java index 08c5ea1..015bd9a 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java @@ -22,7 +22,7 @@ import com.c2kernel.utils.Logger; public class AttributeList extends JPanel {
- ArrayList attrSet = new ArrayList();
+ ArrayList<StringEditField> attrSet = new ArrayList<StringEditField>();
ElementDecl model;
Element myElement;
boolean readOnly;
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/Dimension.java b/source/com/c2kernel/gui/tabs/outcome/form/Dimension.java index 8dfa7f5..8de306b 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/Dimension.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/Dimension.java @@ -36,8 +36,8 @@ public class Dimension extends OutcomeStructure implements ActionListener { JLabel msg;
DomKeyPushTable table;
Box tableBox;
- ArrayList instances = new ArrayList(); // stores DimensionInstances if tabs
- ArrayList elements = new ArrayList(); // stores current children
+ ArrayList<DimensionInstance> instances = new ArrayList<DimensionInstance>(); // stores DimensionInstances if tabs
+ ArrayList<Element> elements = new ArrayList<Element>(); // stores current children
JButton addButton;
JButton delButton;
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java b/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java index b19c1d2..1a606fb 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java @@ -14,13 +14,13 @@ import com.c2kernel.utils.Logger; public class DimensionTableModel extends AbstractTableModel {
ElementDecl model;
- ArrayList columnHeadings = new ArrayList();
- ArrayList columnClasses = new ArrayList();
- ArrayList columnDecls = new ArrayList();
- ArrayList colReadOnly = new ArrayList();
- ArrayList colHelp = new ArrayList();
- ArrayList rows = new ArrayList();
- ArrayList elements = new ArrayList();
+ ArrayList<String> columnHeadings = new ArrayList<String>();
+ ArrayList<Class<?>> columnClasses = new ArrayList<Class<?>>();
+ ArrayList<Annotated> columnDecls = new ArrayList<Annotated>();
+ ArrayList<Boolean> colReadOnly = new ArrayList<Boolean>();
+ ArrayList<String> colHelp = new ArrayList<String>();
+ ArrayList<Object[]> rows = new ArrayList<Object[]>();
+ ArrayList<Element> elements = new ArrayList<Element>();
boolean readOnly;
public DimensionTableModel(ElementDecl model, boolean readOnly) throws StructuralException {
@@ -176,8 +176,8 @@ public class DimensionTableModel extends AbstractTableModel { rows.add(index, newRow);
fireTableRowsInserted(index, index);
}
- public Class getColumnClass(int columnIndex) {
- return (Class)columnClasses.get(columnIndex);
+ public Class<?> getColumnClass(int columnIndex) {
+ return columnClasses.get(columnIndex);
}
public String getColumnName(int columnIndex) {
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/OutcomeStructure.java b/source/com/c2kernel/gui/tabs/outcome/form/OutcomeStructure.java index 9333bf8..a535da6 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/OutcomeStructure.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/OutcomeStructure.java @@ -36,8 +36,8 @@ public abstract class OutcomeStructure extends JPanel { ElementDecl model;
Element myElement = null;
boolean readOnly;
- HashMap subStructure = new HashMap();
- ArrayList order = new ArrayList();
+ HashMap<String, OutcomeStructure> subStructure = new HashMap<String, OutcomeStructure>();
+ ArrayList<String> order = new ArrayList<String>();
String help = "<i>"+Language.translate("No help is available for this element")+"</i>";
HelpPane helpPane;
boolean deferChild = false;
@@ -46,7 +46,7 @@ public abstract class OutcomeStructure extends JPanel { this.model = model;
this.readOnly = readOnly;
this.helpPane = helpPane;
- subStructure = new HashMap();
+ subStructure = new HashMap<String, OutcomeStructure>();
Logger.msg(8, "Creating " + model.getName() + " structure as " +
this.getClass().getName().substring(this.getClass().getName().lastIndexOf('.') + 1));
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java index 0807f78..c7934c0 100755..100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/ArrayTableModel.java @@ -22,7 +22,7 @@ import com.c2kernel.utils.Language; public class ArrayTableModel extends AbstractTableModel {
- ArrayList contents = new ArrayList();
+ ArrayList<Object> contents = new ArrayList<Object>();
Class type;
int numCols = 1;
boolean readOnly = false;
@@ -63,7 +63,7 @@ public class ArrayTableModel extends AbstractTableModel { fireTableStructureChanged();
}
- public Class getColumnClass(int columnIndex) {
+ public Class<?> getColumnClass(int columnIndex) {
return type;
}
diff --git a/source/com/c2kernel/lifecycle/ActivityDef.java b/source/com/c2kernel/lifecycle/ActivityDef.java index fd6f646..42385a4 100755..100644 --- a/source/com/c2kernel/lifecycle/ActivityDef.java +++ b/source/com/c2kernel/lifecycle/ActivityDef.java @@ -23,7 +23,7 @@ public class ActivityDef extends WfVertexDef implements C2KLocalObject */
public ActivityDef()
{
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
setProperties(new WfCastorHashMap());
setIsLayoutable(false);
getProperties().put(StateMachine.SKIPPABLE, new Boolean(false));
diff --git a/source/com/c2kernel/lifecycle/AndSplitDef.java b/source/com/c2kernel/lifecycle/AndSplitDef.java index 6692163..80c27df 100755..100644 --- a/source/com/c2kernel/lifecycle/AndSplitDef.java +++ b/source/com/c2kernel/lifecycle/AndSplitDef.java @@ -18,7 +18,7 @@ public class AndSplitDef extends WfVertexDef */
public AndSplitDef()
{
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
getProperties().put("RoutingScriptName", "");
getProperties().put("RoutingScriptVersion", "");
}
diff --git a/source/com/c2kernel/lifecycle/WfVertexDef.java b/source/com/c2kernel/lifecycle/WfVertexDef.java index a7bfd5a..221f6ae 100755..100644 --- a/source/com/c2kernel/lifecycle/WfVertexDef.java +++ b/source/com/c2kernel/lifecycle/WfVertexDef.java @@ -14,7 +14,7 @@ import com.c2kernel.utils.KeyValuePair; */
public abstract class WfVertexDef extends GraphableVertex
{
- public Vector mErrors;
+ public Vector<String> mErrors;
protected boolean loopTested;
@@ -24,7 +24,7 @@ public abstract class WfVertexDef extends GraphableVertex /** @label wf */
public WfVertexDef()
{
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
setIsLayoutable(true);
}
diff --git a/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java b/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java index 6e91469..e8143be 100644 --- a/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java +++ b/source/com/c2kernel/lifecycle/chooser/LDAPEntryChooser.java @@ -15,11 +15,11 @@ import com.c2kernel.lookup.DomainPath; import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
-public class LDAPEntryChooser extends JComboBox
+public class LDAPEntryChooser extends JComboBox<String>
{
DomainPath mDomainPath = null;
- ArrayList<String> allItems = new ArrayList<>();
+ ArrayList<String> allItems = new ArrayList<String>();
public LDAPEntryChooser(DomainPath domPath, boolean editable)
{
diff --git a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java b/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java index 0cb60e7..2ef9508 100755..100644 --- a/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java +++ b/source/com/c2kernel/lifecycle/gui/model/WfVertexDefFactory.java @@ -1,5 +1,6 @@ package com.c2kernel.lifecycle.gui.model;
import java.awt.Point;
+import java.io.Serializable;
import java.util.HashMap;
import javax.swing.JOptionPane;
@@ -28,7 +29,7 @@ public class WfVertexDefFactory implements VertexFactory, WorkflowDialogue if (vertexTypeId.equals("Atomic") || vertexTypeId.equals("Composite"))
{
// ask for a name
- HashMap mhm = new HashMap();
+ HashMap<String, Serializable> mhm = new HashMap<String, Serializable>();
mhm.put("P1", vertexTypeId);
mhm.put("P2", location);
//************************************************
diff --git a/source/com/c2kernel/lifecycle/instance/Activity.java b/source/com/c2kernel/lifecycle/instance/Activity.java index 458c0a5..a0df570 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Activity.java +++ b/source/com/c2kernel/lifecycle/instance/Activity.java @@ -38,7 +38,7 @@ public class Activity extends WfVertex /**
* vector of errors (Strings) that is constructed each time verify() is launched
*/
- protected Vector mErrors;
+ protected Vector<String> mErrors;
/** @associates a State machine engine */
private StateMachine machine;
/** true is avalaibe to be executed */
@@ -56,7 +56,7 @@ public class Activity extends WfVertex {
super();
setProperties(new WfCastorHashMap());
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
machine = new StateMachine(this);
eventIds = new EventStorage();
mStartDate = new GTimeStamp();
@@ -483,20 +483,20 @@ public class Activity extends WfVertex /**
* returns the lists of jobs for the activity and children (cf com.c2kernel.entity.Job)
*/
- public ArrayList calculateJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
{
return calculateJobsBase(agent, false);
} //
- public ArrayList calculateAllJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
{
return calculateJobsBase(agent, true);
}
- private ArrayList calculateJobsBase(AgentPath agent, boolean all)
+ private ArrayList<Job> calculateJobsBase(AgentPath agent, boolean all)
{
Logger.msg(7, "calculateJobs - " + getPath());
int[] transitions = {
};
- ArrayList jobs = new ArrayList();
+ ArrayList<Job> jobs = new ArrayList<Job>();
try
{
String agentName = checkAccessRights(agent);
diff --git a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java b/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java index ea47721..a0d4aab 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java +++ b/source/com/c2kernel/lifecycle/instance/AdvancementCalculator.java @@ -10,9 +10,9 @@ import com.c2kernel.lifecycle.instance.stateMachine.States; public class AdvancementCalculator implements Serializable
{
private CompositeActivity activity;
- private Hashtable isMarked;
- private Hashtable HasNextMarked;
- public Hashtable hasprevActive;
+ private Hashtable<Vertex, Serializable> isMarked;
+ private Hashtable<Vertex, Vertex> HasNextMarked;
+ public Hashtable<String, Vertex> hasprevActive;
private long mCurrentNbActExp = 0;
private long mMaximuNbActexp = 0;
private long mNbActpassed = 0;
@@ -24,9 +24,9 @@ public class AdvancementCalculator implements Serializable private boolean mHasPrevActive = false;
public AdvancementCalculator()
{
- isMarked = new Hashtable();
- HasNextMarked = new Hashtable();
- hasprevActive = new Hashtable();
+ isMarked = new Hashtable<Vertex, Serializable>();
+ HasNextMarked = new Hashtable<Vertex, Vertex>();
+ hasprevActive = new Hashtable<String, Vertex>();
}
public void calculate(CompositeActivity act)
{
@@ -39,7 +39,7 @@ public class AdvancementCalculator implements Serializable activity = act;
Vertex v = activity.getChildGraphModel().getStartVertex();
check(v, this);
- isMarked = new Hashtable();
+ isMarked = new Hashtable<Vertex, Serializable>();
calc(v, this);
// Logger.debug(0, act.getName()+" <<<<<<<<<");
}
diff --git a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java index 5292127..797a5db 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/CompositeActivity.java +++ b/source/com/c2kernel/lifecycle/instance/CompositeActivity.java @@ -8,6 +8,7 @@ import com.c2kernel.common.AccessRightsException; import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.InvalidTransitionException;
import com.c2kernel.common.ObjectAlreadyExistsException;
+import com.c2kernel.entity.agent.Job;
import com.c2kernel.graph.model.GraphModel;
import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.graph.model.GraphableVertex;
@@ -297,7 +298,7 @@ public class CompositeActivity extends Activity */
public Activity[] query(AgentPath agent, int stateID, boolean filter)
{
- Vector steps = new Vector();
+ Vector<Activity[]> steps = new Vector<Activity[]>();
Activity[] returnArray = null;
for (int i = 0; i < getChildren().length; i++)
{
@@ -327,9 +328,9 @@ public class CompositeActivity extends Activity /**
* @see com.c2kernel.lifecycle.instance.Activity#calculateJobs()
*/
- public ArrayList calculateJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateJobs(AgentPath agent, boolean recurse)
{
- ArrayList jobs = new ArrayList();
+ ArrayList<Job> jobs = new ArrayList<Job>();
boolean childActive = false;
if (recurse)
for (int i = 0; i < getChildren().length; i++)
@@ -344,9 +345,9 @@ public class CompositeActivity extends Activity return jobs;
}
- public ArrayList calculateAllJobs(AgentPath agent, boolean recurse)
+ public ArrayList<Job> calculateAllJobs(AgentPath agent, boolean recurse)
{
- ArrayList jobs = new ArrayList();
+ ArrayList<Job> jobs = new ArrayList<Job>();
if (recurse)
for (int i = 0; i < getChildren().length; i++)
if (getChildren()[i] instanceof Activity)
diff --git a/source/com/c2kernel/lifecycle/instance/Join.java b/source/com/c2kernel/lifecycle/instance/Join.java index 205d264..b61100e 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Join.java +++ b/source/com/c2kernel/lifecycle/instance/Join.java @@ -11,14 +11,14 @@ import com.c2kernel.scripting.ScriptingEngineException; */
public class Join extends WfVertex
{
- public Vector mErrors;
+ public Vector<String> mErrors;
/**
* @see java.lang.Object#Object()
*/
public Join()
{
super();
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
}
private boolean loopTested;
public int counter = 0;
diff --git a/source/com/c2kernel/lifecycle/instance/ParserWF.java b/source/com/c2kernel/lifecycle/instance/ParserWF.java index c3d718d..35fed90 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/ParserWF.java +++ b/source/com/c2kernel/lifecycle/instance/ParserWF.java @@ -14,7 +14,7 @@ import com.c2kernel.utils.Logger; */
public class ParserWF
{
- static Vector nexts;
+ static Vector<String[]> nexts;
static String file = "";
static int i;
static CastorHashMap mInfo = new CastorHashMap();
@@ -32,7 +32,7 @@ public class ParserWF */
public static CompositeActivity addStep(CompositeActivity act, String xmlfile, AgentPath agent) throws IOException
{
- nexts = new Vector(1, 1);
+ nexts = new Vector<String[]>(1, 1);
i = 0;
file = xmlfile;
int c;
diff --git a/source/com/c2kernel/lifecycle/instance/Split.java b/source/com/c2kernel/lifecycle/instance/Split.java index 1f269af..e7b275c 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Split.java +++ b/source/com/c2kernel/lifecycle/instance/Split.java @@ -13,14 +13,14 @@ import com.c2kernel.scripting.ScriptingEngineException; */
public abstract class Split extends WfVertex
{
- public Vector mErrors;
+ public Vector<String> mErrors;
/**
* @see java.lang.Object#Object()
*/
public Split()
{
- mErrors = new Vector(0, 1);
+ mErrors = new Vector<String>(0, 1);
getProperties().put("RoutingScriptName", "");
getProperties().put("RoutingScriptVersion", "");
}
diff --git a/source/com/c2kernel/lifecycle/instance/Workflow.java b/source/com/c2kernel/lifecycle/instance/Workflow.java index a7066d8..4c8aa94 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/Workflow.java +++ b/source/com/c2kernel/lifecycle/instance/Workflow.java @@ -1,12 +1,14 @@ package com.c2kernel.lifecycle.instance;
import java.awt.Point;
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.entity.C2KLocalObject;
+import com.c2kernel.entity.agent.Job;
import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer;
@@ -171,9 +173,9 @@ public class Workflow extends CompositeActivity implements C2KLocalObject /**
* if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried
*/
- public ArrayList calculateJobs(AgentPath agent, int type)
+ public ArrayList<Job> calculateJobs(AgentPath agent, int type)
{
- ArrayList jobs = new ArrayList();
+ ArrayList<Job> jobs = new ArrayList<Job>();
if (type != 1)
jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, true));
if (type != 0)
diff --git a/source/com/c2kernel/lifecycle/instance/XOrSplit.java b/source/com/c2kernel/lifecycle/instance/XOrSplit.java index bd999af..108aa61 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/XOrSplit.java +++ b/source/com/c2kernel/lifecycle/instance/XOrSplit.java @@ -23,7 +23,7 @@ public class XOrSplit extends Split public void runNext(AgentPath agent) throws ScriptingEngineException
{
- ArrayList nextsToFollow = new ArrayList();
+ ArrayList<DirectedEdge> nextsToFollow = new ArrayList<DirectedEdge>();
String nexts = this.evaluateScript(
(String) getProperties().get("RoutingScriptName"),
(String) getProperties().get("RoutingScriptVersion")).toString();
diff --git a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java index 020d694..d363dc6 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java +++ b/source/com/c2kernel/lifecycle/instance/gui/model/WfVertexFactory.java @@ -1,5 +1,6 @@ package com.c2kernel.lifecycle.instance.gui.model;
import java.awt.Point;
+import java.io.Serializable;
import java.util.HashMap;
import javax.swing.JOptionPane;
@@ -26,7 +27,7 @@ public class WfVertexFactory implements VertexFactory, WorkflowDialogue vertexTypeId = (String) typeNameAndConstructionInfo.mInfo;
if (vertexTypeId.equals("Atomic") || vertexTypeId.equals("Composite"))
{
- HashMap mhm = new HashMap();
+ HashMap<String, Serializable> mhm = new HashMap<String, Serializable>();
mhm.put("P1", vertexTypeId);
mhm.put("P2", location);
//************************************************
diff --git a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java index fc0cd99..d33b717 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java +++ b/source/com/c2kernel/lifecycle/instance/gui/view/TransitionPanel.java @@ -40,7 +40,7 @@ public class TransitionPanel extends SelectedVertexPanel implements ActionListen protected GridBagConstraints c;
protected Box transBox;
protected JComboBox executors;
- protected JComboBox states = new JComboBox(States.states);
+ protected JComboBox<String> states = new JComboBox<String>(States.states);
protected JCheckBox active = new JCheckBox();
protected JLabel status = new JLabel();
protected ItemProxy mItem;
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java index eddec34..7bedc81 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/CreateItemFromDescription.java @@ -82,7 +82,7 @@ public class CreateItemFromDescription extends PredefinedStep // get init objects
String[] collNames = storage.getClusterContents(myPath.getSysKey(), ClusterStorage.COLLECTION);
- ArrayList collections = new ArrayList();
+ ArrayList<String> collections = new ArrayList<String>();
// loop through collections to instantiate
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java index 4abb0e6..3677220 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/Aggregation.java @@ -20,7 +20,6 @@ public class Aggregation implements java.io.Serializable { }
public com.c2kernel.collection.Aggregation create() {
- // TODO: create aggregation
return new com.c2kernel.collection.AggregationInstance();
}
}
diff --git a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java index 4988700..32ca623 100755..100644 --- a/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java +++ b/source/com/c2kernel/lifecycle/instance/predefined/entitycreation/NewItem.java @@ -43,7 +43,7 @@ public class NewItem { /**
* New Properties for the item
*/
- public ArrayList propertyList;
+ public ArrayList<Property> propertyList;
/**
* Field _aggregationList
@@ -58,7 +58,7 @@ public class NewItem { public NewItem() {
super();
- propertyList = new ArrayList();
+ propertyList = new ArrayList<Property>();
aggregationList = new ArrayList();
dependencyList = new ArrayList();
}
diff --git a/source/com/c2kernel/lookup/EntityPath.java b/source/com/c2kernel/lookup/EntityPath.java index 079f171..3a24228 100755..100644 --- a/source/com/c2kernel/lookup/EntityPath.java +++ b/source/com/c2kernel/lookup/EntityPath.java @@ -127,7 +127,7 @@ public class EntityPath extends Path if (sysKey < 0 || sysKey > maxSysKey)
throw new InvalidEntityPathException("System key "+sysKey+" out of range");
String stringPath = Integer.toString(sysKey);
- ArrayList newKey = new ArrayList();
+ ArrayList<String> newKey = new ArrayList<String>();
for (int i=0; i<elementNo; i++) {
StringBuffer nextComponent = new StringBuffer("d");
int start = stringPath.length()-elementLen;
diff --git a/source/com/c2kernel/lookup/LDAPPropertyManager.java b/source/com/c2kernel/lookup/LDAPPropertyManager.java index 4e1883e..a1fd6af 100755..100644 --- a/source/com/c2kernel/lookup/LDAPPropertyManager.java +++ b/source/com/c2kernel/lookup/LDAPPropertyManager.java @@ -47,7 +47,7 @@ public class LDAPPropertyManager { */
public String[] getPropertyNames(EntityPath thisEntity) throws ObjectNotFoundException {
LDAPEntry entityEntry = LDAPLookupUtils.getEntry(ldap.getConnection(), thisEntity.getFullDN());
- ArrayList propbag = new ArrayList();
+ ArrayList<String> propbag = new ArrayList<String>();
LDAPAttribute props = entityEntry.getAttribute("cristalprop");
for (Enumeration e = props.getStringValues(); e.hasMoreElements();) {
String thisProp = (String)e.nextElement();
diff --git a/source/com/c2kernel/lookup/LDAPRoleManager.java b/source/com/c2kernel/lookup/LDAPRoleManager.java index a9b6b23..a45da13 100755..100644 --- a/source/com/c2kernel/lookup/LDAPRoleManager.java +++ b/source/com/c2kernel/lookup/LDAPRoleManager.java @@ -113,7 +113,7 @@ public class LDAPRoleManager { }
String[] res = LDAPLookupUtils.getAllAttributeValues(roleEntry,"uniqueMember");
- ArrayList agents = new ArrayList();
+ ArrayList<AgentPath> agents = new ArrayList<AgentPath>();
for (int i=0; i<res.length; i++)
{
String userDN = res[i];
@@ -142,7 +142,7 @@ public class LDAPRoleManager { searchCons.setBatchSize(0);
searchCons.setDereference(LDAPSearchConstraints.DEREF_NEVER );
Enumeration roles = mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons);
- ArrayList roleList = new ArrayList();
+ ArrayList<RolePath> roleList = new ArrayList<RolePath>();
while(roles.hasMoreElements())
{
diff --git a/source/com/c2kernel/lookup/Path.java b/source/com/c2kernel/lookup/Path.java index b189910..b713493 100755..100644 --- a/source/com/c2kernel/lookup/Path.java +++ b/source/com/c2kernel/lookup/Path.java @@ -124,7 +124,7 @@ public abstract class Path implements Serializable */
public void setPath(String path)
{
- ArrayList newPath = new ArrayList();
+ ArrayList<String> newPath = new ArrayList<String>();
StringTokenizer tok = new StringTokenizer(path, delim);
if (tok.hasMoreTokens()) {
String first = tok.nextToken();
@@ -171,7 +171,7 @@ public abstract class Path implements Serializable if (dn.endsWith(root))
dn = dn.substring(0, dn.lastIndexOf(root));
- ArrayList newPath = new ArrayList();
+ ArrayList<String> newPath = new ArrayList<String>();
StringTokenizer tok = new StringTokenizer(dn, ",");
while (tok.hasMoreTokens()) {
String nextPath = tok.nextToken();
diff --git a/source/com/c2kernel/lookup/RolePath.java b/source/com/c2kernel/lookup/RolePath.java index df26eae..672bdbf 100755..100644 --- a/source/com/c2kernel/lookup/RolePath.java +++ b/source/com/c2kernel/lookup/RolePath.java @@ -63,7 +63,7 @@ public class RolePath extends DomainPath public Enumeration getChildren() {
AgentPath[] agents = getAgentsWithRole();
- Vector children = new Vector(agents.length);
+ Vector<AgentPath> children = new Vector<AgentPath>(agents.length);
for (int i = 0; i < agents.length; i++)
children.add(i, agents[i]);
return children.elements();
diff --git a/source/com/c2kernel/persistency/ClusterStorageManager.java b/source/com/c2kernel/persistency/ClusterStorageManager.java index 5309f33..560e022 100755..100644 --- a/source/com/c2kernel/persistency/ClusterStorageManager.java +++ b/source/com/c2kernel/persistency/ClusterStorageManager.java @@ -1,10 +1,6 @@ package com.c2kernel.persistency;
import java.util.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.StringTokenizer;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.C2KLocalObject;
@@ -24,12 +20,12 @@ import com.c2kernel.utils.SoftCache; * @author $Author: abranson $
*/
public class ClusterStorageManager {
- HashMap allStores = new HashMap();
+ HashMap<String, ClusterStorage> allStores = new HashMap<String, ClusterStorage>();
String[] clusterPriority;
- HashMap clusterWriters = new HashMap();
- HashMap clusterReaders = new HashMap();
+ HashMap<String, ArrayList<ClusterStorage>> clusterWriters = new HashMap<String, ArrayList<ClusterStorage>>();
+ HashMap<String, ArrayList<ClusterStorage>> clusterReaders = new HashMap<String, ArrayList<ClusterStorage>>();
// we don't need a soft cache for the top level cache - the proxies and entities clear that when reaped
- HashMap memoryCache = new HashMap();
+ HashMap<Integer, SoftCache<String, C2KLocalObject>> memoryCache = new HashMap<Integer, SoftCache<String, C2KLocalObject>>();
boolean ready = false;
/**
@@ -45,7 +41,7 @@ public class ClusterStorageManager { StringTokenizer tok = new StringTokenizer(allClusters, ",");
clusterPriority = new String[tok.countTokens()];
int clusterNo = 0;
- ArrayList rootStores = new ArrayList();
+ ArrayList<ClusterStorage> rootStores = new ArrayList<ClusterStorage>();
while (tok.hasMoreTokens()) {
ClusterStorage newStorage = null;
String newStorageClass = tok.nextToken();
@@ -82,7 +78,7 @@ public class ClusterStorageManager { }
public void close() {
- for (Iterator iter = allStores.values().iterator(); iter.hasNext();) {
+ for (Iterator<ClusterStorage> iter = allStores.values().iterator(); iter.hasNext();) {
ClusterStorage thisStorage = (ClusterStorage)iter.next();
try {
thisStorage.close();
@@ -97,7 +93,7 @@ public class ClusterStorageManager { * Returns the loaded storage that declare that they can handle writing or reading the specified cluster name (e.g.
* Collection, Property) Must specify if the request is a read or a write.
*/
- private ArrayList findStorages(String clusterType, boolean forWrite) {
+ private ArrayList<ClusterStorage> findStorages(String clusterType, boolean forWrite) {
if (!ready) {
Logger.error("ClusterStorageManager.findStorages() - called before init!");
@@ -105,7 +101,7 @@ public class ClusterStorageManager { }
// choose the right cache for readers or writers
- HashMap cache;
+ HashMap<String, ArrayList<ClusterStorage>> cache;
if (forWrite)
cache = clusterWriters;
else
@@ -113,11 +109,11 @@ public class ClusterStorageManager { // check to see if we've been asked to do this before
if (cache.containsKey(clusterType))
- return (ArrayList)cache.get(clusterType);
+ return (ArrayList<ClusterStorage>)cache.get(clusterType);
// not done yet, we'll have to query them all
Logger.msg(7, "ClusterStorageManager.findStorages() - finding storage for "+clusterType+" forWrite:"+forWrite);
- ArrayList useableStorages = new ArrayList();
+ ArrayList<ClusterStorage> useableStorages = new ArrayList<ClusterStorage>();
for (int i = 0; i < clusterPriority.length; i++) {
ClusterStorage thisStorage = (ClusterStorage)allStores.get(clusterPriority[i]);
short requiredSupport = forWrite ? ClusterStorage.WRITE : ClusterStorage.READ;
@@ -136,13 +132,13 @@ public class ClusterStorageManager { */
public String[] getClusterContents(Integer sysKey, String path) throws ClusterStorageException {
//String[] retArr = new String[0];
- ArrayList contents = new ArrayList();
+ ArrayList<String> contents = new ArrayList<String>();
// get all readers
String type = ClusterStorage.getClusterType(path);
Logger.msg(8, "ClusterStorageManager.getClusterContents() - Finding contents of "+path);
- ArrayList readers = findStorages(ClusterStorage.getClusterType(path), false);
+ ArrayList<ClusterStorage> readers = findStorages(ClusterStorage.getClusterType(path), false);
// try each in turn until we get a result
- for (Iterator i = readers.iterator(); i.hasNext();) {
+ for (Iterator<ClusterStorage> i = readers.iterator(); i.hasNext();) {
ClusterStorage thisReader = (ClusterStorage)i.next();
try {
String[] thisArr = thisReader.getClusterContents(sysKey, path);
@@ -168,9 +164,9 @@ public class ClusterStorageManager { public C2KLocalObject get(Integer sysKeyIntObj, String path) throws ClusterStorageException, ObjectNotFoundException {
C2KLocalObject result;
// check cache first
- SoftCache sysKeyMemCache = null;
+ SoftCache<String, C2KLocalObject> sysKeyMemCache = null;
if (memoryCache.containsKey(sysKeyIntObj)) {
- sysKeyMemCache = (SoftCache)memoryCache.get(sysKeyIntObj);
+ sysKeyMemCache = (SoftCache<String, C2KLocalObject>)memoryCache.get(sysKeyIntObj);
synchronized(sysKeyMemCache) {
C2KLocalObject obj = (C2KLocalObject)sysKeyMemCache.get(path);
if (obj != null) {
@@ -194,8 +190,8 @@ public class ClusterStorageManager { }
// else try each reader in turn until we find it
- ArrayList readers = findStorages(ClusterStorage.getClusterType(path), false);
- for (Iterator i = readers.iterator(); i.hasNext(); ) {
+ ArrayList<ClusterStorage> readers = findStorages(ClusterStorage.getClusterType(path), false);
+ for (Iterator<ClusterStorage> i = readers.iterator(); i.hasNext(); ) {
ClusterStorage thisReader = (ClusterStorage)i.next();
try {
result = thisReader.get(sysKeyIntObj, path);
@@ -203,7 +199,7 @@ public class ClusterStorageManager { if (result != null) { // got it!
// store it in the cache
if (sysKeyMemCache == null) { // create cache if needed
- sysKeyMemCache = new SoftCache(0);
+ sysKeyMemCache = new SoftCache<String, C2KLocalObject>(0);
synchronized (memoryCache) {
memoryCache.put(sysKeyIntObj, sysKeyMemCache);
}
@@ -225,8 +221,8 @@ public class ClusterStorageManager { /** Internal put method. Creates or overwrites a cluster in all writers. Used when committing transactions. */
public void put(Integer sysKeyIntObj, C2KLocalObject obj) throws ClusterStorageException {
String path = ClusterStorage.getPath(obj);
- ArrayList writers = findStorages(ClusterStorage.getClusterType(path), true);
- for (Iterator i = writers.iterator(); i.hasNext(); ) {
+ ArrayList<ClusterStorage> writers = findStorages(ClusterStorage.getClusterType(path), true);
+ for (Iterator<ClusterStorage> i = writers.iterator(); i.hasNext(); ) {
ClusterStorage thisWriter = (ClusterStorage)i.next();
try {
Logger.msg(7, "ClusterStorageManager.put() - writing "+path+" to "+thisWriter.getName());
@@ -238,11 +234,11 @@ public class ClusterStorageManager { }
}
// put in mem cache if that worked
- SoftCache sysKeyMemCache;
+ SoftCache<String, C2KLocalObject> sysKeyMemCache;
if (memoryCache.containsKey(sysKeyIntObj))
- sysKeyMemCache = (SoftCache)memoryCache.get(sysKeyIntObj);
+ sysKeyMemCache = (SoftCache<String, C2KLocalObject>)memoryCache.get(sysKeyIntObj);
else {
- sysKeyMemCache = new SoftCache();
+ sysKeyMemCache = new SoftCache<String, C2KLocalObject>();
synchronized (memoryCache) {
memoryCache.put(sysKeyIntObj, sysKeyMemCache);
}
@@ -260,8 +256,8 @@ public class ClusterStorageManager { /** Deletes a cluster from all writers */
public void remove(Integer sysKeyIntObj, String path) throws ClusterStorageException {
- ArrayList writers = findStorages(ClusterStorage.getClusterType(path), true);
- for (Iterator i = writers.iterator(); i.hasNext(); ) {
+ ArrayList<ClusterStorage> writers = findStorages(ClusterStorage.getClusterType(path), true);
+ for (Iterator<ClusterStorage> i = writers.iterator(); i.hasNext(); ) {
ClusterStorage thisWriter = (ClusterStorage)i.next();
try {
Logger.msg(7, "ClusterStorageManager.delete() - removing "+path+" from "+thisWriter.getName());
@@ -274,7 +270,7 @@ public class ClusterStorageManager { }
if (memoryCache.containsKey(sysKeyIntObj)) {
- SoftCache sysKeyMemCache = (SoftCache)memoryCache.get(sysKeyIntObj);
+ SoftCache<?, ?> sysKeyMemCache = (SoftCache<?, ?>)memoryCache.get(sysKeyIntObj);
synchronized (sysKeyMemCache) {
sysKeyMemCache.remove(path);
}
@@ -289,9 +285,9 @@ public class ClusterStorageManager { Logger.msg(7, "CSM.clearCache() - removing "+sysKeyIntObj+"/"+path);
if (memoryCache.containsKey(sysKeyIntObj)) {
- SoftCache sysKeyMemCache = (SoftCache)memoryCache.get(sysKeyIntObj);
+ SoftCache<?, ?> sysKeyMemCache = (SoftCache<?, ?>)memoryCache.get(sysKeyIntObj);
synchronized(sysKeyMemCache) {
- for (Iterator iter = sysKeyMemCache.keySet().iterator(); iter.hasNext();) {
+ for (Iterator<?> iter = sysKeyMemCache.keySet().iterator(); iter.hasNext();) {
String thisPath = (String)iter.next();
if (thisPath.startsWith(path)) {
Logger.msg(7, "CSM.clearCache() - removing "+sysKeyIntObj+"/"+thisPath);
@@ -309,7 +305,7 @@ public class ClusterStorageManager { if (memoryCache.containsKey(sysKeyIntObj)) {
synchronized (memoryCache) {
if (Logger.doLog(6)) {
- SoftCache sysKeyMemCache = (SoftCache)memoryCache.get(sysKeyIntObj);
+ SoftCache<?, ?> sysKeyMemCache = (SoftCache<?, ?>)memoryCache.get(sysKeyIntObj);
int size = sysKeyMemCache.size();
Logger.msg(6, "CSM.clearCache() - "+size+" objects to remove.");
}
@@ -330,13 +326,13 @@ public class ClusterStorageManager { public void dumpCacheContents(int logLevel) {
if (!Logger.doLog(logLevel)) return;
synchronized(memoryCache) {
- for (Iterator iter = memoryCache.keySet().iterator(); iter.hasNext();) {
+ for (Iterator<Integer> iter = memoryCache.keySet().iterator(); iter.hasNext();) {
Integer sysKey = (Integer) iter.next();
Logger.msg(logLevel, "Cached Objects of Entity "+sysKey);
- SoftCache sysKeyMemCache = (SoftCache)memoryCache.get(sysKey);
+ SoftCache<?, ?> sysKeyMemCache = (SoftCache<?, ?>)memoryCache.get(sysKey);
try {
synchronized(sysKeyMemCache) {
- for (Iterator iterator = sysKeyMemCache.keySet().iterator();iterator.hasNext();) {
+ for (Iterator<?> iterator = sysKeyMemCache.keySet().iterator();iterator.hasNext();) {
String path = (String) iterator.next();
try {
Logger.msg(logLevel, " Path "+path+": "+sysKeyMemCache.get(path).getClass().getName());
diff --git a/source/com/c2kernel/persistency/LDAPClusterStorage.java b/source/com/c2kernel/persistency/LDAPClusterStorage.java index 8e159e0..fb36d9f 100755..100644 --- a/source/com/c2kernel/persistency/LDAPClusterStorage.java +++ b/source/com/c2kernel/persistency/LDAPClusterStorage.java @@ -146,7 +146,7 @@ public class LDAPClusterStorage extends ClusterStorage { else
if (type.equals("")) { // root query
String[] allClusters = new String[0];
- ArrayList clusterList = new ArrayList();
+ ArrayList<String> clusterList = new ArrayList<String>();
if (ldapStore.hasProperties(thisEntity))
clusterList.add(PROPERTY);
allClusters = (String[])clusterList.toArray(allClusters);
diff --git a/source/com/c2kernel/persistency/ProxyLoader.java b/source/com/c2kernel/persistency/ProxyLoader.java index d20fb2d..687141f 100755..100644 --- a/source/com/c2kernel/persistency/ProxyLoader.java +++ b/source/com/c2kernel/persistency/ProxyLoader.java @@ -18,7 +18,7 @@ import com.c2kernel.utils.Logger; */
public class ProxyLoader extends ClusterStorage {
- HashMap entities = new HashMap();
+ HashMap<Integer, ManageableEntity> entities = new HashMap<Integer, ManageableEntity>();
LDAPLookup lookup;
public void open() throws ClusterStorageException {
diff --git a/source/com/c2kernel/persistency/TransactionManager.java b/source/com/c2kernel/persistency/TransactionManager.java index 252c758..0908051 100755..100644 --- a/source/com/c2kernel/persistency/TransactionManager.java +++ b/source/com/c2kernel/persistency/TransactionManager.java @@ -13,14 +13,14 @@ import com.c2kernel.utils.Logger; public class TransactionManager {
- HashMap locks;
- HashMap pendingTransactions;
+ HashMap<Integer, Object> locks;
+ HashMap<Object, ArrayList<TransactionEntry>> pendingTransactions;
ClusterStorageManager storage;
public TransactionManager() throws ClusterStorageException {
storage = new ClusterStorageManager();
- locks = new HashMap();
- pendingTransactions = new HashMap();
+ locks = new HashMap<Integer, Object>();
+ pendingTransactions = new HashMap<Object, ArrayList<TransactionEntry>>();
}
public boolean hasPendingTransactions()
@@ -92,7 +92,7 @@ public class TransactionManager { */
public void put(int sysKey, C2KLocalObject obj, Object locker) throws ClusterStorageException {
Integer sysKeyIntObj = new Integer(sysKey);
- ArrayList lockerTransaction;
+ ArrayList<TransactionEntry> lockerTransaction;
String path = ClusterStorage.getPath(obj);
synchronized(locks) {
@@ -101,7 +101,7 @@ public class TransactionManager { // if it's this locker, get the transaction list
Object thisLocker = locks.get(sysKeyIntObj);
if (thisLocker.equals(locker)) // retrieve the transaction list
- lockerTransaction = (ArrayList)pendingTransactions.get(locker);
+ lockerTransaction = pendingTransactions.get(locker);
else // locked by someone else
throw new ClusterStorageException("ClusterStorageManager.get() - Access denied: Object " + sysKeyIntObj +
" has been locked for writing by " + thisLocker);
@@ -113,7 +113,7 @@ public class TransactionManager { }
else {// initialise the transaction
locks.put(sysKeyIntObj, locker);
- lockerTransaction = new ArrayList();
+ lockerTransaction = new ArrayList<TransactionEntry>();
pendingTransactions.put(locker, lockerTransaction);
}
}
@@ -134,14 +134,14 @@ public class TransactionManager { */
public void remove(int sysKey, String path, Object locker) throws ClusterStorageException {
Integer sysKeyIntObj = new Integer(sysKey);
- ArrayList lockerTransaction;
+ ArrayList<TransactionEntry> lockerTransaction;
synchronized(locks) {
// look to see if this object is already locked
if (locks.containsKey(sysKeyIntObj)) {
// if it's this locker, get the transaction list
Object thisLocker = locks.get(sysKeyIntObj);
if (thisLocker.equals(locker)) // retrieve the transaction list
- lockerTransaction = (ArrayList)pendingTransactions.get(locker);
+ lockerTransaction = pendingTransactions.get(locker);
else // locked by someone else
throw new ClusterStorageException("ClusterStorageManager.get() - Access denied: Object " + sysKeyIntObj +
" has been locked for writing by " + thisLocker);
@@ -153,7 +153,7 @@ public class TransactionManager { }
else {// initialise the transaction
locks.put(sysKeyIntObj, locker);
- lockerTransaction = new ArrayList();
+ lockerTransaction = new ArrayList<TransactionEntry>();
pendingTransactions.put(locker, lockerTransaction);
}
}
@@ -194,7 +194,7 @@ public class TransactionManager { public void commit(Object locker) {
synchronized(locks) {
ArrayList lockerTransactions = (ArrayList)pendingTransactions.get(locker);
- HashMap exceptions = new HashMap();
+ HashMap<TransactionEntry, Exception> exceptions = new HashMap<TransactionEntry, Exception>();
// quit if no transactions are present;
if (lockerTransactions == null) return;
for (Iterator i = lockerTransactions.iterator();i.hasNext();) {
diff --git a/source/com/c2kernel/persistency/XMLClusterStorage.java b/source/com/c2kernel/persistency/XMLClusterStorage.java index 6e3cd72..24697af 100755..100644 --- a/source/com/c2kernel/persistency/XMLClusterStorage.java +++ b/source/com/c2kernel/persistency/XMLClusterStorage.java @@ -110,7 +110,7 @@ public class XMLClusterStorage extends ClusterStorage { String filePath = getFilePath(sysKey, path);
ArrayList paths = FileStringUtility.listDir( filePath, true, false );
if (paths == null) return result; // dir doesn't exist yet
- ArrayList contents = new ArrayList();
+ ArrayList<String> contents = new ArrayList<String>();
String previous = null;
for (int i=0; i<paths.size(); i++) {
String next = (String)paths.get(i);
diff --git a/source/com/c2kernel/process/Bootstrap.java b/source/com/c2kernel/process/Bootstrap.java index 61ce46f..ce6791c 100755..100644 --- a/source/com/c2kernel/process/Bootstrap.java +++ b/source/com/c2kernel/process/Bootstrap.java @@ -45,7 +45,7 @@ import com.c2kernel.utils.Resource; public class Bootstrap
{
- static HashMap bootstrapFactoryItems = new HashMap();
+ static HashMap<String, String> bootstrapFactoryItems = new HashMap<String, String>();
static DomainPath thisServerPath;
/**
diff --git a/source/com/c2kernel/process/Gateway.java b/source/com/c2kernel/process/Gateway.java index fcec1c4..276b7b4 100755..100644 --- a/source/com/c2kernel/process/Gateway.java +++ b/source/com/c2kernel/process/Gateway.java @@ -143,6 +143,7 @@ public class Gateway sysProps.put("ORBHost", serverName);
String serverPort = getProperty("ItemServer.iiop", "1500");
sysProps.put("ORBPort", serverPort);
+ //TODO: externalize this (or replace corba completely)
sysProps.put("com.sun.CORBA.POA.ORBServerId", "1");
sysProps.put("com.sun.CORBA.POA.ORBPersistentServerPort", serverPort);
diff --git a/source/com/c2kernel/process/StandardClient.java b/source/com/c2kernel/process/StandardClient.java index 00cebe6..2b04613 100755..100644 --- a/source/com/c2kernel/process/StandardClient.java +++ b/source/com/c2kernel/process/StandardClient.java @@ -12,5 +12,7 @@ package com.c2kernel.process; abstract public class StandardClient extends AbstractMain
{
+
+ //TODO: Auto-update from server
}
diff --git a/source/com/c2kernel/process/UserCodeProcess.java b/source/com/c2kernel/process/UserCodeProcess.java index 7eff37b..18fed06 100755..100644 --- a/source/com/c2kernel/process/UserCodeProcess.java +++ b/source/com/c2kernel/process/UserCodeProcess.java @@ -28,8 +28,8 @@ import com.c2kernel.utils.Logger; public class UserCodeProcess extends StandardClient implements EntityProxyObserver, Runnable {
protected AgentProxy agent;
static boolean active = true;
- ArrayList ignoredPaths = new ArrayList();
- HashMap jobs;
+ ArrayList<String> ignoredPaths = new ArrayList<String>();
+ HashMap<String, C2KLocalObject> jobs;
public UserCodeProcess(String agentName, String agentPass) {
// login - try for a while in case server hasn't imported our user yet
@@ -51,7 +51,7 @@ public class UserCodeProcess extends StandardClient implements EntityProxyObserv public void run() {
Thread.currentThread().setName("Usercode Process");
- jobs = new HashMap();
+ jobs = new HashMap<String, C2KLocalObject>();
// subscribe to job list
agent.subscribe(this, ClusterStorage.JOB, true);
while (active) {
diff --git a/source/com/c2kernel/property/PropertyArrayList.java b/source/com/c2kernel/property/PropertyArrayList.java index 71fc9b7..dffbaf6 100755..100644 --- a/source/com/c2kernel/property/PropertyArrayList.java +++ b/source/com/c2kernel/property/PropertyArrayList.java @@ -13,14 +13,14 @@ import java.util.ArrayList; import com.c2kernel.utils.CastorArrayList;
-public class PropertyArrayList extends CastorArrayList
+public class PropertyArrayList extends CastorArrayList<Property>
{
public PropertyArrayList()
{
super();
}
- public PropertyArrayList(ArrayList aList)
+ public PropertyArrayList(ArrayList<Property> aList)
{
super(aList);
}
diff --git a/source/com/c2kernel/property/PropertyDescriptionList.java b/source/com/c2kernel/property/PropertyDescriptionList.java index 596aa52..64754a7 100755..100644 --- a/source/com/c2kernel/property/PropertyDescriptionList.java +++ b/source/com/c2kernel/property/PropertyDescriptionList.java @@ -14,14 +14,14 @@ import java.util.Iterator; import com.c2kernel.utils.CastorArrayList;
-public class PropertyDescriptionList extends CastorArrayList
+public class PropertyDescriptionList extends CastorArrayList<PropertyDescription>
{
public PropertyDescriptionList()
{
super();
}
- public PropertyDescriptionList(ArrayList aList)
+ public PropertyDescriptionList(ArrayList<PropertyDescription> aList)
{
super(aList);
}
diff --git a/source/com/c2kernel/scripting/ErrorInfo.java b/source/com/c2kernel/scripting/ErrorInfo.java index 2714b93..1e813ec 100755..100644 --- a/source/com/c2kernel/scripting/ErrorInfo.java +++ b/source/com/c2kernel/scripting/ErrorInfo.java @@ -12,12 +12,12 @@ import java.util.Iterator; * All rights reserved.
**************************************************************************/
public class ErrorInfo {
- ArrayList msg;
+ ArrayList<String> msg;
boolean fatal = false;
public ErrorInfo() {
super();
- msg = new ArrayList();
+ msg = new ArrayList<String>();
}
public void addError(String error) {
diff --git a/source/com/c2kernel/scripting/Script.java b/source/com/c2kernel/scripting/Script.java index 7b1c6db..4abb5cf 100755..100644 --- a/source/com/c2kernel/scripting/Script.java +++ b/source/com/c2kernel/scripting/Script.java @@ -39,9 +39,9 @@ public class Script String mName;
String mVersion;
String mLang;
- HashMap mInputParams = new HashMap();
- HashMap mAllInputParams = new HashMap();
- ArrayList mIncludes = new ArrayList();
+ HashMap<String, Parameter> mInputParams = new HashMap<String, Parameter>();
+ HashMap<String, Parameter> mAllInputParams = new HashMap<String, Parameter>();
+ ArrayList<Script> mIncludes = new ArrayList<Script>();
BSFManager scriptManager;
/**
diff --git a/source/com/c2kernel/scripting/ScriptConsole.java b/source/com/c2kernel/scripting/ScriptConsole.java index c144ef7..d79cd5c 100755..100644 --- a/source/com/c2kernel/scripting/ScriptConsole.java +++ b/source/com/c2kernel/scripting/ScriptConsole.java @@ -44,7 +44,7 @@ public class ScriptConsole implements SocketHandler { Socket socket = null;
BSFManager manager;
BSFEngine context;
- static ArrayList securityHosts = new ArrayList();
+ static ArrayList<String> securityHosts = new ArrayList<String>();
public static final short NONE = 0;
public static final short ALLOW = 1;
public static final short DENY = 2;
diff --git a/source/com/c2kernel/utils/ActDefCache.java b/source/com/c2kernel/utils/ActDefCache.java index bfd5cdb..148d934 100755..100644 --- a/source/com/c2kernel/utils/ActDefCache.java +++ b/source/com/c2kernel/utils/ActDefCache.java @@ -15,7 +15,7 @@ import com.c2kernel.persistency.outcome.Viewpoint; public class ActDefCache {
- SoftCache actCache = new SoftCache();
+ SoftCache<String, ActCacheEntry> actCache = new SoftCache<String, ActCacheEntry>();
public ActivityDef get(String actName, String actVersion) throws ObjectNotFoundException, InvalidDataException {
ActivityDef thisActDef;
diff --git a/source/com/c2kernel/utils/CastorArrayList.java b/source/com/c2kernel/utils/CastorArrayList.java index 10ff948..7596dd9 100755..100644 --- a/source/com/c2kernel/utils/CastorArrayList.java +++ b/source/com/c2kernel/utils/CastorArrayList.java @@ -15,15 +15,15 @@ import java.util.ArrayList; * All rights reserved.
**************************************************************************/
//
-abstract public class CastorArrayList implements Serializable{
- public ArrayList list = new ArrayList();
+abstract public class CastorArrayList<T> implements Serializable{
+ public ArrayList<T> list;
public CastorArrayList() {
super();
- list = new ArrayList();
+ list = new ArrayList<T>();
}
- public CastorArrayList(ArrayList list) {
+ public CastorArrayList(ArrayList<T> list) {
this();
this.list = list;
}
diff --git a/source/com/c2kernel/utils/CastorHashMap.java b/source/com/c2kernel/utils/CastorHashMap.java index fec2044..25e5ab4 100755..100644 --- a/source/com/c2kernel/utils/CastorHashMap.java +++ b/source/com/c2kernel/utils/CastorHashMap.java @@ -6,7 +6,7 @@ import java.util.Iterator; // This subclass of hashtable can be marshalled
// and unmarshalled with Castor
-public class CastorHashMap extends HashMap
+public class CastorHashMap extends HashMap<String,Object>
{
public CastorHashMap()
{
@@ -18,13 +18,13 @@ public class CastorHashMap extends HashMap int numKeys = size();
KeyValuePair[] keyValuePairs = new KeyValuePair[numKeys];
- Iterator keyIter = keySet().iterator();
+ Iterator<String> keyIter = keySet().iterator();
int i = 0;
for(i=0; i<numKeys; i++)
if (keyIter.hasNext())
{
- String tmp = (String)keyIter.next();
+ String tmp = keyIter.next();
keyValuePairs[i] = new KeyValuePair(tmp,get(tmp));
}
diff --git a/source/com/c2kernel/utils/CastorXMLUtility.java b/source/com/c2kernel/utils/CastorXMLUtility.java index 07e8e3f..1f68e77 100644 --- a/source/com/c2kernel/utils/CastorXMLUtility.java +++ b/source/com/c2kernel/utils/CastorXMLUtility.java @@ -28,7 +28,7 @@ import com.c2kernel.persistency.outcome.Outcome; public class CastorXMLUtility
{
private static Mapping mMapping = new Mapping();
- private static HashSet mMappingKeys = new HashSet();
+ private static HashSet<URL> mMappingKeys = new HashSet<URL>();
/**
* Looks for a file called 'index.xml' at the given URL, and loads every file
diff --git a/source/com/c2kernel/utils/FileStringUtility.java b/source/com/c2kernel/utils/FileStringUtility.java index 948341a..84f46ca 100755..100644 --- a/source/com/c2kernel/utils/FileStringUtility.java +++ b/source/com/c2kernel/utils/FileStringUtility.java @@ -67,7 +67,7 @@ public class FileStringUtility {
FileReader fr = new FileReader(file);
BufferedReader buf = new BufferedReader(fr);
- Vector lines = new Vector();
+ Vector<String> lines = new Vector<String>();
String thisLine = null;
while ((thisLine = buf.readLine()) != null)
lines.addElement(thisLine);
@@ -240,9 +240,9 @@ public class FileStringUtility * @param dirPath starting directory
* @param recursive goes into the subdirectories
**************************************************************************/
- static public ArrayList listDir(String dirPath, boolean withDirs, boolean recursive)
+ static public ArrayList<String> listDir(String dirPath, boolean withDirs, boolean recursive)
{
- ArrayList fileNames = new ArrayList();
+ ArrayList<String> fileNames = new ArrayList<String>();
File dir = new File(dirPath);
File files[];
String fileName;
@@ -339,7 +339,7 @@ public class FileStringUtility try
{
String language = FileStringUtility.file2String(configFile);
- Hashtable props = new Hashtable();
+ Hashtable<String, String> props = new Hashtable<String, String>();
StringTokenizer tok = new StringTokenizer(language, "\n");
while (tok.hasMoreTokens())
{
diff --git a/source/com/c2kernel/utils/Language.java b/source/com/c2kernel/utils/Language.java index ae0947f..ee74f96 100755..100644 --- a/source/com/c2kernel/utils/Language.java +++ b/source/com/c2kernel/utils/Language.java @@ -12,7 +12,7 @@ import java.util.Hashtable; public class Language
{
public static Hashtable mTableOfTranslation = new Hashtable();
- public static Hashtable mTableOfUntranslated = new Hashtable();
+ public static Hashtable<String, String> mTableOfUntranslated = new Hashtable<String, String>();
public static boolean isTranlated=false;
private Hashtable tableOfTranslation = new Hashtable();
diff --git a/source/com/c2kernel/utils/Logger.java b/source/com/c2kernel/utils/Logger.java index 6ac3f7c..2d4d975 100755..100644 --- a/source/com/c2kernel/utils/Logger.java +++ b/source/com/c2kernel/utils/Logger.java @@ -26,7 +26,7 @@ public class Logger * add ten to output time before each message
*/
private static int mHighestLogLevel = 0;
- private static HashMap logStreams = new HashMap();
+ private static HashMap<PrintStream, Integer> logStreams = new HashMap<PrintStream, Integer>();
static protected SimpleTCPIPServer mConsole = null;
static private void printMessage(String message, int msgLogLevel)
diff --git a/source/com/c2kernel/utils/Resource.java b/source/com/c2kernel/utils/Resource.java index 7a47625..33100d8 100755..100644 --- a/source/com/c2kernel/utils/Resource.java +++ b/source/com/c2kernel/utils/Resource.java @@ -15,8 +15,8 @@ import com.c2kernel.common.ObjectNotFoundException; * @version $Revision: 1.71 $
**************************************************************************/
public class Resource {
- static private Hashtable txtCache = new Hashtable();
- static private Hashtable imgCache = new Hashtable();
+ static private Hashtable<String, String> txtCache = new Hashtable<String, String>();
+ static private Hashtable<String, ImageIcon> imgCache = new Hashtable<String, ImageIcon>();
static private URL baseURL = null;
static private URL domainBaseURL = null;
static private URL importURL = null;
diff --git a/source/com/c2kernel/utils/SoftCache.java b/source/com/c2kernel/utils/SoftCache.java index f13c87d..6680f30 100644 --- a/source/com/c2kernel/utils/SoftCache.java +++ b/source/com/c2kernel/utils/SoftCache.java @@ -10,12 +10,12 @@ import java.util.*; *
* $Revision: 1.5 $ $Date: 2004/10/29 13:29:09 $
******************************************************************************/
-public class SoftCache extends AbstractMap {
+public class SoftCache<K, V> extends AbstractMap<K, V> {
- private final Map hash = new HashMap();
+ private final Map<K, SoftValue<V>> hash = new HashMap<K, SoftValue<V>>();
private final int minSize;
- private final LinkedList hardCache = new LinkedList();
- private final ReferenceQueue queue = new ReferenceQueue();
+ private final LinkedList<V> hardCache = new LinkedList<V>();
+ private final ReferenceQueue<V> queue = new ReferenceQueue<V>();
public SoftCache() {
this(0);
@@ -25,9 +25,10 @@ public class SoftCache extends AbstractMap { this.minSize = minSize;
}
- public Object get(Object key) {
- Object result = null;
- SoftReference soft_ref = (SoftReference) hash.get(key);
+ @Override
+ public V get(Object key) {
+ V result = null;
+ SoftValue<V> soft_ref = hash.get(key);
if (soft_ref != null) {
result = soft_ref.get();
if (result == null)
@@ -42,19 +43,20 @@ public class SoftCache extends AbstractMap { return result;
}
- public Object put(Object key, Object value) {
+ public V put(K key, V value) {
processQueue();
if (minSize > 0) {
hardCache.addFirst(value);
if (hardCache.size() > minSize)
hardCache.removeLast();
}
- return hash.put(key, new SoftValue(value, key, queue));
+ hash.put(key, new SoftValue<V>(key, value, queue));
+ return value;
}
- public Object remove(Object key) {
+ public V remove(Object key) {
processQueue();
- return hash.remove(key);
+ return hash.remove(key).get();
}
public void clear() {
@@ -68,21 +70,21 @@ public class SoftCache extends AbstractMap { return hash.size();
}
- public Set keySet() {
+ public Set<K> keySet() {
processQueue();
return hash.keySet();
}
- public Set entrySet() {
+ public Set<Map.Entry<K, V>> entrySet() {
// Would have to create another Map to do this - too expensive
// Throwing runtime expensive is dangerous, but better than nulls
throw new UnsupportedOperationException();
}
- private static class SoftValue extends SoftReference {
+ private static class SoftValue<V> extends SoftReference<V> {
private final Object key;
- private SoftValue(Object k, Object key, ReferenceQueue q) {
- super(k, q);
+ private SoftValue(Object key, V value, ReferenceQueue<V> q) {
+ super(value, q);
this.key = key;
}
}
diff --git a/source/com/c2kernel/utils/TransientCache.java b/source/com/c2kernel/utils/TransientCache.java index b93bbd7..8991b87 100755..100644 --- a/source/com/c2kernel/utils/TransientCache.java +++ b/source/com/c2kernel/utils/TransientCache.java @@ -12,18 +12,17 @@ import java.util.*; * Copyright (C) 2003 CERN - European Organization for Nuclear Research
* All rights reserved.
**************************************************************************/
-public abstract class TransientCache extends AbstractMap {
+public abstract class TransientCache<K, V> extends AbstractMap<K, V> {
- private Map map = new Hashtable();
- public synchronized Set entrySet() {
- Map newMap;
- Iterator iter;
- newMap = new Hashtable();
- iter = map.entrySet().iterator();
+ private Map<K, Reference<V>> map = new Hashtable<K, Reference<V>>();
+
+ public synchronized Set<Entry<K, V>> entrySet() {
+ Map<K, V> newMap = new Hashtable<K,V>();
+ Iterator<Entry<K, Reference<V>>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry me = (Map.Entry)iter.next();
- Reference ref = (Reference)me.getValue();
- Object o = ref.get();
+ Entry<K, Reference<V>> me = iter.next();
+ Reference<V> ref = me.getValue();
+ V o = ref.get();
if (o == null) {
// Delete cleared reference
iter.remove();
@@ -36,35 +35,35 @@ public abstract class TransientCache extends AbstractMap { return newMap.entrySet();
}
- public synchronized Object put(Object key, Object value) {
- Reference ref = makeReference(value);
- ref = (Reference)map.put(key, ref);
+ public synchronized V put(K key, V value) {
+ Reference<V> ref = makeReference(value);
+ ref = (Reference<V>)map.put(key, ref);
if (ref != null)
return (ref.get());
return null;
}
- public abstract Reference makeReference(Object value);
+ public abstract Reference<V> makeReference(Object value);
- public Object remove(Object key) {
- Iterator i = map.entrySet().iterator();
- Entry correctEntry = null;
+ public V remove(Object key) {
+ Iterator<Entry<K, Reference<V>>> i = map.entrySet().iterator();
+ Entry<K, Reference<V>> correctEntry = null;
if (key == null) {
while (correctEntry == null && i.hasNext()) {
- Entry e = (Entry)i.next();
+ Entry<K, Reference<V>> e = i.next();
if (e.getKey() == null)
correctEntry = e;
}
} else {
while (correctEntry == null && i.hasNext()) {
- Entry e = (Entry)i.next();
+ Entry<K, Reference<V>> e = i.next();
if (key.equals(e.getKey()))
correctEntry = e;
}
}
- Object oldValue = null;
+ V oldValue = null;
if (correctEntry != null) {
- Reference correctReference = (Reference)correctEntry.getValue();
+ Reference<V> correctReference = correctEntry.getValue();
oldValue = correctReference.get();
i.remove();
}
@@ -77,21 +76,21 @@ public abstract class TransientCache extends AbstractMap { map.entrySet().clear();
}
- private transient Set keySet = null;
+ private transient Set<K> keySet = null;
- public Set keySet() {
+ public Set<K> keySet() {
if (keySet == null) {
- keySet = new AbstractSet() {
- public Iterator iterator() {
- return new Iterator() {
- private Iterator i = map.entrySet().iterator();
+ keySet = new AbstractSet<K>() {
+ public Iterator<K> iterator() {
+ return new Iterator<K>() {
+ private Iterator<Entry<K, Reference<V>>> i = map.entrySet().iterator();
public boolean hasNext() {
return i.hasNext();
}
- public Object next() {
- return ((Entry)i.next()).getKey();
+ public K next() {
+ return i.next().getKey();
}
public void remove() {
diff --git a/source/com/c2kernel/utils/XmlElementParser.java b/source/com/c2kernel/utils/XmlElementParser.java index f6fef4b..0f138d3 100755..100644 --- a/source/com/c2kernel/utils/XmlElementParser.java +++ b/source/com/c2kernel/utils/XmlElementParser.java @@ -27,7 +27,7 @@ public class XmlElementParser public static String[] parseOld(String data, String path)
{
- Vector returnData = new Vector();
+ Vector<String> returnData = new Vector<String>();
String[] returnArray = new String[0];
try
{
diff --git a/source/com/c2kernel/utils/server/HTTPRequestHandler.java b/source/com/c2kernel/utils/server/HTTPRequestHandler.java index 1cad863..78635e6 100755..100644 --- a/source/com/c2kernel/utils/server/HTTPRequestHandler.java +++ b/source/com/c2kernel/utils/server/HTTPRequestHandler.java @@ -14,7 +14,7 @@ import com.c2kernel.utils.Logger; public class HTTPRequestHandler implements SocketHandler {
- protected HashMap headers = new HashMap();
+ protected HashMap<String, String> headers = new HashMap<String, String>();
protected String method;
protected String resource;
protected String version;
diff --git a/source/com/c2kernel/utils/server/SimpleTCPIPServer.java b/source/com/c2kernel/utils/server/SimpleTCPIPServer.java index 12e8ec4..8db9257 100755..100644 --- a/source/com/c2kernel/utils/server/SimpleTCPIPServer.java +++ b/source/com/c2kernel/utils/server/SimpleTCPIPServer.java @@ -20,7 +20,7 @@ public class SimpleTCPIPServer implements Runnable Class handlerClass = null;
ServerSocket serverSocket = null;
boolean keepListening = true;
- ArrayList currentHandlers = new ArrayList();
+ ArrayList<SocketHandler> currentHandlers = new ArrayList<SocketHandler>();
static short noServers = 0;
public SimpleTCPIPServer(int port, Class handlerClass, int maxConnections)
|
