Package org.apache.oodt.cas.curation.policymgr

Examples of org.apache.oodt.cas.curation.policymgr.CurationPolicyManager


    if (root == null) {
      root = "/";
    }
    PrintWriter out = res.getWriter();

    CurationPolicyManager pm = new CurationPolicyManager();
    out.println(pm.getMetFileAsJSON(basePath, req.getParameter("file")));
    return;
  }
View Full Code Here


    if (root == null) {
      root = "/";
    }
    PrintWriter out = res.getWriter();

    CurationPolicyManager pm = new CurationPolicyManager();
    out.println(pm.getDirectoryAreaAsJSON(basePath, root, showFiles));
    return;
  }
View Full Code Here

      res.sendRedirect("/login.jsp?from=" + req.getRequestURL());
      return;
    }

    PrintWriter out = res.getWriter();
    CurationPolicyManager pm = new CurationPolicyManager(this.policyDirPath, this.stagingAreaPath);
    out.println(pm.getExistingPoliciesAsHTML());

    return;
  }
View Full Code Here

    if (policy == null) {
      out.println("");
      return;
    }

    CurationPolicyManager pm = new CurationPolicyManager(this.policyDirPath, this.stagingAreaPath);
    out.println(pm.getDatasetsByPolicyAsJSON(policy));

    return;
  }
View Full Code Here

    String step = req.getParameter("step");
    String policyName = req.getParameter("dsCollection");
    String productTypeName = req.getParameter("ds");

    // instantiate product type object
    CurationPolicyManager cpm = new CurationPolicyManager(this.policyDirPath,
        this.stagingAreaPath);
    Map<String, ProductType> types = cpm.getProductTypes(policyName);

    // get metadata hash table
    ProductType cpt = types.get(productTypeName);

    // get all submitted form values
    Enumeration formKeys = req.getParameterNames();

    // update metadata value from POST form
    String keyName;
    while (formKeys.hasMoreElements()) {
      String keyField = (String) formKeys.nextElement();

      // extract the metadata id from the form field
      String[] tokens = keyField.split("_");
      if (tokens.length == 2 && cpt.getTypeMetadata().containsKey(tokens[1])) {
        keyName = tokens[1];
        // get the submitted values for that key
        String[] formValues = req.getParameterValues(keyField);

        // save new value
        // PubMedID requires HTML entity encoding because
        // of hyperlinks in the metadata field.
        // TODO: create an external XML file that contains key names
        // TODO: like PubMedID that indicate whether or not the value of the key
        // TODO: should be HTML encoded

        if (keyName.equals("PubMedID")) {
          cpt.getTypeMetadata().replaceMetadata(keyName,
              StringEscapeUtils.escapeHtml(formValues[0]));
        } else
          cpt.getTypeMetadata().replaceMetadata(keyName, formValues[0]);
      }
    }

    // build policy file path
    String policyDirectory = PathUtils.replaceEnvVariables(this
        .getServletContext().getInitParameter(POLICY_UPLOAD_PATH));
    String policyPath = policyDirectory;
    String policyFile = policyPath + "/" + policyName + "/product-types.xml";
    LOG.log(Level.INFO, "updating CAS policy at: [" + policyFile + "]");

    // serialize all CasProductType instances from metaDataItems hashtable
    try {
      CurationXmlStructFactory.writeProductTypeXmlDocument(cpm
          .typesToList(types), policyFile);
    } catch (Exception e) {
      throw new ServletException(
          "error writing product type xml document! Message: " + e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.curation.policymgr.CurationPolicyManager

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.