public WorkspaceCache createExternalWorkspace ( String name , Connectors connectors ) { String [ ] tokens = name . split ( ":" ) ; String sourceName = tokens [ 0 ] ; String workspaceName = tokens [ 1 ] ; this . workspaceNames . add ( workspaceName ) ; refreshRepositoryMetadata ( true ) ; ConcurrentMap < NodeKey , CachedNode > nodeCache = cacheForWorkspace ( ) . asMap ( ) ; ExecutionContext context = context ( ) ; //the name of the external connector is used for source name and workspace name String sourceKey = NodeKey . keyForSourceName ( sourceName ) ; String workspaceKey = NodeKey . keyForWorkspaceName ( workspaceName ) ; //ask external system to determine root identifier. Connector connector = connectors . getConnectorForSourceName ( sourceName ) ; if ( connector == null ) { throw new IllegalArgumentException ( JcrI18n . connectorNotFound . text ( sourceName ) ) ; } FederatedDocumentStore documentStore = new FederatedDocumentStore ( connectors , this . documentStore ( ) . localStore ( ) ) ; String rootId = connector . getRootDocumentId ( ) ; // Compute the root key for this workspace ... NodeKey rootKey = new NodeKey ( sourceKey , workspaceKey , rootId ) ; // We know that this workspace is not the system workspace, so find it ... final WorkspaceCache systemWorkspaceCache = workspaceCachesByName . get ( systemWorkspaceName ) ; WorkspaceCache workspaceCache = new WorkspaceCache ( context , getKey ( ) , workspaceName , systemWorkspaceCache , documentStore , translator , rootKey , nodeCache , changeBus , repositoryEnvironment ( ) ) ; workspaceCachesByName . put ( workspaceName , workspaceCache ) ; return workspace ( workspaceName ) ; }
Creates a new workspace in the repository coupled with external document store .