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() 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" ); }
@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 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(); }
this.checkType( tempObj, SearchResponse.class ); return ( (SearchResponse) tempObj ).getData();
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 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(); }