Package org.eclipse.orion.server.core.metastore

Examples of org.eclipse.orion.server.core.metastore.MetadataInfo


    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }

    MetadataInfo node = getNode(path, req, resp);
    if (node == null) {
      handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    String key = req.getParameter("key"); //$NON-NLS-1$
    try {
      String prefix = getPrefix(path);

      //if a key is specified get that single value, otherwise get the entire node
      JSONObject result = null;
      if (key != null) {
        prefix = prefix + '/' + key;
        String value = node.getProperty(prefix.toString());
        if (value == null) {
          handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
          return;
        }
        result = new JSONObject().put(key, value);
View Full Code Here


    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }

    MetadataInfo info = getNode(path, req, resp);
    if (info == null) {
      //should not fail on delete when resource doesn't exist
      resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
      return;

    }
    String key = req.getParameter("key");
    try {
      String prefix = getPrefix(path);
      //if a key is specified write that single value, otherwise write the entire node
      boolean changed = false;
      if (key != null) {
        prefix = prefix + '/' + key;
        changed = info.setProperty(prefix.toString(), null) != null;
      } else {
        //can't overwrite base user settings via preference servlet
        if (prefix.startsWith("User")) {
          resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
          return;
View Full Code Here

    IPath path = getPath(req);
    if (path.segmentCount() < 2) {
      handleNotFound(req, resp, HttpServletResponse.SC_METHOD_NOT_ALLOWED);
      return;
    }
    MetadataInfo info = getNode(path, req, resp);
    if (info == null) {
      handleNotFound(req, resp, HttpServletResponse.SC_NOT_FOUND);
      return;
    }

    String key = req.getParameter("key"); //$NON-NLS-1$
    String prefix = getPrefix(path);
    try {
      boolean changed = false;
      if (key != null) {
        prefix = prefix + '/' + key;
        String newValue = req.getParameter("value"); //$NON-NLS-1$
        String oldValue = info.setProperty(prefix.toString(), newValue);
        changed = !newValue.equals(oldValue);
      } else {
        JSONObject newNode = new JSONObject(new JSONTokener(req.getReader()));
        //can't overwrite base user settings via preference servlet
        if (prefix.startsWith("User")) {
          resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
          return;
        }
        //operations should not be removed by PUT
        if (!prefix.equals("operations")) {

          //clear existing values matching prefix
          changed |= removeMatchingProperties(info, prefix.toString());
        }
        for (Iterator<String> it = newNode.keys(); it.hasNext();) {
          key = it.next();
          String newValue = newNode.getString(key);
          String qualifiedKey = prefix + '/' + key;
          String oldValue = info.setProperty(qualifiedKey, newValue);
          changed |= !newValue.equals(oldValue);
        }
      }
      if (changed)
        save(info);
View Full Code Here

TOP

Related Classes of org.eclipse.orion.server.core.metastore.MetadataInfo

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.