예제 #1
0
  public boolean initialize() {
    /**
     * TODO : Checking if the user provides the arguements currectly. TODO : This can now plot only
     * for one input stream value.
     */
    TreeMap<String, String> params = getVirtualSensorConfiguration().getMainClassInitialParams();
    ChartInfo chartInfo = new ChartInfo();
    chartInfo.setInputStreamName(params.get("input-stream"));

    chartInfo.setPlotTitle(params.get("title"));
    chartInfo.setType(params.get("type"));
    chartInfo.setHeight(ParamParser.getInteger(params.get("height"), 480));
    chartInfo.setWidth(ParamParser.getInteger(params.get("width"), 640));
    chartInfo.setVerticalAxisTitle(params.get("vertical-axis"));
    chartInfo.setHistorySize(ParamParser.getInteger(params.get("history-size"), 10));
    input_stream_name_to_ChartInfo_map.put(chartInfo.getInputStreamName(), chartInfo);
    chartInfo.initialize();
    return true;
  }
예제 #2
0
파일: IPCamWrapper.java 프로젝트: janza/gsn
  @Override
  public boolean initialize() {
    try {

      setName(WRAPPER_NAME + (++threadCounter));

      AddressBean addressBean = getActiveAddressBean();
      if (addressBean.getPredicateValue("sampling-rate") != null) {
        samplingRate =
            ParamParser.getInteger(
                addressBean.getPredicateValue("sampling-rate"), DEFAULT_SAMPLING_RATE);
        if (samplingRate <= 0) {
          samplingRate = DEFAULT_SAMPLING_RATE;
        }
      }

      if (addressBean.getPredicateValue("image-width") != null) {
        width = ParamParser.getInteger(addressBean.getPredicateValue("image-width"), DEFAULT_WIDTH);
        if (width <= 0) {
          width = DEFAULT_WIDTH;
        }
      }

      if (addressBean.getPredicateValue("image-height") != null) {
        height =
            ParamParser.getInteger(addressBean.getPredicateValue("image-height"), DEFAULT_HEIGHT);
        if (height <= 0) {
          height = DEFAULT_HEIGHT;
        }
      }

      if (addressBean.getPredicateValue("device-id") != null) {
        deviceId =
            ParamParser.getInteger(addressBean.getPredicateValue("device-id"), DEFAULT_DEVICE_ID);
        if (deviceId <= 0) {
          deviceId = DEFAULT_DEVICE_ID;
        }
      }

      if (addressBean.getPredicateValue("port") != null) {
        port = ParamParser.getInteger(addressBean.getPredicateValue("port"), DEFAULT_PORT);
        if (port <= 0) {
          port = DEFAULT_PORT;
        }
      }

      if (addressBean.getPredicateValue("profile") != null) {
        profile = ParamParser.getInteger(addressBean.getPredicateValue("profile"), DEFAULT_PROFILE);
        if (profile < 1 || profile > 3) {
          profile = DEFAULT_PROFILE;
        }
      }

      if (addressBean.getPredicateValue("server-name") != null) {
        serverName = addressBean.getPredicateValue("server-name");
      }

      if (addressBean.getPredicateValue("user") != null) {
        user = addressBean.getPredicateValue("user");
      }

      if (addressBean.getPredicateValue("pass") != null) {
        pass = addressBean.getPredicateValue("pass");
      }

      return true;
    } catch (Exception ex) {
      logger.error(ex);
    }
    return false;
  }