Package org.sonatype.nexus.proxy.attributes

Examples of org.sonatype.nexus.proxy.attributes.AttributeStorage


      try {

        final RepositoryItemUid uid = item.getRepositoryItemUid();

        final AttributeStorage attributeStorage = repository
            .getAttributesHandler().getAttributeStorage();

        final Attributes attributes = attributeStorage
            .getAttributes(uid);

        attributes.put(ATTR_IS_SAVED, "true");
        attributes.put(ATTR_SAVE_TIME, "" + System.currentTimeMillis());

        attributeStorage.putAttributes(uid, attributes);

      } catch (final Exception e) {

        metricsAttribFailureCount.inc();
        metricsPublishFailureCount.inc();
View Full Code Here


    assertThat("File timestamp did not change, third pass", mdFile.lastModified(), not(equalTo(fileTimestamp)));
    fileTimestamp = mdFile.lastModified();

    // set up last checked timestamp so that nexus should go remote
    final RepositoryItemUid uid = item.getRepositoryItemUid();
    final AttributeStorage storage = uid.getRepository().getAttributesHandler().getAttributeStorage();
    final Attributes attributes = item.getRepositoryItemAttributes();
    attributes.setCheckedRemotely(System.currentTimeMillis() - ((Math.abs(age) + 1) * 60 * 1000));
    storage.putAttributes(uid, attributes);

    // We need to wait a bit to avoid the check that last remote check = current time
    Thread.sleep(500);
    repository.retrieveItem(new ResourceStoreRequest(path, false));
    getLogger().info(
View Full Code Here

      checkInterruption();

      final Repository repo = repoRegistry.getRepository(repoId);

      final AttributeStorage attributeStorage = repo
          .getAttributesHandler().getAttributeStorage();

      final File root = RepoHelp.repoRoot(repo);

      final CarrotListener listener = new CarrotListenerSupport() {

        private int countCleared;
        private int countScanned;
        private final int reportBatch = 1000;

        @Override
        public void onBegin() {

          log.info("##########################################");
          log.info("repo clean init : {}", repoId);

        }

        @Override
        public void onEnd() {

          log.info("repo stats : scanned={} cleared={}",
              countScanned, countCleared);
          log.info("repo clean done : {}", repoId);
          log.info("##########################################");
        }

        @Override
        public void onFile(final File file) {
          try {

            checkInterruption();

            countScanned++;

            if (countScanned % reportBatch == 0) {
              log.info("scanned={}", countScanned);
            }

            final String path = //
            rootFullPath(relativePath(root, file));

            final ResourceStoreRequest request = //
            new ResourceStoreRequest(path);

            request.getRequestContext().put( //
                AccessManager.REQUEST_AUTHORIZED, "true");

            final StorageItem any = repo.retrieveItem(request);

            final boolean isFile = any instanceof StorageFileItem;

            if (!isFile) {
              return;
            }

            final StorageFileItem item = (StorageFileItem) any;

            final RepositoryItemUid uid = item
                .getRepositoryItemUid();

            final Attributes attributes = attributeStorage
                .getAttributes(uid);

            if (attributes.containsKey(ATTR_IS_SAVED)) {

              attributes.remove(ATTR_IS_SAVED);
              attributes.remove(ATTR_SAVE_TIME);

              attributeStorage.putAttributes(uid, attributes);

              countCleared++;

            }
View Full Code Here

      try {

        final RepositoryItemUid uid = item.getRepositoryItemUid();

        final AttributeStorage attributeStorage = repository
            .getAttributesHandler().getAttributeStorage();

        final Attributes attributes = attributeStorage
            .getAttributes(uid);

        attributes.put(ATTR_IS_SAVED, "true");
        attributes.put(ATTR_SAVE_TIME, "" + System.currentTimeMillis());

        attributeStorage.putAttributes(uid, attributes);

      } catch (final Exception e) {

        metricsAttribFailureCount.inc();
        metricsPublishFailureCount.inc();
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.attributes.AttributeStorage

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.