org.sonatype.nexus.common.node.NodeAccess Java Examples

The following examples show how to use org.sonatype.nexus.common.node.NodeAccess. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlobStoreManagerImpl.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public BlobStoreManagerImpl(final EventManager eventManager, //NOSONAR
                            final BlobStoreConfigurationStore store,
                            final Map<String, BlobStoreDescriptor> blobStoreDescriptors,
                            final Map<String, Provider<BlobStore>> blobStorePrototypes,
                            final FreezeService freezeService,
                            final Provider<RepositoryManager> repositoryManagerProvider,
                            final NodeAccess nodeAccess,
                            @Nullable @Named("${nexus.blobstore.provisionDefaults}") final Boolean provisionDefaults)
{
  this.eventManager = checkNotNull(eventManager);
  this.store = checkNotNull(store);
  this.blobStoreDescriptors = checkNotNull(blobStoreDescriptors);
  this.blobStorePrototypes = checkNotNull(blobStorePrototypes);
  this.freezeService = checkNotNull(freezeService);
  this.repositoryManagerProvider = checkNotNull(repositoryManagerProvider);

  if (provisionDefaults != null) {
    // explicit true/false setting, so honour that
    this.provisionDefaults = provisionDefaults::booleanValue;
  }
  else {
    // otherwise only create in non-clustered mode
    this.provisionDefaults = () -> !nodeAccess.isClustered();
  }
}
 
Example #2
Source File: RebuildIndexTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public RebuildIndexTaskDescriptor(final NodeAccess nodeAccess) {
  super(TYPE_ID,
      org.sonatype.nexus.repository.search.index.RebuildIndexTask.class,
      "Repair - Rebuild repository search",
      VISIBLE,
      EXPOSED,
      new RepositoryCombobox(
          REPOSITORY_NAME_FIELD_ID,
          "Repository",
          "Select the repository to rebuild index",
          true
      ).includingAnyOfFacets(SearchFacet.class).includeAnEntryForAllRepositories(),

      nodeAccess.isClustered() ? newMultinodeFormField().withInitialValue(true) : null
  );
}
 
Example #3
Source File: AbstractSecurityTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
protected void customizeModules(List<Module> modules) {
  modules.add(new AbstractModule()
  {
    @Override
    protected void configure() {
      install(new WebSecurityModule(mock(ServletContext.class)));

      bind(SecurityConfigurationSource.class).annotatedWith(Names.named("default")).toInstance(
          new PreconfiguredSecurityConfigurationSource(initialSecurityConfiguration()));

      RealmConfiguration realmConfiguration = new TestRealmConfiguration();
      realmConfiguration.setRealmNames(Arrays.asList("MockRealmA", "MockRealmB"));
      bind(RealmConfiguration.class).annotatedWith(Names.named("initial")).toInstance(realmConfiguration);

      bind(ApplicationDirectories.class).toInstance(mock(ApplicationDirectories.class));
      bind(NodeAccess.class).toInstance(mock(NodeAccess.class));
      bind(AnonymousManager.class).toInstance(mock(AnonymousManager.class));
      bind(EventManager.class).toInstance(getEventManager());

      requestInjection(AbstractSecurityTest.this);
    }
  });
}
 
Example #4
Source File: ReindexNpmRepositoryTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public ReindexNpmRepositoryTaskDescriptor(final NodeAccess nodeAccess) {
  super(TYPE_ID,
      OrientReindexNpmRepositoryTask.class,
      "Repair - Reconcile npm /-/v1/search metadata",
      VISIBLE,
      EXPOSED,
      new RepositoryCombobox(
          REPOSITORY_NAME_FIELD_ID,
          "Repository",
          "Select the npm repository to reconcile",
          true
      ).includingAnyOfFacets(NpmSearchFacet.class).includeAnEntryForAllRepositories(),

      nodeAccess.isClustered() ? newMultinodeFormField().withInitialValue(true) : null
  );
}
 
