com.nurelm.nucontent.model
Class NuSiteManager

java.lang.Object
  extended bycom.nurelm.nucontent.model.NuSiteManager

public class NuSiteManager
extends java.lang.Object

The NuSiteManager is a top level utility object that lets NuAPI users get Site objects. Note on Persistence Managers (PM): The JDO rule is that the PM cannot outlive persistent classes (pcs). In NuContent, we use a filter to create and destroy this object, putting it into each request. This saves the programmer from worrying about it, allows us to make sure it gets closed.


Constructor Summary
NuSiteManager(java.lang.String siteId)
          Sets the site variable.
 
Method Summary
 void close()
          The method MUST be called when the NuSiteManager object is no longer needed.
 Site getSite()
          Provides access to the current Site object.
 java.util.Collection getSites()
          Gets all the sites in the current database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NuSiteManager

public NuSiteManager(java.lang.String siteId)
Sets the site variable. Creates a new site if needed. Obtains a PersistenceManager, but does NOT close it! Therefore, the close() method must be called when the NuSiteManager is no longer needed. If you do not close it, database connections will be left hanging, causing serious performance issues.

Parameters:
siteId - The id of the Site to be retrieved.
Method Detail

getSite

public Site getSite()
Provides access to the current Site object.

Returns:
The current Site object.

getSites

public java.util.Collection getSites()
Gets all the sites in the current database.

Returns:
The specified Site object.

close

public void close()
The method MUST be called when the NuSiteManager object is no longer needed. Transactions should not be active when this method is called. If so, they are rolled back.