コード例 #1
0
ファイル: ResourceScript.java プロジェクト: rhauch/liveoak
  public void deleteMember(RequestContext ctx, String id, Responder responder) throws Exception {
    parent.getResourceInterceptorManager().removeResource(this.id);
    parent.deleteSourceFile(this.id);

    responder.resourceDeleted(this.scriptFileResource);

    this.scriptFileResource = null;
  }
コード例 #2
0
ファイル: ResourceScript.java プロジェクト: rhauch/liveoak
  @Override
  public void updateProperties(RequestContext ctx, ResourceState state, Responder responder)
      throws Exception {
    // TODO: put this code in a common location since its also used when creating
    Object nameProperty = state.getProperty(NAME);
    if (nameProperty != null) {
      name = nameProperty.toString();
    } else {
      name = null;
    }

    Object descriptionProperty = state.getProperty(DESCRIPTION);
    if (descriptionProperty != null) {
      description = descriptionProperty.toString();
    } else {
      description = null;
    }

    Object enabledProperty = state.getProperty(ENABELD);
    if (enabledProperty != null && enabledProperty instanceof Boolean) {
      enabled = (Boolean) enabledProperty;
    } else {
      enabled = false;
    }

    libraries.clear();
    Object libraries = state.getProperty(LIBRARIES);
    if (libraries != null && libraries instanceof List) {
      for (Object entry : (List) libraries) {
        if (entry instanceof String) {
          this.libraries.add((String) entry);
        }
      }
    } else if (libraries != null) {
      throw new InvalidPropertyTypeException(LIBRARIES, List.class);
    }

    Object targetProperty = state.getProperty(TARGET_PATH);
    if (targetProperty != null && targetProperty instanceof String) {
      target = (String) targetProperty;
    } else {
      throw new InvalidPropertyTypeException(TARGET_PATH, String.class);
    }

    Object priorityProperty = state.getProperty(PRIORITY);
    if (priorityProperty != null && priorityProperty instanceof Integer) {
      priority = (Integer) priorityProperty;
    } else if (priorityProperty != null) {
      throw new InvalidPropertyTypeException(PRIORITY, Integer.class);
    }

    parent.getResourceInterceptorManager().addResource(this);
    parent.writeMetadataFile(this.id(), ConversionUtils.convert(state));
    responder.resourceUpdated(this);
  }
コード例 #3
0
ファイル: ResourceScript.java プロジェクト: rhauch/liveoak
 public void setScriptFile(ByteBuf buffer) {
   this.scriptFileResource = new ScriptFileResource(this, buffer);
   parent.getResourceInterceptorManager().addResource(this);
 }