Example #5
Source File: IndexSyncService.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public IndexSyncService(@Named(COMPONENT) final Provider<DatabaseInstance> componentDatabase,
                        final ComponentEntityAdapter componentEntityAdapter,
                        final AssetEntityAdapter assetEntityAdapter,
                        final ApplicationDirectories directories,
                        final NodeAccess nodeAccess,
                        final IndexRequestProcessor indexRequestProcessor,
                        final IndexRebuildManager indexRebuildManager)
{
  this.componentDatabase = checkNotNull(componentDatabase);
  this.componentEntityAdapter = checkNotNull(componentEntityAdapter);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.indexRequestProcessor = checkNotNull(indexRequestProcessor);
  this.indexRebuildManager = checkNotNull(indexRebuildManager);

  this.entityLog = new EntityLog(componentDatabase, componentEntityAdapter, assetEntityAdapter);
  this.checkpointFile = new File(directories.getWorkDirectory("elasticsearch"), "nexus.lsn");
}
 
Example #6
Source File: FileBlobStore.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public FileBlobStore(final BlobIdLocationResolver blobIdLocationResolver,
                     final FileOperations fileOperations,
                     final ApplicationDirectories applicationDirectories,
                     final FileBlobStoreMetricsStore metricsStore,
                     final NodeAccess nodeAccess,
                     final DryRunPrefix dryRunPrefix)
{
  super(blobIdLocationResolver, dryRunPrefix);
  this.fileOperations = checkNotNull(fileOperations);
  this.applicationDirectories = checkNotNull(applicationDirectories);
  this.metricsStore = checkNotNull(metricsStore);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.supportsHardLinkCopy = true;
  this.supportsAtomicMove = true;
}
 
Example #7
Source File: QuartzSchedulerSPI.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("squid:S00107") //suppress constructor parameter count
@Inject
public QuartzSchedulerSPI(final EventManager eventManager,
                          final NodeAccess nodeAccess,
                          final Provider<JobStore> jobStoreProvider,
                          final Provider<Scheduler> schedulerProvider,
                          final LastShutdownTimeService lastShutdownTimeService,
                          final DatabaseStatusDelayedExecutor delayedExecutor,
                          @Named("${nexus.quartz.recoverInterruptedJobs:-true}") final boolean recoverInterruptedJobs)
{
  this.eventManager = checkNotNull(eventManager);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.jobStoreProvider = checkNotNull(jobStoreProvider);
  this.schedulerProvider = checkNotNull(schedulerProvider);
  this.lastShutdownTimeService = checkNotNull(lastShutdownTimeService);
  this.recoverInterruptedJobs = recoverInterruptedJobs;
  this.delayedExecutor = checkNotNull(delayedExecutor);

  this.scheduleFactory = new QuartzScheduleFactory();
  this.triggerConverter = new QuartzTriggerConverter(this.scheduleFactory);

  // FIXME: sort out with refinement to lifecycle below
  this.active = true;
}
 
Example #8
Source File: DatabaseFreezeServiceImpl.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public DatabaseFreezeServiceImpl(final Set<Provider<DatabaseInstance>> providers,
                                 final EventManager eventManager,
                                 final DatabaseFrozenStateManager databaseFrozenStateManager,
                                 final Provider<OServer> server,
                                 final NodeAccess nodeAccess,
                                 final SecurityHelper securityHelper,
                                 final List<Freezable> freezables)
{
  this.providers = checkNotNull(providers);
  this.eventManager = checkNotNull(eventManager);
  this.databaseFrozenStateManager = checkNotNull(databaseFrozenStateManager);
  checkNotNull(server);
  distributedServerManagerProvider = () -> server.get().getDistributedManager();
  this.nodeAccess = checkNotNull(nodeAccess);
  this.securityHelper = securityHelper;
  this.freezables = checkNotNull(freezables);
}
 
Example #9
Source File: ScriptTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public ScriptTaskDescriptor(final NodeAccess nodeAccess, @Named("${nexus.scripts.allowCreation:-false}") boolean allowCreation) {
  super(TYPE_ID,
      ScriptTask.class,
      messages.name(),
      VISIBLE,
      isExposed(allowCreation),
      new StringTextFormField(
          LANGUAGE,
          messages.languageLabel(),
          messages.languageHelpText(),
          FormField.MANDATORY
      ).withInitialValue(ScriptEngineManagerProvider.DEFAULT_LANGUAGE),
      new TextAreaFormField(
          SOURCE,
          messages.sourceLabel(),
          messages.sourceHelpText(),
          FormField.MANDATORY,
          null,
          !allowCreation
      ),
      nodeAccess.isClustered() ? newMultinodeFormField() : null);
}
 
