@Override public void readMember(RequestContext ctx, String id, Responder responder) throws Exception { if (scriptFileResource != null && id.equals(scriptFileResource.id())) { responder.resourceRead(scriptFileResource); } else { responder.noSuchResource(id); } }
@Override public void readMember(RequestContext ctx, String id, Responder responder) throws Exception { Script script = scripts.get(id); if (script != null) { responder.resourceRead(new ResourceScript(this, script)); } else { responder.noSuchResource(id); } }
public void deleteMember(RequestContext ctx, String id, Responder responder) throws Exception { Script script = scripts.get(id); if (script != null) { if (script.getScriptBuffer() != null) { deleteSourceFile(id); } deleteMetadataFile(id); deleteScriptDirectory(id); scripts.remove(id); responder.resourceDeleted(new ResourceScript(this, script)); } else { responder.noSuchResource(id); } }
@Override public void readMember(RequestContext ctx, String id, Responder responder) { try { if (id == null) { responder.resourceRead(this); return; } if (!this.resources.containsKey(id)) { responder.noSuchResource(id); return; } responder.resourceRead(this.resources.get(id)); } catch (Throwable t) { responder.internalError(t.getMessage()); } }