Search in sources :

Example 51 with If

use of org.w3._2007.rif.If in project airavata by apache.

the class StorageCreator method createStorage.

// The target site must have storage factory deployed with bes factory
public StorageClient createStorage() throws Exception {
    if (factoryUrl == null) {
        throw new Exception("Cannot create Storage Factory Url");
    }
    EndpointReferenceType sfEpr = WSUtilities.makeServiceEPR(factoryUrl, StorageFactory.SMF_PORT);
    String dn = findServerName(factoryUrl, sfEpr);
    WSUtilities.addServerIdentity(sfEpr, dn);
    secProps.getETDSettings().setReceiver(new X500Principal(dn));
    secProps.getETDSettings().setIssuerCertificateChain(secProps.getCredential().getCertificateChain());
    // TODO: remove it afterwards
    if (userName != null) {
        secProps.getETDSettings().getRequestedUserAttributes2().put("xlogin", new String[] { userName });
    }
    StorageFactoryClient sfc = new StorageFactoryClient(sfEpr, secProps);
    if (log.isDebugEnabled()) {
        log.debug("Using storage factory at <" + sfc.getUrl() + ">");
    }
    StorageClient sc = null;
    try {
        sc = sfc.createSMS(getCreateSMSDocument());
        String addr = sc.getEPR().getAddress().getStringValue();
        log.info(addr);
    } catch (Exception ex) {
        log.error("Could not create storage", ex);
        throw new Exception(ex);
    }
    return sc;
}
Also used : EndpointReferenceType(org.w3.x2005.x08.addressing.EndpointReferenceType) X500Principal(javax.security.auth.x500.X500Principal) StorageClient(de.fzj.unicore.uas.client.StorageClient) StorageFactoryClient(de.fzj.unicore.uas.client.StorageFactoryClient)

Example 52 with If

use of org.w3._2007.rif.If in project airavata by apache.

the class StorageCreator method findServerName.

protected String findServerName(String besUrl, EndpointReferenceType smsEpr) throws Exception {
    int besIndex = besUrl.indexOf("StorageFactory?res");
    String ss = besUrl.substring(0, besIndex);
    ss = ss + "Registry";
    EndpointReferenceType eprt = WSUtilities.makeServiceEPR(ss, "default_registry", Registry.REGISTRY_PORT);
    RegistryClient registry = new RegistryClient(eprt, secProps);
    // first, check if server name is already in the EPR...
    String dn = WSUtilities.extractServerIDFromEPR(smsEpr);
    if (dn != null) {
        return dn;
    }
    // otherwise find a matching service in the registry
    String url = smsEpr.getAddress().getStringValue();
    if (url.contains("/services/"))
        url = url.substring(0, url.indexOf("/services"));
    if (log.isDebugEnabled())
        log.debug("Checking for services at " + url);
    for (EntryType entry : registry.listEntries()) {
        if (entry.getMemberServiceEPR().getAddress().getStringValue().startsWith(url)) {
            dn = WSUtilities.extractServerIDFromEPR(entry.getMemberServiceEPR());
            if (dn != null) {
                return dn;
            }
        }
    }
    return null;
}
Also used : EndpointReferenceType(org.w3.x2005.x08.addressing.EndpointReferenceType) EntryType(org.oasisOpen.docs.wsrf.sg2.EntryType) RegistryClient(de.fzj.unicore.wsrflite.xmlbeans.client.RegistryClient)

Example 53 with If

use of org.w3._2007.rif.If in project arctic-sea by 52North.

the class AbstractWmlEncoderv20 method addVerticalDatum.

