예제 #1
0
 @Override
 public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
   if (name.equals(ENABLE_OPERATION)) {
     Operation operation = new Operation(ENABLE_OPERATION, getAddress());
     Boolean persistent =
         Boolean.valueOf(parameters.getSimpleValue("persistent", TRUE.toString()));
     operation.addAdditionalProperty("persistent", persistent);
     Result res = getASConnection().execute(operation);
     if (res.isSuccess()) {
       return new OperationResult();
     } else {
       OperationResult operationResult = new OperationResult();
       operationResult.setErrorMessage(res.getFailureDescription());
       return operationResult;
     }
   }
   if (name.equals(DISABLE_OPERATION)) {
     Operation operation = new Operation(DISABLE_OPERATION, getAddress());
     boolean allowResourceServiceRestart =
         Boolean.parseBoolean(
             parameters.getSimpleValue("allow-resource-service-restart", FALSE.toString()));
     if (allowResourceServiceRestart) {
       operation.allowResourceServiceRestart();
     }
     Result res = getASConnection().execute(operation);
     if (res.isSuccess()) {
       return new OperationResult();
     } else {
       OperationResult operationResult = new OperationResult();
       operationResult.setErrorMessage(res.getFailureDescription());
       return operationResult;
     }
   }
   return super.invokeOperation(name, parameters);
 }
예제 #2
0
  protected void setProperties(UIComponent component) {
    super.setProperties(component);
    javax.faces.component.UIOutput output = null;
    try {
      output = (javax.faces.component.UIOutput) component;
    } catch (ClassCastException cce) {
      throw new IllegalStateException(
          "Component "
              + component.toString()
              + " not expected type.  Expected: javax.faces.component.UIOutput.  Perhaps you're missing a tag?");
    }

    if (converter != null) {
      if (!converter.isLiteralText()) {
        output.setValueExpression("converter", converter);
      } else {
        Converter conv =
            FacesContext.getCurrentInstance()
                .getApplication()
                .createConverter(converter.getExpressionString());
        output.setConverter(conv);
      }
    }

    if (value != null) {
      if (!value.isLiteralText()) {
        output.setValueExpression("value", value);
      } else {
        output.setValue(value.getExpressionString());
      }
    }
    if (escape != null) {
      if (!escape.isLiteralText()) {
        output.setValueExpression("escape", escape);
      } else {
        output
            .getAttributes()
            .put("escape", java.lang.Boolean.valueOf(escape.getExpressionString()));
      }
    }
    if (style != null) {
      if (!style.isLiteralText()) {
        output.setValueExpression("style", style);
      } else {
        output.getAttributes().put("style", style.getExpressionString());
      }
    }
    if (styleClass != null) {
      if (!styleClass.isLiteralText()) {
        output.setValueExpression("styleClass", styleClass);
      } else {
        output.getAttributes().put("styleClass", styleClass.getExpressionString());
      }
    }
  }
예제 #3
0
  protected void setProperties(UIComponent component) {
    super.setProperties(component);
    javax.faces.component.UICommand command = null;
    try {
      command = (javax.faces.component.UICommand) component;
    } catch (ClassCastException cce) {
      throw new IllegalStateException(
          "Component "
              + component.toString()
              + " not expected type.  Expected: javax.faces.component.UICommand.  Perhaps you're missing a tag?");
    }

    if (action != null) {
      command.setActionExpression(action);
    }
    if (actionListener != null) {
      command.addActionListener(new MethodExpressionActionListener(actionListener));
    }
    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        command.setValueExpression("immediate", immediate);
      } else {
        command.setImmediate(
            java.lang.Boolean.valueOf(immediate.getExpressionString()).booleanValue());
      }
    }
    if (label != null) {
      if (!label.isLiteralText()) {
        command.setValueExpression("label", label);
      } else {
        command.getAttributes().put("label", label.getExpressionString());
      }
    }
    if (oncommand != null) {
      if (!oncommand.isLiteralText()) {
        command.setValueExpression("oncommand", oncommand);
      } else {
        command.getAttributes().put("oncommand", oncommand.getExpressionString());
      }
    }
    if (onclick != null) {
      if (!onclick.isLiteralText()) {
        command.setValueExpression("onclick", onclick);
      } else {
        command.getAttributes().put("onclick", onclick.getExpressionString());
      }
    }
    if (onfocusin != null) {
      if (!onfocusin.isLiteralText()) {
        command.setValueExpression("onfocusin", onfocusin);
      } else {
        command.getAttributes().put("onfocusin", onfocusin.getExpressionString());
      }
    }
    if (onfocusout != null) {
      if (!onfocusout.isLiteralText()) {
        command.setValueExpression("onfocusout", onfocusout);
      } else {
        command.getAttributes().put("onfocusout", onfocusout.getExpressionString());
      }
    }
    if (onmousedown != null) {
      if (!onmousedown.isLiteralText()) {
        command.setValueExpression("onmousedown", onmousedown);
      } else {
        command.getAttributes().put("onmousedown", onmousedown.getExpressionString());
      }
    }
    if (onmousemove != null) {
      if (!onmousemove.isLiteralText()) {
        command.setValueExpression("onmousemove", onmousemove);
      } else {
        command.getAttributes().put("onmousemove", onmousemove.getExpressionString());
      }
    }
    if (onmouseout != null) {
      if (!onmouseout.isLiteralText()) {
        command.setValueExpression("onmouseout", onmouseout);
      } else {
        command.getAttributes().put("onmouseout", onmouseout.getExpressionString());
      }
    }
    if (onmouseover != null) {
      if (!onmouseover.isLiteralText()) {
        command.setValueExpression("onmouseover", onmouseover);
      } else {
        command.getAttributes().put("onmouseover", onmouseover.getExpressionString());
      }
    }
    if (onmouseup != null) {
      if (!onmouseup.isLiteralText()) {
        command.setValueExpression("onmouseup", onmouseup);
      } else {
        command.getAttributes().put("onmouseup", onmouseup.getExpressionString());
      }
    }
    if (style != null) {
      if (!style.isLiteralText()) {
        command.setValueExpression("style", style);
      } else {
        command.getAttributes().put("style", style.getExpressionString());
      }
    }
    if (styleClass != null) {
      if (!styleClass.isLiteralText()) {
        command.setValueExpression("styleClass", styleClass);
      } else {
        command.getAttributes().put("styleClass", styleClass.getExpressionString());
      }
    }
    if (type != null) {
      if (!type.isLiteralText()) {
        command.setValueExpression("type", type);
      } else {
        command.getAttributes().put("type", type.getExpressionString());
      }
    }
    if (value != null) {
      if (!value.isLiteralText()) {
        command.setValueExpression("value", value);
      } else {
        command.setValue(value.getExpressionString());
      }
    }
  }
예제 #4
0
 protected Boolean parseBooleanPrimitive(Boolean value) {
   return java.lang.Boolean.valueOf(value);
 }