@Override public Iterable<String> list(String path) { throw new VisalloException("Unsupported operation"); } }
public static JSONObject parse(String jsonString) { try { return new JSONObject(jsonString); } catch (JSONException ex) { throw new VisalloJsonParseException(jsonString, ex); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { throw new VisalloException("Not supported"); }
@Override protected int run() throws Exception { throw new VisalloException("This run should not be called."); }
protected WorkProductService getWorkProductServiceByKind(String kind) { throw new VisalloException("unhandled getWorkProductServiceByKind: " + kind); }
@Override public <T> T run(Callable<T> callable) { try { synchronized (synchronizationObject) { return callable.call(); } } catch (Exception ex) { throw new VisalloException("Failed to run in lock", ex); } } };
public static <T> T inject(T o) { if (injector == null) { throw new VisalloException("Could not find injector"); } injector.injectMembers(o); return o; }
@Override public Relationship getRequiredRelationshipByIntent(String intent, String workspaceId) { Relationship relationship = getRelationshipByIntent(intent, workspaceId); if (relationship == null) { throw new VisalloException("Could not find relationship by intent: " + intent); } return relationship; }
@Override public <T extends VisalloProperty> T getRequiredVisalloPropertyByIntent(String intent, Class<T> visalloPropertyType, String workspaceId) { T result = getVisalloPropertyByIntent(intent, visalloPropertyType, workspaceId); if (result == null) { throw new VisalloException("Could not find property by intent: " + intent); } return result; }
@Override public OntologyProperty getRequiredPropertyByIRI(String propertyIRI, String workspaceId) { OntologyProperty property = getPropertyByIRI(propertyIRI, workspaceId); if (property == null) { throw new VisalloException("Could not find property by IRI: " + propertyIRI); } return property; }
@Override public int run(UserAdmin userAdmin, String action, Args args, User authUser) { switch (action) { case ACTION_SET_AUTHORIZATIONS: return cliRunSetAuthorizations(userAdmin, (SetAuthorizationsCliArguments) args, authUser); } throw new VisalloException("Unhandled cli action " + action); }
public <T> T getRequiredParameter(String parameterName, Class<T> resultType) { T obj = getOptionalParameter(parameterName, resultType); if (obj == null) { throw new VisalloException("Missing parameter: " + parameterName); } return obj; } }
@Override public int run(UserAdmin userAdmin, String action, Args args, User authUser) { switch (action) { case ACTION_SET_PRIVILEGES: return cliRunSetPrivileges(userAdmin, (SetPrivilegesCliArguments) args, authUser); } throw new VisalloException("Unhandled cli action " + action); }
private InputStream openInputStream() { try { return fileSystemRepository.getInputStream(relativePath); } catch (Exception ex) { throw new VisalloException("Could not open input stream for file: " + relativePath); } } }
protected PropertyAddition<byte[]> addByteArrayProperty(String iri, String key, Object value, String visibility) { byte[] byteArrayValue = null; if (value != null) { if (value instanceof byte[]) { byteArrayValue = (byte[]) value; } else { throw new VisalloException("Unable to assign value " + value + " as byte[]"); } } return addTo(iri, key, byteArrayValue, visibility); }
@Override public OntologyProperty getRequiredPropertyByIntent(String intent, String workspaceId) { OntologyProperty property = getPropertyByIntent(intent, workspaceId); if (property == null) { throw new VisalloException("Could not find property by intent: " + intent); } return property; }
public static String getRequiredParameter(final HttpServletRequest request, final String parameterName) { String result = getOptionalParameter(request, parameterName); if (result == null) { throw new VisalloException("parameter " + parameterName + " is required"); } return result; }
@Override public void setPropertyOnUser(User user, String propertyName, Object value) { if (user instanceof SystemUser) { throw new VisalloException("Cannot set properties on system user"); } ((InMemoryUser) user).setProperty(propertyName, value); } }
protected void broadcastEntityImage(Element element, String propertyKey, String propertyName) { try { JSONObject json = getBroadcastEntityImageJson((Vertex) element); broadcastJson(json); } catch (Exception ex) { throw new VisalloException("Could not broadcast property change", ex); } }
public byte[] get(String urlString, int retryCount) { try { HttpURLConnection connection = openConnection("GET", urlString); return getResponse(connection, urlString, retryCount); } catch (Exception ex) { throw new VisalloException("Could not get url: " + urlString, ex); } }