Example #10
Source File: GoogleCloudBlobStoreMetricsStore.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public GoogleCloudBlobStoreMetricsStore(final PeriodicJobService jobService,
                                        final NodeAccess nodeAccess,
                                        final BlobStoreQuotaService quotaService,
                                        @Named("${nexus.blobstore.quota.warnIntervalSeconds:-60}")
                                        final int quotaCheckInterval)
{
  super(nodeAccess, jobService, quotaService, quotaCheckInterval);
}
 
Example #11
Source File: RebuildAssetUploadMetadataTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RebuildAssetUploadMetadataTaskDescriptor(final NodeAccess nodeAccess,
                                                final RebuildAssetUploadMetadataConfiguration configuration) {
  super(
      TYPE_ID,
      RebuildAssetUploadMetadataTask.class,
      "Repair - Reconcile date metadata from blob store",
      configuration.isEnabled() ? VISIBLE : NOT_VISIBLE,
      configuration.isEnabled() ? EXPOSED : NOT_EXPOSED,
      nodeAccess.isClustered() ? newLimitNodeFormField() : null);
}
 
Example #12
Source File: AssetBlob.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public AssetBlob(final NodeAccess nodeAccess,
                 final BlobStore blobStore,
                 final Function<BlobStore, Blob> blobFunction,
                 final String contentType,
                 final Map<HashAlgorithm, HashCode> hashes,
                 final boolean hashesVerified)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.blobStore = checkNotNull(blobStore);
  this.blobFunction = checkNotNull(blobFunction);
  this.contentType = checkNotNull(contentType);
  this.hashes = checkNotNull(hashes);
  this.hashesVerified = hashesVerified;
}
 
Example #13
Source File: FileBlobStoreMetricsStore.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public FileBlobStoreMetricsStore(final PeriodicJobService jobService,
                                 final NodeAccess nodeAccess,
                                 final BlobStoreQuotaService quotaService,
                                 @Named("${nexus.blobstore.quota.warnIntervalSeconds:-60}")
                                 final int quotaCheckInterval,
                                 final FileOperations fileOperations)
{
  super(nodeAccess, jobService, quotaService, quotaCheckInterval);
  this.fileOperations = checkNotNull(fileOperations);
}
 
Example #14
Source File: FileBlobStore.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@VisibleForTesting
public FileBlobStore(final Path contentDir, //NOSONAR
                     final BlobIdLocationResolver blobIdLocationResolver,
                     final FileOperations fileOperations,
                     final FileBlobStoreMetricsStore metricsStore,
                     final BlobStoreConfiguration configuration,
                     final ApplicationDirectories directories,
                     final NodeAccess nodeAccess,
                     final DryRunPrefix dryRunPrefix)
{
  this(blobIdLocationResolver, fileOperations, directories, metricsStore, nodeAccess, dryRunPrefix);
  this.contentDir = checkNotNull(contentDir);
  this.blobStoreConfiguration = checkNotNull(configuration);
}
 
Example #15
Source File: ContentFacetDependencies.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public ContentFacetDependencies(final BlobStoreManager blobStoreManager,
                                final DataSessionSupplier dataSessionSupplier,
                                final ConstraintViolationFactory constraintViolationFactory,
                                final ClientInfoProvider clientInfoProvider,
                                final NodeAccess nodeAccess,
                                final AssetBlobValidators assetBlobValidators)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.dataSessionSupplier = checkNotNull(dataSessionSupplier);
  this.constraintViolationFactory = checkNotNull(constraintViolationFactory);
  this.clientInfoProvider = checkNotNull(clientInfoProvider);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.assetBlobValidators = checkNotNull(assetBlobValidators);
}
 