private void addVerticalDatum(MonitoringPointType mpt, List<Referenceable<VerticalDatum>> verticalDatums) throws EncodingException {
    for (Referenceable<VerticalDatum> verticalDatum : verticalDatums) {
        VerticalDatumPropertyType vdpt = mpt.addNewVerticalDatum();
        if (verticalDatum.isReference()) {
            Reference reference = verticalDatum.getReference();
            reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(vdpt::setActuate);
            reference.getArcrole().ifPresent(vdpt::setArcrole);
            reference.getHref().map(URI::toString).ifPresent(vdpt::setHref);
            reference.getRole().ifPresent(vdpt::setRole);
            reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(vdpt::setShow);
            reference.getTitle().ifPresent(vdpt::setTitle);
            reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(vdpt::setType);
        } else {
            if (verticalDatum.isInstance()) {
                Nillable<VerticalDatum> nillable = verticalDatum.getInstance();
                if (nillable.isPresent()) {
                    XmlObject xml = encodeGML(nillable.get());
                    if (xml != null && xml instanceof VerticalDatumType) {
                        vdpt.setVerticalDatum((VerticalDatumType) xml);
                    } else {
                        vdpt.setNil();
                        vdpt.setNilReason(Nillable.missing().get());
                    }
                } else {
                    vdpt.setNil();
                    if (nillable.hasReason()) {
                        vdpt.setNilReason(nillable.getNilReason().get());
                    } else {
                        vdpt.setNilReason(Nillable.missing().get());
                    }
                }
            }
        }
    }
}
Also used : ActuateType(org.w3.x1999.xlink.ActuateType) VerticalDatumPropertyType(net.opengis.gml.x32.VerticalDatumPropertyType) Reference(org.n52.shetland.w3c.xlink.Reference) VerticalDatum(org.n52.shetland.ogc.gml.VerticalDatum) Actuate(org.n52.shetland.w3c.xlink.Actuate) VerticalDatumPropertyType(net.opengis.gml.x32.VerticalDatumPropertyType) ActuateType(org.w3.x1999.xlink.ActuateType) CodeType(org.n52.shetland.ogc.gml.CodeType) MonitoringPointType(net.opengis.waterml.x20.MonitoringPointType) ObservationProcessType(net.opengis.waterml.x20.ObservationProcessType) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) ShapeType(net.opengis.samplingSpatial.x20.ShapeType) CollectionType(net.opengis.waterml.x20.CollectionType) MediaType(org.n52.janmayen.http.MediaType) TypeType(org.w3.x1999.xlink.TypeType) Type(org.n52.shetland.w3c.xlink.Type) VerticalDatumType(net.opengis.gml.x32.VerticalDatumType) OMObservationType(net.opengis.om.x20.OMObservationType) ShowType(org.w3.x1999.xlink.ShowType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) VerticalDatumType(net.opengis.gml.x32.VerticalDatumType) Show(org.n52.shetland.w3c.xlink.Show) XmlObject(org.apache.xmlbeans.XmlObject) TypeType(org.w3.x1999.xlink.TypeType) ShowType(org.w3.x1999.xlink.ShowType)

Example 54 with If

use of org.w3._2007.rif.If in project arctic-sea by 52North.

the class AbstractWmlEncoderv20 method addRelatedParty.

private void addRelatedParty(MonitoringPointType mpt, List<Referenceable<CiResponsibleParty>> relatedParties) throws EncodingException {
    for (Referenceable<CiResponsibleParty> relatedParty : relatedParties) {
        CIResponsiblePartyPropertyType citppt = mpt.addNewRelatedParty();
        if (relatedParty.isReference()) {
            Reference reference = relatedParty.getReference();
            reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(citppt::setActuate);
            reference.getArcrole().ifPresent(citppt::setArcrole);
            reference.getHref().map(URI::toString).ifPresent(citppt::setHref);
            reference.getRole().ifPresent(citppt::setRole);
            reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(citppt::setShow);
            reference.getTitle().ifPresent(citppt::setTitle);
            reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(citppt::setType);
        } else {
            if (relatedParty.isInstance()) {
                Nillable<CiResponsibleParty> nillable = relatedParty.getInstance();
                if (nillable.isPresent()) {
                    XmlObject xml = encodeObjectToXml(nillable.get().getDefaultElementEncoding(), nillable.get());
                    if (xml != null && xml instanceof CIResponsiblePartyType) {
                        citppt.setCIResponsibleParty((CIResponsiblePartyType) xml);
                    } else {
                        citppt.setNil();
                        citppt.setNilReason(Nillable.missing().get());
                    }
                } else {
                    citppt.setNil();
                    if (nillable.hasReason()) {
                        citppt.setNilReason(nillable.getNilReason().get());
                    } else {
                        citppt.setNilReason(Nillable.missing().get());
                    }
                }
            }
        }
    }
}
Also used : CiResponsibleParty(org.n52.shetland.iso.gmd.CiResponsibleParty) ActuateType(org.w3.x1999.xlink.ActuateType) Reference(org.n52.shetland.w3c.xlink.Reference) Actuate(org.n52.shetland.w3c.xlink.Actuate) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) VerticalDatumPropertyType(net.opengis.gml.x32.VerticalDatumPropertyType) ActuateType(org.w3.x1999.xlink.ActuateType) CodeType(org.n52.shetland.ogc.gml.CodeType) MonitoringPointType(net.opengis.waterml.x20.MonitoringPointType) ObservationProcessType(net.opengis.waterml.x20.ObservationProcessType) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) ShapeType(net.opengis.samplingSpatial.x20.ShapeType) CollectionType(net.opengis.waterml.x20.CollectionType) MediaType(org.n52.janmayen.http.MediaType) TypeType(org.w3.x1999.xlink.TypeType) Type(org.n52.shetland.w3c.xlink.Type) VerticalDatumType(net.opengis.gml.x32.VerticalDatumType) OMObservationType(net.opengis.om.x20.OMObservationType) ShowType(org.w3.x1999.xlink.ShowType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) Show(org.n52.shetland.w3c.xlink.Show) XmlObject(org.apache.xmlbeans.XmlObject) TypeType(org.w3.x1999.xlink.TypeType) ShowType(org.w3.x1999.xlink.ShowType)

