Tabnine Logo
RepositoryResourceResponse
Code IndexAdd Tabnine to your IDE (free)

How to use
RepositoryResourceResponse
in
org.sonatype.nexus.rest.model

Best Java code snippets using org.sonatype.nexus.rest.model.RepositoryResourceResponse (Showing top 20 results out of 315)

origin: org.sonatype.nexus/nexus-rest-api

@Override
public Object getPayloadInstance()
{
  return new RepositoryResourceResponse();
}
origin: org.sonatype.nexus/nexus-test-harness-launcher

private RepositoryResource getRepository(String repositoryName)
  throws IOException
{
 String serviceURI = "service/local/repositories/" + repositoryName;
 String entityText = RequestFacade.doGetForText(serviceURI);
 RepositoryResourceResponse repository = (RepositoryResourceResponse) xstream.fromXML(entityText);
 return (RepositoryResource) repository.getData();
}
origin: org.sonatype.nexus/nexus-rest-client-java

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();
}
origin: org.sonatype.nexus/nexus-test-harness-base

public Response sendMessage( Method method, RepositoryBaseResource resource, String id )
  throws IOException
{
  XStreamRepresentation representation = new XStreamRepresentation( xstream, "", mediaType );
  String idPart = ( method == Method.POST ) ? "" : "/" + id;
  String serviceURI = "service/local/repositories" + idPart;
  RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse();
  repoResponseRequest.setData( resource );
  // now set the payload
  representation.setPayload( repoResponseRequest );
  LOG.debug( "sendMessage: " + representation.getText() );
  return RequestFacade.sendMessage( serviceURI, method, representation );
}
origin: org.sonatype.nexus/nexus-test-harness-base

public RepositoryResource getResourceFromResponse( Response response )
  throws IOException
{
  String responseString = response.getEntity().getText();
  LOG.debug( " getResourceFromResponse: " + responseString );
  XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
  RepositoryResourceResponse resourceResponse = (RepositoryResourceResponse) representation
    .getPayload( new RepositoryResourceResponse() );
  return (RepositoryResource) resourceResponse.getData();
}
origin: org.sonatype.nexus/nexus-rest-client-java

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();
}
origin: org.sonatype.nexus/nexus-test-harness-launcher

private void saveRepository(RepositoryResource repository, String repositoryName)
  throws IOException
{
 String serviceURI = "service/local/repositories/" + repositoryName;
 RepositoryResourceResponse repositoryResponse = new RepositoryResourceResponse();
 XStreamRepresentation representation = new XStreamRepresentation(xstream, "", MediaType.APPLICATION_XML);
 repositoryResponse.setData(repository);
 representation.setPayload(repositoryResponse);
 RequestFacade.doPutForStatus(serviceURI, representation, isSuccessful());
}
origin: org.sonatype.nexus/nexus-test-harness-launcher

public RepositoryBaseResource getRepositoryBaseResourceFromResponse(Response response)
  throws IOException
{
 String responseString = response.getEntity().getText();
 LOG.debug(" getRepositoryBaseResourceFromResponse: " + responseString);
 XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);
 RepositoryResourceResponse resourceResponse =
   (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());
 return resourceResponse.getData();
}
origin: org.sonatype.nexus.client/nexus-client-core

S doCreate()
{
  final RepositoryResourceResponse request = new RepositoryResourceResponse();
  request.setData( settings() );
  try
  {
    return (S) getNexusClient()
      .serviceResource( uri() )
      .post( RepositoryResourceResponse.class, request )
      .getData();
  }
  catch ( UniformInterfaceException e )
  {
    throw getNexusClient().convert( e );
  }
  catch ( ClientHandlerException e )
  {
    throw getNexusClient().convert( e );
  }
}
origin: org.sonatype.nexus/nexus-test-harness-base

private void saveRepository( RepositoryResource repository, String repositoryName )
  throws IOException
{
  String serviceURI = "service/local/repositories/" + repositoryName;
  RepositoryResourceResponse repositoryResponse = new RepositoryResourceResponse();
  XStreamRepresentation representation = new XStreamRepresentation( xstream, "", MediaType.APPLICATION_XML );
  repositoryResponse.setData( repository );
  representation.setPayload( repositoryResponse );
  Status status = RequestFacade.sendMessage( serviceURI, Method.PUT, representation ).getStatus();
  Assert.assertEquals( Status.SUCCESS_OK.getCode(), status.getCode() );
}
origin: org.sonatype.nexus/nexus-test-utils

public RepositoryBaseResource getRepositoryBaseResourceFromResponse( Response response )
  throws IOException
{
  String responseString = response.getEntity().getText();
  LOG.debug( " getRepositoryBaseResourceFromResponse: " + responseString );
  XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType );
  RepositoryResourceResponse resourceResponse =
    (RepositoryResourceResponse) representation.getPayload( new RepositoryResourceResponse() );
  return resourceResponse.getData();
}
origin: org.sonatype.nexus/nexus-test-harness-base

