protected JcrRepository deploy ( final RepositoryConfiguration repositoryConfiguration , final String repositoryKey ) throws ConfigurationException , RepositoryException { CheckArg . isNotNull ( repositoryConfiguration , "repositoryConfiguration" ) ; checkRunning ( ) ; final String repoName = repositoryKey != null ? repositoryKey : repositoryConfiguration . getName ( ) ; Problems problems = repositoryConfiguration . validate ( ) ; if ( problems . hasErrors ( ) ) { throw new ConfigurationException ( problems , JcrI18n . repositoryConfigurationIsNotValid . text ( repoName , problems . toString ( ) ) ) ; } // Now try to deploy the repository ... JcrRepository repository = null ; final Lock lock = this . lock . writeLock ( ) ; try { lock . lock ( ) ; if ( this . repositories . containsKey ( repoName ) ) { throw new RepositoryException ( JcrI18n . repositoryIsAlreadyDeployed . text ( repoName ) ) ; } // Instantiate (but do not start!) the repository, store it in our map, and return it ... repository = new JcrRepository ( repositoryConfiguration ) ; this . repositories . put ( repoName , repository ) ; } finally { lock . unlock ( ) ; } return repository ; }
Deploy a new repository with the given configuration . This method will fail if this engine already contains a repository with the specified name .