Example 55 with If

use of org.w3._2007.rif.If in project arctic-sea by 52North.

the class Iso19139GmdEncoder method encodePhone.

private void encodePhone(CITelephonePropertyType citpt, Referenceable<CiTelephone> referenceable) {
    if (referenceable.isReference()) {
        Reference reference = referenceable.getReference();
        reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(citpt::setActuate);
        reference.getArcrole().ifPresent(citpt::setArcrole);
        reference.getHref().map(URI::toString).ifPresent(citpt::setHref);
        reference.getRole().ifPresent(citpt::setRole);
        reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(citpt::setShow);
        reference.getTitle().ifPresent(citpt::setTitle);
        reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(citpt::setType);
    } else {
        if (referenceable.isInstance()) {
            Nillable<CiTelephone> nillable = referenceable.getInstance();
            if (nillable.isPresent()) {
                CiTelephone ciTelephone = referenceable.getInstance().get();
                CITelephoneType citt = citpt.addNewCITelephone();
                if (ciTelephone.isSetVoice()) {
                    citt.setVoiceArray(listToCharacterStringPropertyTypeArray(ciTelephone.getVoice()));
                }
                if (ciTelephone.isSetFacsimile()) {
                    citt.setFacsimileArray(listToCharacterStringPropertyTypeArray(ciTelephone.getFacsimile()));
                }
                if (ciTelephone.isSetId()) {
                    citt.setId(ciTelephone.getId());
                }
                if (ciTelephone.isSetUuid()) {
                    citt.setUuid(ciTelephone.getUuid());
                }
            } else {
                if (nillable.hasReason()) {
                    citpt.setNilReason(nillable.getNilReason().get());
                }
            }
        }
    }
}
Also used : ActuateType(org.w3.x1999.xlink.ActuateType) Actuate(org.n52.shetland.w3c.xlink.Actuate) CIAddressType(org.isotc211.x2005.gmd.CIAddressType) CIContactPropertyType(org.isotc211.x2005.gmd.CIContactPropertyType) DQDomainConsistencyPropertyType(org.isotc211.x2005.gmd.DQDomainConsistencyPropertyType) CodeType(net.opengis.gml.x32.CodeType) MDMetadataPropertyType(org.isotc211.x2005.gmd.MDMetadataPropertyType) MDMetadataType(org.isotc211.x2005.gmd.MDMetadataType) LocalisedCharacterStringPropertyType(org.isotc211.x2005.gmd.LocalisedCharacterStringPropertyType) CharacterStringPropertyType(org.isotc211.x2005.gco.CharacterStringPropertyType) EXExtentPropertyType(org.isotc211.x2005.gmd.EXExtentPropertyType) CICitationType(org.isotc211.x2005.gmd.CICitationType) MDDataIdentificationType(org.isotc211.x2005.gmd.MDDataIdentificationType) DQDomainConsistencyType(org.isotc211.x2005.gmd.DQDomainConsistencyType) EXVerticalExtentType(org.isotc211.x2005.gmd.EXVerticalExtentType) GmdDateType(org.n52.shetland.iso.gmd.GmdDateType) CodeListValueType(org.isotc211.x2005.gco.CodeListValueType) AbstractCRSType(net.opengis.gml.x32.AbstractCRSType) DQResultPropertyType(org.isotc211.x2005.gmd.DQResultPropertyType) CIDateType(org.isotc211.x2005.gmd.CIDateType) CIContactType(org.isotc211.x2005.gmd.CIContactType) ShowType(org.w3.x1999.xlink.ShowType) MDIdentificationPropertyType(org.isotc211.x2005.gmd.MDIdentificationPropertyType) EXExtentType(org.isotc211.x2005.gmd.EXExtentType) CIOnlineResourcePropertyType(org.isotc211.x2005.gmd.CIOnlineResourcePropertyType) BaseUnitType(net.opengis.gml.x32.BaseUnitType) CITelephonePropertyType(org.isotc211.x2005.gmd.CITelephonePropertyType) ActuateType(org.w3.x1999.xlink.ActuateType) CIAddressPropertyType(org.isotc211.x2005.gmd.CIAddressPropertyType) UnitOfMeasurePropertyType(org.isotc211.x2005.gco.UnitOfMeasurePropertyType) EXVerticalExtentPropertyType(org.isotc211.x2005.gmd.EXVerticalExtentPropertyType) CIOnlineResourceType(org.isotc211.x2005.gmd.CIOnlineResourceType) DQQuantitativeResultType(org.isotc211.x2005.gmd.DQQuantitativeResultType) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) SupportedType(org.n52.shetland.ogc.SupportedType) LocalisedCharacterStringType(org.isotc211.x2005.gmd.LocalisedCharacterStringType) CICitationPropertyType(org.isotc211.x2005.gmd.CICitationPropertyType) CITelephoneType(org.isotc211.x2005.gmd.CITelephoneType) DQConformanceResultType(org.isotc211.x2005.gmd.DQConformanceResultType) TypeType(org.w3.x1999.xlink.TypeType) Type(org.n52.shetland.w3c.xlink.Type) CIRoleCodePropertyType(org.isotc211.x2005.gmd.CIRoleCodePropertyType) MDDataIdentificationPropertyType(org.isotc211.x2005.gmd.MDDataIdentificationPropertyType) RealPropertyType(org.isotc211.x2005.gco.RealPropertyType) AbstractMDIdentificationType(org.isotc211.x2005.gmd.AbstractMDIdentificationType) PTFreeTextType(org.isotc211.x2005.gmd.PTFreeTextType) SCCRSPropertyType(org.isotc211.x2005.gsr.SCCRSPropertyType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) CiTelephone(org.n52.shetland.iso.gmd.CiTelephone) Reference(org.n52.shetland.w3c.xlink.Reference) CITelephoneType(org.isotc211.x2005.gmd.CITelephoneType) Show(org.n52.shetland.w3c.xlink.Show) TypeType(org.w3.x1999.xlink.TypeType) ShowType(org.w3.x1999.xlink.ShowType)

