1 5 6 package org.exoplatform.services.jcr.impl.storage.inmemory; 7 8 import java.util.Map ; 9 import java.util.HashMap ; 10 import javax.jcr.Node; 11 import org.exoplatform.services.jcr.impl.core.NodeImpl; 12 13 19 public class WorkspaceContainerRegistry { 20 21 22 private static WorkspaceContainerRegistry instance = null; 23 24 private Map workspaces; 26 private String defaultWorkspace; 27 28 protected WorkspaceContainerRegistry() { 29 30 workspaces = new HashMap (); 31 } 32 33 public static WorkspaceContainerRegistry getInstance() { 34 if (instance == null) { 35 instance = new WorkspaceContainerRegistry (); 36 } 37 return instance; 38 } 39 40 41 public Map getWorkspaceContainer(String name, String rootNodeType) { 42 43 if(workspaces.get(name) == null) 44 initWorkspaceContainer(name, rootNodeType); 45 46 return (Map )workspaces.get(name); 47 } 48 49 private void initWorkspaceContainer(String name, String rootNodeType) { 50 51 Map workspace = new HashMap (); 52 try { 53 workspace.put("/", new NodeImpl("/",rootNodeType)); 54 } catch (Exception e) { 55 } 57 workspaces.put(name, workspace); 58 59 } 62 63 } 64 | Popular Tags |