Registry.java 663 Bytes
package se.lil.om;

import java.util.ArrayList;

public class Registry {
	private static ArrayList<OraMon> oraList = null;
	public static boolean test = true;
	
	public static synchronized ArrayList<OraMon> getList() {
		if (oraList == null) {
			oraList = new ArrayList<OraMon>();
		}
		return oraList;
	}
	
	public static synchronized OraMon findOrCreate(String conStr, String usrStr, String pwdStr) {
		for (OraMon item : getList()) {
			if(item.getConString().equals(conStr)) {
				return item;
			}
		}
		// Not found, create it
		OraMon monitor = new OraMon(conStr, usrStr, pwdStr);
		oraList.add(monitor);
		return monitor;
	}
}