Ejemplo n.º 1
0
  public Version3(
      String securityName,
      String authProtocol,
      String authPassphrase,
      String privProtocol,
      String privPassphrase,
      String engineId,
      String contextEngineId,
      String contextName) {
    this.securityName = SnmpUtils.createOctetString(securityName);

    if (!StringUtils.isEmpty(authProtocol)) {
      if (authProtocol.equals("MD5")) this.authProtocol = AuthMD5.ID;
      else if (authProtocol.equals("SHA")) this.authProtocol = AuthSHA.ID;
      else
        throw new IllegalArgumentException("Authentication protocol unsupported: " + authProtocol);
    }

    this.authPassphrase = SnmpUtils.createOctetString(authPassphrase);

    if (!StringUtils.isEmpty(privProtocol)) {
      if (privProtocol.equals("DES")) this.privProtocol = PrivDES.ID;
      else if ((privProtocol.equals("AES128")) || (privProtocol.equals("AES")))
        this.privProtocol = PrivAES128.ID;
      else if (privProtocol.equals("AES192")) this.privProtocol = PrivAES192.ID;
      else if (privProtocol.equals("AES256")) this.privProtocol = PrivAES256.ID;
      else
        throw new IllegalArgumentException("Privacy protocol " + privProtocol + " not supported");
    }

    this.privPassphrase = SnmpUtils.createOctetString(privPassphrase);
    this.engineId = SnmpUtils.createOctetString(engineId);
    this.contextEngineId = SnmpUtils.createOctetString(contextEngineId);
    this.contextName = SnmpUtils.createOctetString(contextName);
  }
Ejemplo n.º 2
0
  @MethodFilter
  public DwrResponseI18n saveSimpleCompoundComponent(
      String viewComponentId,
      String name,
      String backgroundColour,
      List<KeyValuePair> childPointIds) {
    DwrResponseI18n response = new DwrResponseI18n();

    validateCompoundComponent(response, name);

    String leadPointId = null;
    for (KeyValuePair kvp : childPointIds) {
      if (SimpleCompoundComponent.LEAD_POINT.equals(kvp.getKey())) {
        leadPointId = kvp.getValue();
        break;
      }
    }

    if (StringUtils.parseInt(leadPointId, 0) <= 0)
      response.addContextualMessage(
          "compoundPointSelect" + SimpleCompoundComponent.LEAD_POINT, "dsEdit.validate.required");

    if (!response.getHasMessages()) {
      SimpleCompoundComponent c = (SimpleCompoundComponent) getViewComponent(viewComponentId);
      c.setName(name);
      c.setBackgroundColour(backgroundColour);
      saveCompoundPoints(c, childPointIds);
    }

    return response;
  }
Ejemplo n.º 3
0
  @MethodFilter
  public DwrResponseI18n saveScriptComponent(String viewComponentId, String script) {
    DwrResponseI18n response = new DwrResponseI18n();

    // Validate
    if (StringUtils.isEmpty(script))
      response.addContextualMessage(
          "graphicRendererScriptScript", "viewEdit.graphic.missingScript");

    if (!response.getHasMessages()) {
      ScriptComponent c = (ScriptComponent) getViewComponent(viewComponentId);
      c.setScript(script);
      resetPointComponent(c);
    }

    return response;
  }
Ejemplo n.º 4
0
 private void executeCommand(String command) {
   if (StringUtils.isEmpty(command)) return;
   ProcessWorkItem.queueProcess(command);
 }
Ejemplo n.º 5
0
 private void validateCompoundComponent(DwrResponseI18n response, String name) {
   if (StringUtils.isEmpty(name))
     response.addContextualMessage("compoundName", "dsEdit.validate.required");
 }