private RepositoryResource getRepository( String repositoryName )
  throws IOException
{
  String serviceURI = "service/local/repositories/" + repositoryName;
  String responseText = RequestFacade.doGetRequest( serviceURI ).getEntity().getText();
  RepositoryResourceResponse repository = (RepositoryResourceResponse) xstream.fromXML( responseText );
  return (RepositoryResource) repository.getData();
}
origin: org.sonatype.nexus/nexus-rest-api

@Override
public Object getPayloadInstance()
{
  return new RepositoryResourceResponse();
}
origin: org.sonatype.nexus.client/nexus-client-core

S doUpdate()
{
  final RepositoryResourceResponse request = new RepositoryResourceResponse();
  request.setData( settings() );
  try
  {
    return (S) getNexusClient()
      .serviceResource( uri() + "/" + id() )
      .put( RepositoryResourceResponse.class, request )
      .getData();
  }
  catch ( UniformInterfaceException e )
  {
    throw getNexusClient().convert( e );
  }
  catch ( ClientHandlerException e )
  {
    throw getNexusClient().convert( e );
  }
}
origin: org.sonatype.nexus/nexus-test-harness-launcher

/**
 * IMPORTANT: Make sure to release the Response in a finally block when you are done with it.
 */
public Response sendMessage(Method method, RepositoryBaseResource resource, String id)
  throws IOException
{
 if (resource != null && resource.getProviderRole() == null) {
  if ("virtual".equals(resource.getRepoType())) {
   resource.setProviderRole(ShadowRepository.class.getName());
  }
  else {
   resource.setProviderRole(Repository.class.getName());
  }
 }
 XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);
 String idPart = (method == Method.POST) ? "" : "/" + id;
 String serviceURI = SERVICE_PART + idPart;
 RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse();
 repoResponseRequest.setData(resource);
 // now set the payload
 representation.setPayload(repoResponseRequest);
 LOG.debug("sendMessage: " + representation.getText());
 return nexusRestClient.sendMessage(serviceURI, method, representation);
}
origin: org.sonatype.nexus/nexus-test-utils

public RepositoryBaseResource getRepository( String repoId )
  throws IOException
{
  // accepted return codes: OK or redirect
  final String responseText = nexusRestClient.doGetForText( SERVICE_PART + "/" + repoId, not( inError() ) );
  LOG.debug( "responseText: \n" + responseText );
  // this should use call to: getResourceFromResponse
  XStreamRepresentation representation =
    new XStreamRepresentation( XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML );
  RepositoryResourceResponse resourceResponse =
    (RepositoryResourceResponse) representation.getPayload( new RepositoryResourceResponse() );
  return resourceResponse.getData();
}
origin: org.sonatype.nexus/nexus-rest-client-java

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();
}
origin: org.sonatype.nexus/nexus-rest-api

@Override
public Object getPayloadInstance()
{
  return new RepositoryResourceResponse();
}
origin: org.sonatype.nexus/nexus-test-utils

/**
 * IMPORTANT: Make sure to release the Response in a finally block when you are done with it.
 */
public Response sendMessage( Method method, RepositoryBaseResource resource, String id )
  throws IOException
{
  if ( resource != null && resource.getProviderRole() == null )
  {
    if ( "virtual".equals( resource.getRepoType() ) )
    {
      resource.setProviderRole( ShadowRepository.class.getName() );
    }
    else
    {
      resource.setProviderRole( Repository.class.getName() );
    }
  }
  XStreamRepresentation representation = new XStreamRepresentation( xstream, "", mediaType );
  String idPart = ( method == Method.POST ) ? "" : "/" + id;
  String serviceURI = SERVICE_PART + idPart;
  RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse();
  repoResponseRequest.setData( resource );
  // now set the payload
  representation.setPayload( repoResponseRequest );
  LOG.debug( "sendMessage: " + representation.getText() );
  return nexusRestClient.sendMessage( serviceURI, method, representation );
}
origin: org.sonatype.nexus/nexus-test-harness-launcher

public RepositoryBaseResource getRepository(String repoId)
  throws IOException
{
 // accepted return codes: OK or redirect
 final String responseText = RequestFacade.doGetForText(SERVICE_PART + "/" + repoId, not(inError()));
 LOG.debug("responseText: \n" + responseText);
 // this should use call to: getResourceFromResponse
 XStreamRepresentation representation =
   new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);
 RepositoryResourceResponse resourceResponse =
   (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());
 return resourceResponse.getData();
}
org.sonatype.nexus.rest.modelRepositoryResourceResponse

Most used methods

  • <init>
  • getData
    Get null
  • setData
    Set null

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now