Aggregations

Actuate (org.n52.shetland.w3c.xlink.Actuate)15 Show (org.n52.shetland.w3c.xlink.Show)15 ActuateType (org.w3.x1999.xlink.ActuateType)15 ShowType (org.w3.x1999.xlink.ShowType)15 Reference (org.n52.shetland.w3c.xlink.Reference)14 Type (org.n52.shetland.w3c.xlink.Type)14 TypeType (org.w3.x1999.xlink.TypeType)14 IOException (java.io.IOException)13 XmlObject (org.apache.xmlbeans.XmlObject)11 AbstractCRSType (net.opengis.gml.x32.AbstractCRSType)10 CodeType (net.opengis.gml.x32.CodeType)10 EXExtentType (org.isotc211.x2005.gmd.EXExtentType)10 ProvideAndRegisterDocumentSetRequestType (ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType)9 ArrayList (java.util.ArrayList)8 CIResponsiblePartyPropertyType (org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType)8 CIResponsiblePartyType (org.isotc211.x2005.gmd.CIResponsiblePartyType)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 BaseUnitType (net.opengis.gml.x32.BaseUnitType)6 VerticalDatumPropertyType (net.opengis.gml.x32.VerticalDatumPropertyType)5 VerticalDatumType (net.opengis.gml.x32.VerticalDatumType)5