@VisibleForTesting Object renderStorageLinkItem( final Context context, final Request req, final Response res, final Variant variant, final ResourceStore store, final StorageLinkItem item ) throws ResourceException { // we have a link, dereference it // TODO: we should be able to do HTTP redirects too! (parametrize the dereferencing?) try { return renderItem( context, req, res, variant, store, getNexus().dereferenceLinkItem( item ) ); } catch ( Exception e ) { handleException( req, res, e ); return null; } }
if ( !getNexus().getConfigurationFiles().containsKey( key ) ) result = getNexus().getConfigurationAsStreamByKey( key );
@Override protected ResourceStore getResourceStore( final Request request ) throws NoSuchRepositoryException, ResourceException { return getNexus().getRootRouter(); } }
result = getNexus().setState( SystemState.STARTED ); result = getNexus().setState( SystemState.STOPPED ); if ( SystemState.STARTED.equals( getNexus().getSystemStatus().getState() ) ) getNexus().setState( SystemState.STOPPED ); result = getNexus().setState( SystemState.STARTED ); if ( SystemState.STARTED.equals( getNexus().getSystemStatus().getState() ) ) getNexus().setState( SystemState.STOPPED );
public Representation getRepresentation( final Status status, final Request request, final Response response ) { final HashMap<String, Object> dataModel = new HashMap<String, Object>(); dataModel.put( "request", request ); dataModel.put( "nexusVersion", nexus.getSystemStatus().getVersion() ); dataModel.put( "nexusRoot", referenceFactory.getContextRoot( request ).toString() ); dataModel.put( "statusCode", status.getCode() ); dataModel.put( "statusName", status.getName() ); dataModel.put( "errorDescription", StringEscapeUtils.escapeHtml( status.getDescription() ) ); if ( null != status.getThrowable() ) { dataModel.put( "errorStackTrace", StringEscapeUtils.escapeHtml( ExceptionUtils.getStackTrace( status.getThrowable() ) ) ); } // Load up the template, and pass in the data VelocityRepresentation representation = new VelocityRepresentation( Context.getCurrent(), "/templates/errorPageContentHtml.vm", dataModel, MediaType.TEXT_HTML ); return representation; } }
TemplateSet templateSet = getNexus().getRepositoryTemplates();
getNexus().deleteRepository( getGroupId( request ) );
/** * Get the list of configuration files in Nexus. */ @Override @GET @ResourceMethodSignature( output = ConfigurationsListResourceResponse.class ) public Object get( Context context, Request request, Response response, Variant variant ) throws ResourceException { ConfigurationsListResourceResponse result = new ConfigurationsListResourceResponse(); Map<String, String> configFileNames = getNexus().getConfigurationFiles(); for ( Map.Entry<String, String> entry : configFileNames.entrySet()) { ConfigurationsListResource resource = new ConfigurationsListResource(); resource.setResourceURI( createChildReference( request, this, entry.getKey() ).toString() ); resource.setName( entry.getValue() ); result.addData( resource ); } return result; } }
new PomArtifactManager( getNexus().getNexusConfiguration().getTemporaryDirectory() );
RepositoryTemplate template = getNexus().getRepositoryTemplateById( getRepositoryId( request ) );
protected Representation serialize( Context context, Request req, Variant variant, Object payload ) throws IOException { // TEXT_HTML is requested by direct browsing (IE) // APPLICATION_XML is requested by direct browsing (FF) if ( MediaType.TEXT_HTML.equals( variant.getMediaType() ) ) { HashMap<String, Object> dataModel = new HashMap<String, Object>(); dataModel.put( "listItems", sortContentListResource( ( (ContentListResourceResponse) payload ).getData() ) ); dataModel.put( "request", req ); dataModel.put( "nexusVersion", getNexus().getSystemStatus().getVersion() ); dataModel.put( "nexusRoot", getContextRoot( req ).toString() ); // Load up the template, and pass in the data VelocityRepresentation representation = new VelocityRepresentation( context, "/templates/repositoryContentHtml.vm", dataModel, variant.getMediaType() ); return representation; } return null; }
TemplateSet repoTemplates = getNexus().getRepositoryTemplates();
try getNexus().deleteRepository( repoId );
templatingContext.put( "nexusVersion", nexus.getSystemStatus().getVersion() ); templatingContext.put( "appName", nexus.getSystemStatus().getAppName() ); templatingContext.put( "formattedAppName", nexus.getSystemStatus().getFormattedAppName() );
(RepositoryTemplate) getNexus().getRepositoryTemplates().getTemplates( GroupRepository.class, contentClass ).pick();
throws ResourceException SystemStatus status = this.nexus.getSystemStatus();