Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TemplateSet templateSet =
- getNexus().getRepositoryTemplates().getTemplates( P2ContentClass.class );
- TemplateSet templateSet1 = templateSet.getTemplates( P2ProxyRepository.class );
- RepositoryTemplate template = (RepositoryTemplate) templateSet1.pick();
- try
- {
- ConfigurableRepository configurableRepository = template.getConfigurableRepository();
- CRepository repo =
- ( (CRepositoryCoreConfiguration) configurableRepository.getCurrentCoreConfiguration() ).getConfiguration( true );
- repo.setId( uri2RepositoryId( artifactRepositoryURI ) );
- repo.setName( artifactRepository.getAttribute( "name" ) );
- repo.setProviderRole( Repository.class.getName() );
- repo.setProviderHint( P2ProxyRepository.ROLE_HINT );
- repo.setRemoteStorage( new CRemoteStorage() );
- repo.getRemoteStorage().setProvider( CommonsHttpClientRemoteStorage.PROVIDER_STRING );
- repo.getRemoteStorage().setUrl( artifactRepositoryURI );
- template.create();
- }
- catch ( ConfigurationException e )
- {
- throw new StorageException( "Could not create p2 proxy repository for "
- + artifactRepositoryURI, e );
- }
Add Comment
Please, Sign In to add comment