public NexusArtifact searchBySHA1( String sha1 ) throws NexusClientException, NexusConnectionException { Object tempObj = this.getClientHelper().get( "identify/sha1", sha1 ); if ( tempObj != null ) { // type check the object so we can have a meaninful error if needed this.checkType( tempObj, NexusArtifact.class ); return (NexusArtifact) tempObj; } return null; }
public boolean isNexusStarted( boolean blocking ) throws NexusClientException, NexusConnectionException { return blocking ? this.waitforNexusToStart() : this.isNexusStarted(); }
public RepositoryBaseResource createRepository( RepositoryBaseResource repo ) throws NexusConnectionException, NexusClientException { RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse(); repoResponseRequest.setData( repo ); Object tempObj = this.getClientHelper().create( REPO_SERVICE, null, repoResponseRequest ); // Hack around NEXUS-540 if ( tempObj == null ) { return this.getRepository( repo.getId() ); } // type check the object so we can have a meaninful error if needed this.checkType( tempObj, RepositoryResourceResponse.class ); RepositoryResourceResponse repoResponse = (RepositoryResourceResponse) tempObj; return repoResponse.getData(); }
public void restartNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "RESTART" ); }
public boolean isValidRepository( String id ) throws NexusClientException, NexusConnectionException { List<RepositoryListResource> repoList = this.getRepositories(); for ( RepositoryListResource repositoryListResource : repoList ) { if ( repositoryListResource.getId() != null && repositoryListResource.getId().equals( id ) ) { return true; } } return false; }
public static NexusClient getClient() throws NexusClientException, NexusConnectionException { if ( client == null ) { client = new NexusRestClient(); // at this point security should not be turned on, but you never know... client.connect( TestProperties.getString( "nexus.base.url" ), TestContainer.getInstance().getTestContext().getAdminUsername(), TestContainer.getInstance().getTestContext().getAdminPassword() ); } return client; }
public RepositoryBaseResource updateRepository( RepositoryBaseResource repo ) throws NexusConnectionException, NexusClientException { RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse(); repoResponseRequest.setData( repo ); Object tempObj = this.getClientHelper().update( REPO_SERVICE, repo.getId(), repoResponseRequest ); // Hack around NEXUS-540 if ( tempObj == null ) { return this.getRepository( repo.getId() ); } // type check the object so we can have a meaninful error if needed this.checkType( tempObj, RepositoryResourceResponse.class ); RepositoryResourceResponse repoResponse = (RepositoryResourceResponse) tempObj; return repoResponse.getData(); }
public void deleteRepository( String id ) throws NexusConnectionException, NexusClientException { this.getClientHelper().delete( REPO_SERVICE, id ); }
@SuppressWarnings( "unchecked" ) public List<RepositoryListResource> getRepositories() throws NexusConnectionException, NexusClientException { Object tempObj = this.getClientHelper().getList( REPO_SERVICE ); // type check the object so we can have a meaninful error if needed this.checkType( tempObj, RepositoryListResourceResponse.class ); RepositoryListResourceResponse repoResponse = (RepositoryListResourceResponse) tempObj; return repoResponse.getData(); }
public void startNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "START" ); }
public RepositoryBaseResource getRepository( String id ) throws NexusConnectionException, NexusClientException { Object tempObj = this.getClientHelper().get( REPO_SERVICE, id ); // type check the object so we can have a meaninful error if needed this.checkType( tempObj, RepositoryResourceResponse.class ); RepositoryResourceResponse repoResponse = (RepositoryResourceResponse) tempObj; return repoResponse.getData(); }
public void stopNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "STOP" ); }
public boolean isNexusStarted() throws NexusClientException, NexusConnectionException { Object tempObj = this.getClientHelper().get( STATE_SERVICE, (String) null ); // StatusResourceResponse.getData ->StatusResource // type check the object so we can have a meaninful error if needed this.checkType( tempObj, StatusResourceResponse.class ); // everything should be smooth sailing from here. return ( (StatusResourceResponse) tempObj ).getData().getState().endsWith( "STARTED" ); }
Object tempObj = this.getClientHelper().get( "data_index", params ); this.checkType( tempObj, SearchResponse.class ); return ( (SearchResponse) tempObj ).getData();