Example #16
Source File: DatabaseBackupTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public DatabaseBackupTaskDescriptor(final NodeAccess nodeAccess)
{
  super(TYPE_ID, DatabaseBackupTask.class, messages.name(), VISIBLE, EXPOSED,
      new StringTextFormField(
          BACKUP_LOCATION,
          messages.locationLabel(),
          messages.locationHelpText(),
          MANDATORY
      ),
      nodeAccess.isClustered() ? newLimitNodeFormField() : null
  );
}
 
Example #17
Source File: UpgradeServiceImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public UpgradeServiceImpl(final UpgradeManager upgradeManager,
                          final ModelVersionStore modelVersionStore,
                          final NodeAccess nodeAccess)
{
  this.upgradeManager = checkNotNull(upgradeManager);
  this.modelVersionStore = checkNotNull(modelVersionStore);
  this.nodeAccess = checkNotNull(nodeAccess);
}
 
Example #18
Source File: JobStoreImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public JobStoreImpl(@Named(DatabaseInstanceNames.CONFIG) final Provider<DatabaseInstance> databaseInstance,
                    final JobDetailEntityAdapter jobDetailEntityAdapter,
                    final TriggerEntityAdapter triggerEntityAdapter,
                    final CalendarEntityAdapter calendarEntityAdapter,
                    final NodeAccess nodeAccess,
                    @Named("${nexus.quartz.jobStore.acquireRetryDelay:-15s}") final Time acquireRetryDelay)
{
  this.databaseInstance = checkNotNull(databaseInstance);
  this.jobDetailEntityAdapter = checkNotNull(jobDetailEntityAdapter);
  this.triggerEntityAdapter = checkNotNull(triggerEntityAdapter);
  this.calendarEntityAdapter = checkNotNull(calendarEntityAdapter);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.acquireRetryDelay = acquireRetryDelay;
}
 
Example #19
Source File: QuartzSchedulerProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public QuartzSchedulerProvider(final NodeAccess nodeAccess,
                               final Provider<JobStore> jobStore,
                               final JobFactory jobFactory,
                               @Named("${nexus.quartz.poolSize:-20}") final int threadPoolSize,
                               @Named("${nexus.quartz.taskThreadPriority:-5}") final int threadPriority)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.jobStore = checkNotNull(jobStore);
  this.jobFactory = checkNotNull(jobFactory);
  checkArgument(threadPoolSize > 0, "Invalid thread-pool size: %s", threadPoolSize);
  this.threadPoolSize = threadPoolSize;
  this.threadPriority = threadPriority;
  log.info("Thread-pool size: {}, Thread-pool priority: {}", threadPoolSize, threadPriority);
}
 
Example #20
Source File: JobStoreImplTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  ClassLoadHelper loadHelper = new CascadingClassLoadHelper();

  nodeAccess = mock(NodeAccess.class);

  loadHelper.initialize();
  this.jobStore = createJobStore();
  this.jobStore.start();
  this.jobStore.initialize(loadHelper, new SampleSignaler());
  this.jobStore.schedulerStarted();
}
 
Example #21
Source File: RebuildBrowseNodesTaskDescriptor.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RebuildBrowseNodesTaskDescriptor(final NodeAccess nodeAccess, final GroupType groupType) {
  super(TYPE_ID, RebuildBrowseNodesTask.class, TASK_NAME, VISIBLE, EXPOSED,
      new ItemselectFormField(REPOSITORY_NAME_FIELD_ID, "Repository", "Select the repository(ies) to rebuild browse tree",
          true).withStoreApi("coreui_Repository.readReferencesAddingEntryForAll")
          .withButtons("up", "add", "remove", "down").withFromTitle("Available").withToTitle("Selected")
          .withStoreFilter("type", "!" + groupType.getValue()).withValueAsString(true),
      nodeAccess.isClustered() ? newLimitNodeFormField() : null);
}
 
Example #22
Source File: OrientDeploymentAccessImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public OrientDeploymentAccessImpl(@Named(CONFIG) final Provider<DatabaseInstance> databaseInstance,
                                  final NodeAccess nodeAccess)
{
  this.databaseInstance = checkNotNull(databaseInstance);
  this.entityAdapter = new OrientDeploymentIdentifierEntityAdapter();
  this.nodeAccess = nodeAccess;
}
 
