protected File getTempDirectory() { if (tempDirectory == null) { tempDirectory = nexusConfiguration.getTemporaryDirectory(); } return tempDirectory; }
public RemoteStorageContext getGlobalRemoteStorageContext() { return nexusConfiguration.getGlobalRemoteStorageContext(); }
protected File getWorkingDirectory() { if (workingDirectory == null) { workingDirectory = nexusConfiguration.getWorkingDirectory(INDEXER_WORKING_DIRECTORY_KEY); } return workingDirectory; }
getNexusConfiguration().setRealms(resource.getSecurityRealms()); getNexusConfiguration().getAnonymousPassword()); getNexusConfiguration().setAnonymousAccess(true, anonymousUsername, anonymousPassword); getNexusConfiguration().setAnonymousAccess(false, null, null); getNexusConfiguration().saveConfiguration(); getNexusConfiguration().getGlobalRemoteStorageContext().setRemoteConnectionSettings( getGlobalRemoteConnectionSettings()); getNexusConfiguration().getGlobalRemoteStorageContext().setRemoteProxySettings( getGlobalRemoteProxySettings() );
public void saveConfiguration() throws IOException { nexusConfiguration.saveConfiguration(); }
nexusConfiguration.loadConfiguration( true ); nexusConfiguration.createInternals(); applicationStatusSource.getSystemStatus().setFirstStart( nexusConfiguration.isConfigurationDefaulted() ); applicationStatusSource.getSystemStatus().setInstanceUpgraded( nexusConfiguration.isInstanceUpgraded() ); applicationStatusSource.getSystemStatus().setConfigurationUpgraded( nexusConfiguration.isConfigurationUpgraded() ); final File workDir = nexusConfiguration.getWorkingDirectory(); String workDirPath = null; if(workDir != null)
/** * Externalized Nexus object to DTO's conversion, using current Nexus configuration. * * @param resource */ protected void fillCurrentConfiguration( Request request, GlobalConfigurationResource resource ) { resource.setSecurityEnabled( getNexusConfiguration().isSecurityEnabled() ); resource.setSecurityAnonymousAccessEnabled( getNexusConfiguration().isAnonymousAccessEnabled() ); resource.setSecurityRealms( getNexusConfiguration().getRealms() ); resource.setSecurityAnonymousUsername( getNexusConfiguration().getAnonymousUsername() ); resource.setSecurityAnonymousPassword( PASSWORD_PLACE_HOLDER ); resource.setGlobalConnectionSettings( convert( getGlobalRemoteConnectionSettings() ) ); resource.setGlobalHttpProxySettings( convert( getGlobalHttpProxySettings() ) ); RestApiSettings restApiSettings = convert( getGlobalRestApiSettings() ); if ( restApiSettings != null && StringUtils.isEmpty( restApiSettings.getBaseUrl() ) ) { restApiSettings.setBaseUrl( getContextRoot( request ).getTargetRef().toString() ); } resource.setGlobalRestApiSettings( restApiSettings ); resource.setSmtpSettings( convert( getNexusEmailer() ) ); resource.setErrorReportingSettings( convert( getErrorReportingManager() ) ); resource.setSystemNotificationSettings( convert( notificationManager ) ); }
/** * Externalized Nexus object to DTO's conversion, using current Nexus configuration. */ protected void fillCurrentConfiguration(Request request, GlobalConfigurationResource resource) { resource.setSecurityAnonymousAccessEnabled(getNexusConfiguration().isAnonymousAccessEnabled()); resource.setSecurityRealms(getNexusConfiguration().getRealms()); resource.setSecurityAnonymousUsername(getNexusConfiguration().getAnonymousUsername()); resource.setSecurityAnonymousPassword(PASSWORD_PLACE_HOLDER); resource.setGlobalConnectionSettings(convert(getGlobalRemoteConnectionSettings())); resource.setRemoteProxySettings(convert(getGlobalRemoteProxySettings())); RestApiSettings restApiSettings = convert(getGlobalRestApiSettings()); if (restApiSettings != null && StringUtils.isEmpty(restApiSettings.getBaseUrl())) { restApiSettings.setBaseUrl(getContextRoot(request).getTargetRef().toString()); } resource.setGlobalRestApiSettings(restApiSettings); resource.setSmtpSettings(convert(getNexusEmailer())); resource.setSystemNotificationSettings(convert(notificationManager)); }
public void deleteRepository( String id, boolean force ) throws NoSuchRepositoryException, IOException, ConfigurationException, AccessDeniedException { Repository repository = repositoryRegistry.getRepository( id ); if ( !force && !repository.isUserManaged() ) { throw new AccessDeniedException( "Not allowed to delete non-user-managed repository '" + id + "'." ); } // delete the configuration nexusConfiguration.deleteRepository( id ); }
/** * Returns the requested Nexus configuration. The keys for various configurations should be discovered by querying * * the "/configs" resource first. This resource emits the raw configuration file used by Nexus as response body. * * @param configKey The configuration key for which we want to get the configuration. */ @Override @GET @ResourceMethodSignature(pathParams = {@PathParam("configKey")}, output = String.class) public Object get(Context context, Request request, Response response, Variant variant) throws ResourceException { String key = request.getAttributes().get(GlobalConfigurationPlexusResource.CONFIG_NAME_KEY).toString(); try { NexusStreamResponse result; if (!getNexusConfiguration().getConfigurationFiles().containsKey(key)) { throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "No configuration with key '" + key + "' found!"); } else { result = getNexusConfiguration().getConfigurationAsStreamByKey(key); } // TODO: make this real resource being able to be polled (ETag and last modified support) return new InputStreamRepresentation(MediaType.valueOf(result.getMimeType()), result.getInputStream()); } catch (IOException e) { throw new ResourceException(Status.SERVER_ERROR_INTERNAL, "IOException during configuration retrieval!", e); } }
protected boolean isRecordedEvent(final NexusAuthenticationEvent nae) { // we record everything except anonymous related ones if (StringUtils.equals(nexusConfiguration.getAnonymousUsername(), nae.getClientInfo().getUserid())) { return false; } // if here, we record the event if not similar to previous one return !isSimilarEvent(nae); }
public NexusStreamResponse getConfigurationAsStreamByKey( String key ) throws IOException { return nexusConfiguration.getConfigurationAsStreamByKey( key ); }
getNexusConfiguration().setRealms( resource.getSecurityRealms() ); getNexusConfiguration().setSecurityEnabled( resource.isSecurityEnabled() ); getNexusConfiguration().getAnonymousPassword() ); getNexusConfiguration().setAnonymousAccess( true, anonymousUsername, anonymousPassword ); getNexusConfiguration().setAnonymousAccess( false, null, null ); getNexusConfiguration().saveConfiguration(); getNexusConfiguration().getGlobalRemoteStorageContext().setRemoteConnectionSettings( getGlobalRemoteConnectionSettings() ); getNexusConfiguration().getGlobalRemoteStorageContext().setRemoteProxySettings( getGlobalHttpProxySettings() );
public <T> void removeTask( ScheduledTask<T> task ) { synchronized ( applicationConfiguration ) { List<CScheduledTask> tasks = getCurrentConfiguration( true ); CScheduledTask foundTask = findTask( task.getId(), tasks ); if ( foundTask != null ) { tasks.remove( foundTask ); try { applicationConfiguration.saveConfiguration(); } catch ( IOException e ) { logger.warn( "Could not save task changes!", e ); } } } // TODO: need to also add task to a history file }
@Override public void delete(Context context, Request request, Response response) throws ResourceException { String repoId = this.getRepositoryId(request); try { getNexusConfiguration().deleteRepository(repoId, true); response.setStatus(Status.SUCCESS_NO_CONTENT); } catch (Exception e) { getLogger().warn("Unable to delete repository, id=" + repoId); throw new ResourceException(Status.SERVER_ERROR_INTERNAL, "Unable to delete repository, id=" + repoId); } }
protected boolean isRecordedEvent(final NexusAuthorizationEvent nae) { // we record only authz failures if (nae.isSuccessful()) { return false; } // we record everything except anonymous related ones if (StringUtils.equals(nexusConfiguration.getAnonymousUsername(), nae.getClientInfo().getUserid())) { return false; } // if here, we record the event if not similar to previous one return !isSimilarEvent(nae); }
protected File getTempDirectory() { if ( tempDirectory == null ) { tempDirectory = nexusConfiguration.getTemporaryDirectory(); } return tempDirectory; }
applicationConfiguration.saveConfiguration();
protected File getWorkingDirectory() { if ( workingDirectory == null ) { workingDirectory = nexusConfiguration.getWorkingDirectory( "indexer" ); } return workingDirectory; }
getNexusConfiguration().deleteRepository(repoId);