コード例 #1
0
  /**
   * getMapperClass
   *
   * @param sd
   * @return
   * @throws Exception
   */
  public Class getMapperClass(ServiceDescription sd) throws Exception {
    Property property;
    boolean mapperFound = false;
    String mapperClassName = null;

    Iterator it = sd.getAllProperties();
    while (it.hasNext() && !mapperFound) {
      property = (Property) it.next();
      if (WSIGConstants.WSIG_MAPPER.equalsIgnoreCase(property.getName())) {
        mapperClassName = (String) property.getValue();
        mapperFound = true;
      }
    }

    if (!mapperFound) {
      return null;
    }

    Class mapperClass;
    try {
      mapperClass = Class.forName(mapperClassName);
    } catch (ClassNotFoundException e) {
      throw new Exception("Class " + mapperClassName + " not found!", e);
    }

    return mapperClass;
  }
コード例 #2
0
  /**
   * Return service prefix
   *
   * @param sd
   * @return
   */
  private String getServicePrefix(ServiceDescription sd) {

    Property property;
    Iterator it = sd.getAllProperties();
    while (it.hasNext()) {
      property = (Property) it.next();

      if (WSIGConstants.WSIG_PREFIX.equalsIgnoreCase(property.getName())
          && property.getValue().toString().length() != 0) {
        return property.getValue().toString() + WSDLConstants.SEPARATOR;
      }
    }
    return "";
  }
コード例 #3
0
  /**
   * Return true if service is of type wsig
   *
   * @param sd
   * @return
   */
  private boolean isWSIGService(ServiceDescription sd) {

    Property property;
    Iterator it = sd.getAllProperties();
    while (it.hasNext()) {
      property = (Property) it.next();

      if (WSIGConstants.WSIG_FLAG.equalsIgnoreCase(property.getName())
          && "true".equals(property.getValue().toString())) {
        return true;
      }
    }
    return false;
  }
コード例 #4
0
    /**
     * Extract a Location from a list of properties from a Service description
     *
     * @param it iterator over the list of properties
     * @return the location on the map described by this set of properties
     */
    public static Location extractLocation(Iterator it) {
      Location loc = new Location("mygps");

      while (it.hasNext()) {
        Property p = (Property) it.next();

        String propertyName = p.getName();

        if (propertyName.equals(DFUpdaterBehaviour.PROPERTY_NAME_LOCATION_ALT)) {
          double altitude = Double.parseDouble((String) p.getValue());
          loc.setAltitude(altitude);
        } else if (propertyName.equals(DFUpdaterBehaviour.PROPERTY_NAME_LOCATION_LAT)) {
          double latitude = Double.parseDouble((String) p.getValue());
          loc.setLatitude(latitude);
        } else if (propertyName.equals(DFUpdaterBehaviour.PROPERTY_NAME_LOCATION_LONG)) {
          double longitude = Double.parseDouble((String) p.getValue());
          loc.setLongitude(longitude);
        }
      }

      return loc;
    }