コード例 #1
0
  /**
   * @return
   * @throws OXFException
   */
  public ServiceIdentification mapServiceIdentification(WCSCapabilitiesType w) throws OXFException {
    String title = w.getService().getLabel();
    String serviceType = "OGC:WCS"; // -> cause its a WCS-Adapter
    String[] serviceTypeVersion = new String[] {"1.0.0"};

    ServiceIdentification si;
    try {
      si = new ServiceIdentification(title, serviceType, serviceTypeVersion);
    } catch (IllegalArgumentException e) {
      throw new OXFException(e);
    }
    return si;
  }
コード例 #2
0
  /** Supports WCS 1.0.0 */
  public ServiceProvider mapServiceProvider(WCSCapabilitiesType wt) throws OXFException {
    ResponsiblePartyType responsibleParty = wt.getService().getResponsibleParty();

    ServiceContact serviceContact = null;

    String providerName = "xyz"; // TODO: vernuenftigen Provider-Namen heraus ziehen

    if (responsibleParty != null) {
      List<JAXBElement> list = responsibleParty.getContent();
      for (JAXBElement e : list) {
        String localPart = e.getName().getLocalPart();

        String individualName = null;
        String organisationName = null;
        String positionName = null;
        Contact contact = null;

        if (localPart.equalsIgnoreCase("individualName")) {
          individualName = e.getValue().toString();
        } else if (localPart.equalsIgnoreCase("organisationName")) {
          organisationName = e.getValue().toString();
        } else if (localPart.equalsIgnoreCase("positionName")) {
          positionName = e.getValue().toString();
        } else if (localPart.equalsIgnoreCase("contactInfo")) {

          // Sub-Section "ContactInfo":
          ContactType ct = (ContactType) e.getValue();

          // Sub-Section "OnlineResource":
          OnlineResourceType ort = (OnlineResourceType) ct.getOnlineResource();
          OnlineResource onlineResource = null;
          if (ort != null) {
            onlineResource =
                new OnlineResource(
                    ort.getType(),
                    ort.getHref(),
                    ort.getRole(),
                    ort.getArcrole(),
                    ort.getShow(),
                    ort.getActuate(),
                    ort.getTitle());
          }

          // Sub-Section "Phone":
          TelephoneType tt = (TelephoneType) ct.getPhone();
          String[] telephone = null;
          if (tt != null) {
            telephone = new String[tt.getVoice().size()];
            tt.getVoice().toArray(telephone);
          }

          // Sub-Section "Address":
          AddressType at = (AddressType) ct.getAddress();
          Address address = null;

          if (at != null) {
            String administrativeArea = at.getAdministrativeArea();
            String city = at.getCity();
            String country = at.getCountry();
            String postalCode = at.getPostalCode();

            String[] tempDeliveryPointArray = new String[at.getDeliveryPoint().size()];
            at.getDeliveryPoint().toArray(tempDeliveryPointArray);
            String[] deliveryPoints = tempDeliveryPointArray;

            String[] tempElectronicMailAddressArray =
                new String[at.getElectronicMailAddress().size()];
            at.getElectronicMailAddress().toArray(tempElectronicMailAddressArray);
            String[] electronicMailAddresses = tempElectronicMailAddressArray;

            address =
                new Address(
                    city,
                    administrativeArea,
                    postalCode,
                    country,
                    deliveryPoints,
                    electronicMailAddresses);
          }
          contact = new Contact(telephone, null, null, null, address, onlineResource);
        }
        serviceContact =
            new ServiceContact(individualName, organisationName, positionName, contact);
      }
    }
    ServiceProvider sp = new ServiceProvider(providerName, serviceContact);

    return sp;
  }