コード例 #1
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public void deleteArchiveConfig(CallingContext context, String raptureURIString) {
   RaptureURI addressURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   checkParameter(NAME, addressURI.getDocPath());
   TypeArchiveConfigStorage.deleteByAddress(
       addressURI, context.getUser(), "Removed archive config");
 }
コード例 #2
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public List<String> getTags(CallingContext context, String raptureURIString) {
   RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   checkParameter(NAME, internalURI.getDocPath());
   Repository repository = getKernel().getRepo(internalURI.getFullPath()); // $NON-NLS-1$
   return repository.getTags();
 }
コード例 #3
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public void initiateTypeConversion(
     CallingContext context, String raptureURIString, String newConfig, int versionsToKeep) {
   RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   checkParameter(NAME, internalURI.getDocPath());
   tExecutor.runRebuildFor(
       internalURI.getAuthority(), internalURI.getDocPath(), newConfig, versionsToKeep);
 }
コード例 #4
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public void putArchiveConfig(
     CallingContext context, String raptureURIString, TypeArchiveConfig config) {
   RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   checkParameter(NAME, internalURI.getDocPath());
   config.setAuthority(internalURI.getAuthority());
   config.setTypeName(internalURI.getDocPath());
   TypeArchiveConfigStorage.add(config, context.getUser(), "Created type archive config");
 }
コード例 #5
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public void clearRemote(CallingContext context, String raptureURIString) {
   RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   if (internalURI.hasDocPath()) {
     throw RaptureExceptionFactory.create(
         HttpURLConnection.HTTP_BAD_REQUEST,
         apiMessageCatalog.getMessage("NoDocPath", internalURI.toShortString())); // $NON-NLS-1$
   }
   checkParameter(AUTHORITYNAME, internalURI.getAuthority());
   Repository repository = getKernel().getRepo(internalURI.getAuthority()); // $NON-NLS-1$
   repository.clearRemote();
 }
コード例 #6
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
  @Override
  public void pullRemote(CallingContext context, String raptureURIString) {
    RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
    if (internalURI.hasDocPath()) {
      throw RaptureExceptionFactory.create(
          HttpURLConnection.HTTP_BAD_REQUEST,
          apiMessageCatalog.getMessage("NoDocPath", internalURI.toShortString())); // $NON-NLS-1$
    }
    checkParameter(NAME, internalURI.getDocPath());

    log.info(
        Messages.getString("Admin.PullPerspective")
            + Messages.getString("Admin.OnType")
            + internalURI.getDocPath() // $NON-NLS-1$ //$NON-NLS-2$
            + Messages.getString("Admin.InAuthority")
            + internalURI.getAuthority()); // $NON-NLS-1$
    // NOW this is the fun one
    // Here are the steps
    // (1) Look at the local, does it have a remote defined? If
    // so, what is the latest commit known about
    // for that remote?
    // (2) Make a remote call to retrieve the commits up to that commit from
    // the RemoteLink
    // (3) For each commit, look at all of the references, retrieve them
    // from the remote and persist them
    // into the repo.
    // (4) Update the local perspective to point at the latest commit, and
    // update the Remote commit to point at that.

    getKernel().getRepo(internalURI.getFullPath()); // $NON-NLS-1$
  }
コード例 #7
0
  @Override
  public Boolean writeLog(String category, int level, String message, String user) {
    StringBuilder logMessage = new StringBuilder();
    logMessage.append(df.print(DateTime.now()));
    logMessage.append(" ");
    logMessage.append(message);
    logMessage.append("\n");

    String docPath = blobPrefix;
    RaptureURI uri = RaptureURI.builder(Scheme.BLOB, blobUri).docPath(docPath).build();
    Kernel.getBlob()
        .getTrusted()
        .appendToBlobLower(
            ContextFactory.getKernelUser(),
            uri.toString(),
            logMessage.toString().getBytes(),
            "text/plain");
    return true;
  }
コード例 #8
0
  @Override
  public List<AuditLogEntry> getRecentEntries(int count) {
    String docPath = blobPrefix;
    RaptureURI uri = RaptureURI.builder(Scheme.BLOB, blobUri).docPath(docPath).build();
    CallingContext context = ContextFactory.getKernelUser();
    BlobApiImpl blobApi = Kernel.getBlob().getTrusted();

    ArrayList<AuditLogEntry> ret = new ArrayList<AuditLogEntry>();
    BlobContainer content = blobApi.getBlob(context, uri.toString());
    if (content != null) {
      addContentToList(content, ret);
      return (ret.size() > count) ? ret.subList(ret.size() - count, ret.size()) : ret;
    } else {
      // get children blobs, eg. get logs for all steps of a work order
      Map<String, RaptureFolderInfo> childrenMap =
          blobApi.listBlobsByUriPrefix(context, uri.toString(), 1);

      if (childrenMap != null) {
        for (RaptureFolderInfo child : childrenMap.values()) {
          if (child.isFolder()) {
            continue;
          }
          String childUri = uri.getFullPath() + "/" + child.getName();
          content = blobApi.getBlob(context, childUri);
          addContentToList(content, ret, true);
          if (ret.size() >= count) {
            break;
          }
        }
      }
    }
    // sort audit log entries by time
    Collections.sort(
        ret,
        new Comparator<AuditLogEntry>() {
          @Override
          public int compare(AuditLogEntry o1, AuditLogEntry o2) {
            return o1.getWhen().compareTo(o2.getWhen());
          }
        });
    return (ret.size() > count) ? ret.subList(0, count) : ret;
  }
コード例 #9
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
  /** This method is used to setup a link between a local repo and a remote one. The remoteName */
  @Override
  public void setRemote(
      CallingContext context, String raptureURIString, String remote, String remoteURIString) {
    RaptureURI internalURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
    if (internalURI.hasDocPath()) {
      throw RaptureExceptionFactory.create(
          HttpURLConnection.HTTP_BAD_REQUEST,
          apiMessageCatalog.getMessage("NoDocPath", internalURI.toShortString())); // $NON-NLS-1$
    }
    checkParameter(NAME, internalURI.getAuthority());
    checkParameter("Remote", remote); // $NON-NLS-1$
    RaptureURI remoteURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
    if (remoteURI.hasDocPath()) {
      throw RaptureExceptionFactory.create(
          HttpURLConnection.HTTP_BAD_REQUEST,
          apiMessageCatalog.getMessage("NoDocPath", remoteURI.toShortString())); // $NON-NLS-1$
    }
    checkParameter(NAME, remoteURI.getAuthority());

    // This is set in the repo
    Repository repository = getKernel().getRepo(internalURI.getAuthority()); // $NON-NLS-1$
    repository.setRemote(remote, remoteURI.getAuthority());
    Kernel.typeChanged(internalURI);
  }
コード例 #10
0
 @Override
 public void setContext(RaptureURI internalURI) {
   blobPrefix = internalURI.getDocPath();
 }
コード例 #11
0
ファイル: AdminApiImpl.java プロジェクト: zancapture/Rapture
 @Override
 public TypeArchiveConfig getArchiveConfig(CallingContext context, String raptureURIString) {
   RaptureURI addressURI = new RaptureURI(raptureURIString, Scheme.DOCUMENT);
   checkParameter(NAME, addressURI.getDocPath());
   return TypeArchiveConfigStorage.readByAddress(addressURI);
 }