Package org.sonatype.nexus.capability

Examples of org.sonatype.nexus.capability.CapabilityReference


  @Override
  public CapabilityReference enable(final String id, final boolean enabled)
      throws Exception
  {
    final CapabilityReference reference = get(id);
    if (reference == null) {
      return capabilityRegistry.add(
          SMTPCapabilityDescriptor.TYPE,
          enabled,
          null, // automatically generated notes
          null  // no configuration
      );
    }
    else {
      return capabilityRegistry.update(
          reference.context().id(),
          enabled,
          reference.context().notes(),
          reference.context().properties()
      );
    }
  }
View Full Code Here


  @Override
  public CapabilityReference enable(final String id, final boolean enabled)
      throws Exception
  {
    final CapabilityReference reference = get(id);
    if (reference == null) {
      return capabilityRegistry.add(
          RepositoryCapabilityDescriptor.TYPE,
          enabled,
          null,
          new RepositoryCapabilityConfiguration().withRepositoryId(id).asMap()
      );
    }
    else {
      return capabilityRegistry.update(
          reference.context().id(),
          enabled,
          reference.context().notes(),
          reference.context().properties()
      );
    }
  }
View Full Code Here

                             final @PathParam("id") String id)
      throws Exception
  {
    try {
      lock.readLock().lock();
      final CapabilityReference reference = getManager(type).get(id);
      return new TrustStoreKeyXO().withEnabled(
          reference != null && reference.context().isEnabled()
      );
    }
    finally {
      lock.readLock().unlock();
    }
View Full Code Here

      throw new ResourceException(
          CLIENT_ERROR_NOT_FOUND, "Could not find Yum repository with id '" + repositoryId + "'"
      );
    }

    final CapabilityReference capabilityReference = capabilities.iterator().next();
    final GenerateMetadataCapabilityConfiguration configuration =
        capabilityReference.capabilityAs(GenerateMetadataCapability.class).getConfig();

    final String version = payload.toString();

    final Map<String, String> newAliases = Maps.newHashMap();
    newAliases.putAll(configuration.aliases());
    newAliases.put(alias, version);

    final GenerateMetadataCapabilityConfiguration newConfiguration =
        new GenerateMetadataCapabilityConfiguration(
            configuration.repository(),
            newAliases,
            configuration.shouldProcessDeletes(),
            configuration.deleteProcessingDelay(),
            configuration.getYumGroupsDefinitionFile()
        );

    try {
      capabilityRegistry.update(
          capabilityReference.context().id(),
          capabilityReference.context().isEnabled(),
          capabilityReference.context().notes(),
          newConfiguration.asMap()
      );
    }
    catch (CapabilityNotFoundException e) {
      throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage());
View Full Code Here

  @Override
  public CapabilityReference enable(final String id, final boolean enabled)
      throws Exception
  {
    CapabilityReference reference = get(id);
    if (reference == null) {
      reference = capabilityRegistry.add(
          LdapCapabilityDescriptor.TYPE,
          enabled,
          null,
          new LdapCapabilityConfiguration().withLdapServerId(id).asMap()
      );
    }
    else {
      reference = capabilityRegistry.update(
          reference.context().id(),
          enabled,
          reference.context().notes(),
          reference.context().properties()
      );
    }

    try {
      ldapConfigurationManager.clearCache();
View Full Code Here

   */
  @Test
  public void create()
      throws Exception
  {
    final CapabilityReference reference = underTest.add(CAPABILITY_TYPE, true, null, null);
    assertThat(reference, is(not(nullValue())));

    verify(eventBus, atLeastOnce()).post(rec.capture());
    assertThat(rec.getValue(), is(instanceOf(CapabilityEvent.Created.class)));
    assertThat(rec.getValue().getReference(), is(equalTo(reference)));
View Full Code Here

   */
  @Test
  public void remove()
      throws Exception
  {
    final CapabilityReference reference = underTest.add(CAPABILITY_TYPE, true, null, null);
    final CapabilityReference reference1 = underTest.remove(reference.context().id());

    assertThat(reference1, is(equalTo(reference)));

    verify(eventBus, atLeastOnce()).post(rec.capture());
    assertThat(rec.getAllValues().get(0), is(instanceOf(CapabilityEvent.Created.class)));
View Full Code Here

   */
  @Test
  public void get()
      throws Exception
  {
    final CapabilityReference reference = underTest.add(CAPABILITY_TYPE, true, null, null);
    final CapabilityReference reference1 = underTest.get(reference.context().id());

    assertThat(reference1, is(not(nullValue())));
  }
View Full Code Here

  @Test
  public void getInexistent()
      throws Exception
  {
    underTest.add(CAPABILITY_TYPE, true, null, null);
    final CapabilityReference reference = underTest.get(capabilityIdentity("foo"));

    assertThat(reference, is(nullValue()));
  }
View Full Code Here

                                    final boolean enabled,
                                    final String notes,
                                    final Map<String, String> properties)
      throws Exception
  {
    CapabilityReference reference = findCapability(capabilityRegistry, type);
    if (reference == null) {
      log.debug("Automatically adding capability type: {}; enabled: {}", type, enabled);
      addCapability(capabilityRegistry, type, enabled, notes, properties);
    }
  }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.capability.CapabilityReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.