public void restartNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "RESTART" ); }
public void deleteRepository( String id ) throws NexusConnectionException, NexusClientException { this.getClientHelper().delete( REPO_SERVICE, id ); }
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; }
/** * Creates a {@link NexusClient} for specified Nexus instance, user and password. * * @param nexus to create client for * @param userName user * @param password password * @return created nexus client. Never null. */ protected NexusClient createNexusClient(final NexusBundle nexus, final String userName, final String password) { return nexusClientFactory.createFor( baseUrlFrom(checkNotNull(nexus).getUrl()), new UsernamePasswordAuthenticationInfo(checkNotNull(userName), checkNotNull(password)) ); }
public String toUrl() { return getProtocol().name().toLowerCase() + "://" + getHost() + ":" + getPort() + getPath(); }
/** * Creates a {@link NexusClient} for specified Nexus instance for anonymous user. * * @param nexus to create client for * @return created nexus client. Never null. */ protected NexusClient createNexusClientForAnonymous(final NexusBundle nexus) { return nexusClientFactory.createFor( baseUrlFrom(nexus.getUrl()) ); }
public String resolvePath( final String path ) { // we need more logic here, but for now will do it ;) return getConnectionInfo().getBaseUrl() + path; }
@Override public final NexusClient createFor( final BaseUrl baseUrl, final AuthenticationInfo authenticationInfo ) { final ConnectionInfo connectionInfo = new ConnectionInfo( baseUrl, authenticationInfo, null ); return createFor( connectionInfo ); }
@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 Object getList( String service ) throws NexusClientException, NexusConnectionException { String url = this.buildUrl( service, "" ); return this.sendMessage( Method.GET, url, (NexusResponse) null ); }
public boolean isNexusStarted( boolean blocking ) throws NexusClientException, NexusConnectionException { return blocking ? this.waitforNexusToStart() : this.isNexusStarted(); }
@Override public String toString() { return toUrl(); }
public void connect( String baseUrl, String username, String password ) { this.clientHelper = new RestClientHelper( baseUrl, username, password ); }
public Object sendMessage( Method method, String url, NexusResponse nexusResponse ) throws NexusConnectionException { XStreamRepresentation representation = new XStreamRepresentation( this.xstream, "", MediaType.APPLICATION_XML ); // now set the payload representation.setPayload( nexusResponse ); return this.sendMessage( method, url, representation ); }
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 startNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "START" ); }
public Object create( String service, String id, NexusResponse nexusResponse ) throws NexusConnectionException { return this.sendMessage( Method.POST, this.buildUrl( service, null ), nexusResponse ); // FIXME: The repositories service doesn't return anything for create, see NEXUS-540 }
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" ); }
public void stopNexus() throws NexusClientException, NexusConnectionException { this.getClientHelper().sendCommand( STATE_SERVICE, "STOP" ); }
public Object update( String service, String id, NexusResponse nexusResponse ) throws NexusConnectionException { return this.sendMessage( Method.PUT, this.buildUrl( service, id ), nexusResponse ); }