Exemplo n.º 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);
 }
Exemplo n.º 2
0
  public void proccessConnection() {
    iptables = new AccesIptables();
    // Thread thread = new Thread(iptables);
    // thread.start();
    try {
      while (in.ready()) {

        String linie[] = in.readLine().split("\\¶{1}");
        // System.out.println("Linie mesaj" +"- "+ linie[0] +" - "+ linie[1] +" - "+
        // java.lang.Boolean.parseBoolean(linie[2]));
        iptables.accesIptables(linie[0], linie[1], java.lang.Boolean.parseBoolean(linie[2]));
        // if (sesUtilDeDezactivat!=null) if (sesUtilDeDezactivat.compareTo("")!=0)
        // {interziceListaCereri(sesUtilDeDezactivat);
        // String idutil=dbcon.getString("SELECT id from utilizatori where
        // utilizator='"+sesUtilDeDezactivat+"'", "id");
        // String ip = dbcon.getString("SELECT ip from sesiuni where idutil='"+idutil+"' and
        // datapornire=dataoprire order by datapornire desc", "ip");
        // dbcon.update("UPDATE sesiuni set dataoprire=NOW() where ip='"+ip+"' and
        // datapornire=dataoprire");
      }
      out.flush();
      out.close();
    } catch (Exception ex) {
      //  jurnal.println("Eroare la procesarea conexiunii: "+ex.getMessage());
      ex.printStackTrace();
    }
    iptables.run();
  }
  /**
   * @param value
   * @param type
   * @return
   */
  private Object createTypedObject(String value, Class type) {
    if (java.lang.String.class == type) return value;
    else if (java.lang.Integer.class == type) return java.lang.Integer.parseInt(value);
    else if (java.lang.Long.class == type) return java.lang.Long.parseLong(value);
    else if (java.lang.Boolean.class == type) return java.lang.Boolean.parseBoolean(value);
    else if (java.lang.Float.class == type) return java.lang.Float.parseFloat(value);
    else if (java.lang.Double.class == type) return java.lang.Double.parseDouble(value);

    return null;
  }
Exemplo n.º 4
0
  private boolean getBoolean(
      final Map<String, String> options, final String key, final boolean defaultValue) {

    final String option = options.get(key);

    if (StringUtils.hasText(option)) {
      return java.lang.Boolean.parseBoolean(option);
    }

    return defaultValue;
  }
Exemplo n.º 5
0
  private abstract static class Cache {
    static final boolean enabled =
        java.lang.Boolean.parseBoolean(System.getProperty("x10.lang.UByte.Cache.enabled", "false"));
    static final int low = -128;
    static final int high = enabled ? 127 : (low - 1); // disable caching
    static final UByte cache[] = new UByte[high - low + 1];

    static {
      for (int i = 0; i < cache.length; ++i) {
        cache[i] = new UByte((byte) (low + i));
      }
    }
  }
Exemplo n.º 6
0
 @Ignore
 public static Boolean valueOf(java.lang.String string) {
   return instance(java.lang.Boolean.parseBoolean(string));
 }
Exemplo n.º 7
0
 public byte[] toBytes(java.lang.String value) {
   return Bytes.toBytes(java.lang.Boolean.parseBoolean(value));
 }
 /**
  * Convenience method for parsing and setting whether the comment field is required.
  *
  * @param required String representation of boolean required
  */
 private void setCommentFieldRequired(String required) {
   if (enabled != null && enabled.length() > 0) {
     builder.setCommentFieldRequired(Boolean.parseBoolean(enabled));
   }
 }
 /**
  * Convenience method for parsing and setting whether the intro dialog should be shown the first
  * time the app is opened.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setIntroDialogEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setShouldShowIntroDialog(Boolean.parseBoolean(enabled));
   }
 }
 /**
  * Convenience method for parsing and setting whether conversion sounds should be enabled by the
  * SDK.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setConversationSoundsEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setShouldPlayConversationSounds(Boolean.parseBoolean(enabled));
   }
 }
 /**
  * Convenience method for parsing and setting whether the debug logs from the Instabug SDK are
  * should be printed to LogCat.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setDebugEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setDebugEnabled(Boolean.parseBoolean(enabled));
   }
 }