org.jboss.dna.connector.store.jpa.util
Class Workspaces

java.lang.Object
  extended by org.jboss.dna.connector.store.jpa.util.Workspaces

@NotThreadSafe
public class Workspaces
extends Object

A manager and cache for WorkspaceEntity objects.


Constructor Summary
Workspaces(javax.persistence.EntityManager manager)
           
 
Method Summary
 WorkspaceEntity create(String workspaceName)
          Create a workspace with the supplied name.
 boolean destroy(String workspaceName)
          Remove the entity representation of the workspace.
 WorkspaceEntity get(String workspaceName, boolean createIfRequired)
          Get the workspace with the supplied name, and optionally create a new one if missing.
 Set<String> getWorkspaceNames()
          Find the set of names for the existing workspaces.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Workspaces

public Workspaces(javax.persistence.EntityManager manager)
Method Detail

create

public WorkspaceEntity create(String workspaceName)
Create a workspace with the supplied name.

Parameters:
workspaceName - the name of the workspace; may not be null
Returns:
the workspace entity, or null if there already was a workspace with the supplied name

get

public WorkspaceEntity get(String workspaceName,
                           boolean createIfRequired)
Get the workspace with the supplied name, and optionally create a new one if missing.

Parameters:
workspaceName - the name of the workspace; never null
createIfRequired - true if the workspace should be created if there is no existing workspace with the supplied name
Returns:
the workspace entity, or null if no workspace existed with the supplied name and createIfRequired was false

getWorkspaceNames

public Set<String> getWorkspaceNames()
Find the set of names for the existing workspaces.

Returns:
the set of names; never null

destroy

public boolean destroy(String workspaceName)
Remove the entity representation of the workspace. This does not remove any other data associated with the workspace other than the WorkspaceEntity record.

Parameters:
workspaceName - the name of the workspace; may not be null
Returns:
true if the workspace record was found and removed, or false if there was no workspace with the supplied name


Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.