/** * Helper to build and encode a remote store call * * @param method Remote store method name * @param documentPath Document path to encode * * @return encoded URL to execute */ private String buildEncodeCall(String method, String documentPath) { return buildEncodeCall(method, documentPath, null); }
/** * Helper to build and encode a remote store call * * @param method Remote store method name * @param documentPath Document path to encode * * @return encoded URL to execute */ private String buildEncodeCall(String method, String documentPath) { return buildEncodeCall(method, documentPath, null); }
/** * Helper to build and encode a remote store call * * @param method Remote store method name * @param documentPath Document path to encode * * @return encoded URL to execute */ private String buildEncodeCall(String method, String documentPath) { return buildEncodeCall(method, documentPath, null); }
public boolean removeDocument(String documentPath) throws IOException { Response res = callDelete(buildEncodeCall(API_DELETE, documentPath)); boolean removed = (Status.STATUS_OK == res.getStatus().getCode()); if (logger.isDebugEnabled()) logger.debug("RemoteStore.removeDocument() " + documentPath + " = " + res.getStatus().getCode() + " (removed = "+removed+")"); return removed; }
public boolean removeDocument(String documentPath) throws IOException { Response res = callDelete(buildEncodeCall(API_DELETE, documentPath)); boolean removed = (Status.STATUS_OK == res.getStatus().getCode()); if (logger.isDebugEnabled()) logger.debug("RemoteStore.removeDocument() " + documentPath + " = " + res.getStatus().getCode() + " (removed = "+removed+")"); return removed; }
public boolean removeDocument(String documentPath) throws IOException { Response res = callDelete(buildEncodeCall(API_DELETE, documentPath)); boolean removed = (Status.STATUS_OK == res.getStatus().getCode()); if (logger.isDebugEnabled()) logger.debug("RemoteStore.removeDocument() " + documentPath + " = " + res.getStatus().getCode() + " (removed = "+removed+")"); return removed; }
public String[] getAllDocumentPaths() { Response res = callGet(buildEncodeCall(API_LISTALL, "")); if (logger.isDebugEnabled()) logger.debug("RemoteStore.getAllDocumentPaths() " + res.getStatus().getCode()); if (Status.STATUS_OK == res.getStatus().getCode()) { // convert to an array of store root-relative paths List<String> list = new ArrayList<String>(128); StringTokenizer t = new StringTokenizer(res.getResponse(), "\n"); while (t.hasMoreTokens()) { list.add(t.nextToken()); } String[] paths = list.toArray(new String[list.size()]); // truncate paths so that they are relative to the store path // and invariant of the type of AVM store (WCM or plain) convertToRelativePaths(paths); return paths; } else { return new String[0]; } }
public void createDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_CREATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.createDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to create document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public void updateDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_UPDATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.updateDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to update document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public void updateDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_UPDATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.updateDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to update document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public void createDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_CREATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.createDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to create document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public void updateDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_UPDATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.updateDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to update document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public void createDocument(String documentPath, String content) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(content.getBytes("UTF-8")); Response res = callPost(buildEncodeCall(API_CREATE, documentPath), in); if (logger.isDebugEnabled()) logger.debug("RemoteStore.createDocument() " + documentPath + " = " + res.getStatus().getCode()); if (Status.STATUS_OK != res.getStatus().getCode()) { throw new IOException("Unable to create document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public long lastModified(String documentPath) throws IOException { Response res = callGet(buildEncodeCall(API_LASTMODIFIED, documentPath)); if (Status.STATUS_OK == res.getStatus().getCode()) { try { long lastMod = Long.parseLong(res.getResponse()); if (logger.isDebugEnabled()) logger.debug("RemoteStore.lastModified() " + documentPath + " = " + lastMod); return lastMod; } catch (NumberFormatException ne) { throw new IOException("Failed to process lastModified response: " + ne.getMessage()); } } else { throw new IOException("Unable to get lastModified date of document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
public boolean hasDocument(String documentPath) throws IOException { boolean hasDocument = false; Response res = callGet(buildEncodeCall(API_HAS, documentPath)); if (Status.STATUS_OK == res.getStatus().getCode()) { hasDocument = Boolean.parseBoolean(res.getResponse()); } else { throw new IOException("Unable to test document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } if (logger.isDebugEnabled()) logger.debug("RemoteStore.hasDocument() " + documentPath + " = " + hasDocument); return hasDocument; }
public boolean hasDocument(String documentPath) throws IOException { boolean hasDocument = false; Response res = callGet(buildEncodeCall(API_HAS, documentPath)); if (Status.STATUS_OK == res.getStatus().getCode()) { hasDocument = Boolean.parseBoolean(res.getResponse()); } else { throw new IOException("Unable to test document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } if (logger.isDebugEnabled()) logger.debug("RemoteStore.hasDocument() " + documentPath + " = " + hasDocument); return hasDocument; }
public boolean hasDocument(String documentPath) throws IOException { boolean hasDocument = false; Response res = callGet(buildEncodeCall(API_HAS, documentPath)); if (Status.STATUS_OK == res.getStatus().getCode()) { hasDocument = Boolean.parseBoolean(res.getResponse()); } else { throw new IOException("Unable to test document path: " + documentPath + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } if (logger.isDebugEnabled()) logger.debug("RemoteStore.hasDocument() " + documentPath + " = " + hasDocument); return hasDocument; }
private Response getDocumentResponse(String path) throws IOException { Response res = callGet(buildEncodeCall(API_GET, path)); if (logger.isDebugEnabled()) logger.debug("RemoteStore.getDocument() " + path + " = " + res.getStatus().getCode()); if (Status.STATUS_OK == res.getStatus().getCode()) { return res; } else { throw new IOException("Unable to retrieve document path: " + path + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
private Response getDocumentResponse(String path) throws IOException { Response res = callGet(buildEncodeCall(API_GET, path)); if (logger.isDebugEnabled()) logger.debug("RemoteStore.getDocument() " + path + " = " + res.getStatus().getCode()); if (Status.STATUS_OK == res.getStatus().getCode()) { return res; } else { throw new IOException("Unable to retrieve document path: " + path + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }
private Response getDocumentResponse(String path) throws IOException { Response res = callGet(buildEncodeCall(API_GET, path)); if (logger.isDebugEnabled()) logger.debug("RemoteStore.getDocument() " + path + " = " + res.getStatus().getCode()); if (Status.STATUS_OK == res.getStatus().getCode()) { return res; } else { throw new IOException("Unable to retrieve document path: " + path + " in remote store: " + this.getEndpoint() + " due to error: " + res.getStatus().getCode() + " " + res.getStatus().getMessage()); } }