Example #23
Source File: DatabaseServerImpl.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public DatabaseServerImpl(final ApplicationDirectories applicationDirectories,
                          final List<OServerHandlerConfiguration> injectedHandlers,
                          final List<OrientConfigCustomizer> configCustomizers,
                          @Named("nexus-uber") final ClassLoader uberClassLoader,
                          @Named("${nexus.orient.binaryListenerEnabled:-false}") final boolean binaryListenerEnabled,
                          @Named("${nexus.orient.httpListenerEnabled:-false}") final boolean httpListenerEnabled,
                          @Named("${nexus.orient.dynamicPlugins:-false}") final boolean dynamicPlugins,
                          @Named("${nexus.orient.binaryListener.portRange:-2424-2430}") final String binaryPortRange,
                          @Named("${nexus.orient.httpListener.portRange:-2480-2490}") final String httpPortRange,
                          final NodeAccess nodeAccess,
                          final EntityHook entityHook)
{
  this.applicationDirectories = checkNotNull(applicationDirectories);
  this.injectedHandlers = checkNotNull(injectedHandlers);
  this.configCustomizers = checkNotNull(configCustomizers);
  this.uberClassLoader = checkNotNull(uberClassLoader);
  this.httpListenerEnabled = httpListenerEnabled;
  this.dynamicPlugins = dynamicPlugins;
  this.binaryPortRange = binaryPortRange;
  this.httpPortRange = httpPortRange;
  this.entityHook = checkNotNull(entityHook);

  if (nodeAccess.isClustered()) {
    this.binaryListenerEnabled = true; // clustered mode requires binary listener
  }
  else {
    this.binaryListenerEnabled = binaryListenerEnabled;
  }

  databasesDir = applicationDirectories.getWorkDirectory("db");

  log.info("OrientDB version: {}", OConstants.getVersion());
}
 
Example #24
Source File: StateComponent.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public StateComponent(final List<Provider<StateContributor>> stateContributors, final NodeAccess nodeAccess) {
  this.stateContributors = checkNotNull(stateContributors);
  // special key on serverId hints UI event listeners to ignore serverId changes
  final String prefix = checkNotNull(nodeAccess).isClustered() ? "ignore." : "";
  this.serverId = prefix + String.valueOf(System.nanoTime());
}
 
Example #25
Source File: BlobStoreMetricsStoreSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public BlobStoreMetricsStoreSupport(final NodeAccess nodeAccess,
                                    final PeriodicJobService jobService,
                                    final BlobStoreQuotaService quotaService,
                                    final int quotaCheckInterval)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.jobService = checkNotNull(jobService);
  this.quotaService = checkNotNull(quotaService);
  checkArgument(quotaCheckInterval > 0);
  this.quotaCheckInterval = quotaCheckInterval;
}
 
Example #26
Source File: OrientPyPiRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public OrientPyPiRestoreBlobStrategy(final NodeAccess nodeAccess,
                                     final RepositoryManager repositoryManager,
                                     final BlobStoreManager blobStoreManager,
                                     final DryRunPrefix dryRunPrefix,
                                     final OrientPyPiRepairIndexComponent pyPiRepairIndexComponent,
                                     final PyPiRestoreBlobDataFactory pyPiRestoreBlobDataFactory)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.pyPiRepairIndexComponent = pyPiRepairIndexComponent;
  this.pyPiRestoreBlobDataFactory = pyPiRestoreBlobDataFactory;
}
 
Example #27
Source File: P2RestoreBlobStrategy.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public P2RestoreBlobStrategy(final NodeAccess nodeAccess,
                             final RepositoryManager repositoryManager,
                             final BlobStoreManager blobStoreManager,
                             final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #28
Source File: HelmRestoreBlobStrategy.java    From nexus-repository-helm with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public HelmRestoreBlobStrategy(final NodeAccess nodeAccess,
                               final RepositoryManager repositoryManager,
                               final BlobStoreManager blobStoreManager,
                               final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #29
Source File: RRestoreBlobStrategy.java    From nexus-repository-r with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RRestoreBlobStrategy(final NodeAccess nodeAccess,
                            final RepositoryManager repositoryManager,
                            final BlobStoreManager blobStoreManager,
                            final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #30
Source File: AptRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public AptRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}