/** * Lazy initialize the default instance. */ public static PopulationManager getDefaultManager() { if (defaultManager == null) { defaultManager = new PopulationManager(); } return defaultManager; }
/** * Add all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public void addAllObjectsForAbstractClass(Class objectsClass, org.eclipse.persistence.sessions.Session session, Vector allObjects) { addAllObjectsForAbstractClass(objectsClass, (AbstractSession)session, allObjects); }
/** * Return all of the objects registered. */ public Vector getAllObjects() { Vector allObjects; allObjects = new Vector(); for (Enumeration e = getAllClasses().elements(); e.hasMoreElements();) { Class eachClass = (Class)e.nextElement(); addAllObjectsForClass(eachClass, allObjects); } return allObjects; }
/** * Return the object registered given its name. */ public Object getObject(Class objectsClass, String objectsName) { if (!(getRegisteredObjects().containsKey(objectsClass))) { return null; } return ((Hashtable)getRegisteredObjects().get(objectsClass)).get(objectsName); }
/** * Add all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public void addAllObjectsForAbstractClass(Class objectsClass, AbstractSession session, Vector allObjects) { ClassDescriptor descriptor = session.getDescriptor(objectsClass); addAllObjectsForClass(objectsClass, allObjects); for (Enumeration enumeration = descriptor.getInheritancePolicy().getChildDescriptors().elements(); enumeration.hasMoreElements();) { addAllObjectsForAbstractClass(((ClassDescriptor)enumeration.nextElement()).getJavaClass(), session, allObjects); } }
/** * Return all of the objects of the class. */ public Vector getAllObjectsForClass(Class objectsClass) { Vector allObjects; allObjects = new Vector(); addAllObjectsForClass(objectsClass, allObjects); return allObjects; }
/** * Remove the object given its name. */ public Object removeObject(Object objectToRemove, String objectsName) { removeObject(objectToRemove.getClass(), objectsName); return objectToRemove; }
/** * Check if the object is registered given its name. */ public boolean containsObject(Object objectToCheck, String objectsName) { return containsObject(objectToCheck.getClass(), objectsName); }
/** * Return the object registred given its name. */ public Object getObject(Class objectsClass, String objectsName) { if (!(getRegisteredObjects().containsKey(objectsClass))) { return null; } return ((Hashtable)getRegisteredObjects().get(objectsClass)).get(objectsName); }
/** * Add all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public void addAllObjectsForAbstractClass(Class objectsClass, AbstractSession session, Vector allObjects) { ClassDescriptor descriptor = session.getDescriptor(objectsClass); addAllObjectsForClass(objectsClass, allObjects); for (ClassDescriptor child : descriptor.getInheritancePolicy().getChildDescriptors()) { addAllObjectsForAbstractClass(child.getJavaClass(), session, allObjects); } }
/** * Return all of the objects of the class. */ public Vector getAllObjectsForClass(Class objectsClass) { Vector allObjects; allObjects = new Vector(); addAllObjectsForClass(objectsClass, allObjects); return allObjects; }
/** * Remove the object given its name. */ public Object removeObject(Object objectToRemove, String objectsName) { removeObject(objectToRemove.getClass(), objectsName); return objectToRemove; }
/** * Check if the object is registred given its name. */ public boolean containsObject(Object objectToCheck, String objectsName) { return containsObject(objectToCheck.getClass(), objectsName); }
/** * Register the object given its name. * The objects are represented as a hashtable of hashtables, lazy initialized on the class. */ public Object registerObject(Class javaClass, Object objectToRegister, String objectsName) { if (!(getRegisteredObjects().containsKey(javaClass))) { getRegisteredObjects().put(javaClass, new Hashtable()); } ((Hashtable)getRegisteredObjects().get(javaClass)).put(objectsName, objectToRegister); return objectToRegister; }
/** * Add all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public void addAllObjectsForAbstractClass(Class objectsClass, AbstractSession session, Vector allObjects) { ClassDescriptor descriptor = session.getDescriptor(objectsClass); addAllObjectsForClass(objectsClass, allObjects); for (ClassDescriptor child : descriptor.getInheritancePolicy().getChildDescriptors()) { addAllObjectsForAbstractClass(child.getJavaClass(), session, allObjects); } }
/** * Return all of the objects registered. */ public Vector getAllObjects() { Vector allObjects; allObjects = new Vector(); for (Enumeration e = getAllClasses().elements(); e.hasMoreElements();) { Class eachClass = (Class)e.nextElement(); addAllObjectsForClass(eachClass, allObjects); } return allObjects; }
/** * Return all of the objects of the class. */ public Vector getAllObjectsForClass(Class objectsClass) { Vector allObjects; allObjects = new Vector(); addAllObjectsForClass(objectsClass, allObjects); return allObjects; }
/** * Add all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public void addAllObjectsForAbstractClass(Class objectsClass, org.eclipse.persistence.sessions.Session session, Vector allObjects) { addAllObjectsForAbstractClass(objectsClass, (AbstractSession)session, allObjects); }
/** * Lazy initialize the default instance. */ public static PopulationManager getDefaultManager() { if (defaultManager == null) { defaultManager = new PopulationManager(); } return defaultManager; }
/** * Remove the object given its name. */ public Object removeObject(Object objectToRemove, String objectsName) { removeObject(objectToRemove.getClass(), objectsName); return objectToRemove; }