Java Code Examples for org.sonatype.nexus.common.node.NodeAccess#isClustered()

The following examples show how to use org.sonatype.nexus.common.node.NodeAccess#isClustered() . 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: 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 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: 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 4
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 5
Source File: RuntimeCacheManagerProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RuntimeCacheManagerProvider(final Map<String, Provider<CacheManager>> providers,
                                   @Nullable @Named("${nexus.cache.provider}") final String customName,
                                   final NodeAccess nodeAccess)
{
  this.providers = checkNotNull(providers);
  this.name = customName != null ? customName : (nodeAccess.isClustered() ? "hazelcast" : "ehcache");
  checkArgument(!"default".equals(name));
  log.info("Cache-provider: {}", name);
  checkState(providers.containsKey(name), "Missing cache-provider: %s", name);
}
 
Example 6
Source File: DefaultCacheBuilderProvider.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public DefaultCacheBuilderProvider(final Map<String, Provider<CacheBuilder>> providers,
                                   @Nullable @Named("${nexus.cache.provider}") final String customName,
                                   final NodeAccess nodeAccess)
{
  this.providers = checkNotNull(providers);
  this.name = customName != null ? customName : (nodeAccess.isClustered() ? "hazelcast" : "ehcache");
  checkArgument(!"default".equals(name));
  checkState(providers.containsKey(name), "Missing cache-builder: %s", name);
}
 
Example 7
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 8
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 9
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 10
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 11
Source File: HighAvailabilitySupportChecker.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Inject
public HighAvailabilitySupportChecker(final NodeAccess nodeAccess) {
  isNexusClustered = nodeAccess.isClustered();
}