Search in sources :

Example 61 with Attribute

use of com.mindbright.security.x509.Attribute in project n2o-framework by i-novus-llc.

the class IOProcessorImpl method childAttributeEnum.

@Override
public <T extends Enum<T>> void childAttributeEnum(Element element, String childName, String name, Supplier<T> getter, Consumer<T> setter, Class<T> enumClass) {
    if (r) {
        Element child = element.getChild(childName, element.getNamespace());
        if (child == null)
            return;
        Attribute attribute = child.getAttribute(name);
        if (attribute != null) {
            setter.accept(stringToEnum(process(attribute.getValue()), enumClass));
        }
    } else {
        if (getter.get() == null)
            return;
        Element childElement = element.getChild(childName, element.getNamespace());
        if (childElement == null) {
            childElement = new Element(childName, element.getNamespace());
            childElement.setAttribute(new Attribute(name, getter.get().toString()));
            element.addContent(childElement);
        } else {
            childElement.setAttribute(new Attribute(name, getter.get().toString()));
        }
    }
}
Also used : Attribute(org.jdom2.Attribute) Element(org.jdom2.Element)

Example 62 with Attribute

use of com.mindbright.security.x509.Attribute in project SOS by 52North.

the class AbstractNetcdfEncoder method addPublisher.

protected boolean addPublisher(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer) {
    SmlResponsibleParty responsibleParty = getResponsibleParty(sml, contactRole);
    if (responsibleParty != null) {
        if (responsibleParty.isSetOrganizationName()) {
            writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, responsibleParty.getOrganizationName()));
        }
        if (responsibleParty.isSetEmail()) {
            writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, responsibleParty.getEmail()));
        }
        if (responsibleParty.isSetOnlineResources()) {
            writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, responsibleParty.getOnlineResources().get(0)));
        }
    } else {
        String mail = getServiceProvider().getServiceContact().getContactInfo().flatMap(OwsContact::getAddress).map(OwsAddress::getElectronicMailAddress).map(l -> Iterables.getFirst(l, null)).orElse(null);
        String name = getServiceProvider().getProviderName();
        String url = getServiceProvider().getProviderSite().flatMap(OwsOnlineResource::getHref).map(URI::toString).orElse(null);
        writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, name));
        writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, mail));
        writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, url));
    }
    return true;
}
Also used : OGCConstants(org.n52.shetland.ogc.OGCConstants) DateTimeZone(org.joda.time.DateTimeZone) AbstractObservationResponse(org.n52.shetland.ogc.sos.response.AbstractObservationResponse) CodedException(org.n52.shetland.ogc.ows.exception.CodedException) AbstractSensorDataset(org.n52.sos.netcdf.data.dataset.AbstractSensorDataset) SosConstants(org.n52.shetland.ogc.sos.SosConstants) Time(org.n52.shetland.ogc.gml.time.Time) ArrayFloat(ucar.ma2.ArrayFloat) OwsServiceProvider(org.n52.shetland.ogc.ows.OwsServiceProvider) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) Map(java.util.Map) ObservationStream(org.n52.shetland.ogc.om.ObservationStream) DescribeSensorResponse(org.n52.shetland.ogc.sos.response.DescribeSensorResponse) SensorML(org.n52.shetland.ogc.sensorML.SensorML) EncodingException(org.n52.svalbard.encode.exception.EncodingException) Set(java.util.Set) OwsServiceMetadataRepository(org.n52.iceland.ogc.ows.OwsServiceMetadataRepository) Attribute(ucar.nc2.Attribute) SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) NetcdfFileWriter(ucar.nc2.NetcdfFileWriter) OwsAddress(org.n52.shetland.ogc.ows.OwsAddress) Joiner(com.google.common.base.Joiner) Iterables(com.google.common.collect.Iterables) SmlClassifierPredicates(org.n52.shetland.ogc.sensorML.elements.SmlClassifierPredicates) MediaType(org.n52.janmayen.http.MediaType) DateTimeHelper(org.n52.shetland.util.DateTimeHelper) Strings(com.google.common.base.Strings) Lists(com.google.common.collect.Lists) Version(ucar.nc2.NetcdfFileWriter.Version) LinkedHashSet(java.util.LinkedHashSet) ArrayDouble(ucar.ma2.ArrayDouble) Sos2Constants(org.n52.shetland.ogc.sos.Sos2Constants) OwsOnlineResource(org.n52.shetland.ogc.ows.OwsOnlineResource) IOException(java.io.IOException) NetCDFObservation(org.n52.sos.netcdf.om.NetCDFObservation) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport) ACDDConstants(com.axiomalaska.cf4j.constants.ACDDConstants) Array(ucar.ma2.Array) File(java.io.File) SosProcedureDescriptionUnknownType(org.n52.shetland.ogc.sos.SosProcedureDescriptionUnknownType) Nc4Iosp(ucar.nc2.jni.netcdf.Nc4Iosp) InvalidRangeException(ucar.ma2.InvalidRangeException) CFStandardNames(com.axiomalaska.cf4j.CFStandardNames) Index(ucar.ma2.Index) NoApplicableCodeException(org.n52.shetland.ogc.ows.exception.NoApplicableCodeException) Dimension(ucar.nc2.Dimension) ProcedureDescriptionFormatRepository(org.n52.sos.coding.encode.ProcedureDescriptionFormatRepository) NetcdfConstants(org.n52.sos.netcdf.NetcdfConstants) Value(org.n52.shetland.ogc.om.values.Value) SensorML20Constants(org.n52.shetland.ogc.sensorML.SensorML20Constants) ObservationEncoder(org.n52.svalbard.encode.ObservationEncoder) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) AbstractDescribeSensorHandler(org.n52.sos.ds.AbstractDescribeSensorHandler) SosProcedureDescription(org.n52.shetland.ogc.sos.SosProcedureDescription) SmlContact(org.n52.shetland.ogc.sensorML.SmlContact) EncodingContext(org.n52.svalbard.encode.EncodingContext) Locale(java.util.Locale) NetcdfHelper(org.n52.sos.netcdf.NetcdfHelper) OmObservableProperty(org.n52.shetland.ogc.om.OmObservableProperty) URI(java.net.URI) ImmutableSet(com.google.common.collect.ImmutableSet) OperationHandler(org.n52.iceland.request.handler.OperationHandler) Collection(java.util.Collection) DataType(ucar.ma2.DataType) CiRoleCodes(org.n52.shetland.iso.CodeList.CiRoleCodes) UUID(java.util.UUID) Sets(com.google.common.collect.Sets) CDM(ucar.nc2.constants.CDM) List(java.util.List) DescribeSensorRequest(org.n52.shetland.ogc.sos.request.DescribeSensorRequest) ProfileSubSensor(org.n52.sos.netcdf.data.subsensor.ProfileSubSensor) GeometryHandler(org.n52.sos.util.GeometryHandler) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) Entry(java.util.Map.Entry) Optional(java.util.Optional) SupportedType(org.n52.shetland.ogc.SupportedType) OperationHandlerRepository(org.n52.iceland.request.handler.OperationHandlerRepository) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) SubSensor(org.n52.sos.netcdf.data.subsensor.SubSensor) CFConstants(com.axiomalaska.cf4j.constants.CFConstants) OmConstants(org.n52.shetland.ogc.om.OmConstants) AbstractSensorML(org.n52.shetland.ogc.sensorML.AbstractSensorML) CF(ucar.nc2.constants.CF) SensorMLConstants(org.n52.shetland.ogc.sensorML.SensorMLConstants) Inject(javax.inject.Inject) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) CDMNode(ucar.nc2.CDMNode) BinaryAttachmentResponse(org.n52.shetland.ogc.sos.response.BinaryAttachmentResponse) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) Variable(ucar.nc2.Variable) NetCDFUtil(org.n52.sos.netcdf.NetCDFUtil) NODCConstants(com.axiomalaska.cf4j.constants.NODCConstants) Nc4ForceTimeChunkingStategy(org.n52.sos.netcdf.Nc4ForceTimeChunkingStategy) StaticLocationDataset(org.n52.sos.netcdf.data.dataset.StaticLocationDataset) IndexIterator(ucar.ma2.IndexIterator) DateTime(org.joda.time.DateTime) BinProfileSubSensor(org.n52.sos.netcdf.data.subsensor.BinProfileSubSensor) Maps(com.google.common.collect.Maps) SmlIdentifierPredicates(org.n52.shetland.ogc.sensorML.elements.SmlIdentifierPredicates) OwsContact(org.n52.shetland.ogc.ows.OwsContact) Collections(java.util.Collections) OwsOnlineResource(org.n52.shetland.ogc.ows.OwsOnlineResource) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) Attribute(ucar.nc2.Attribute) OwsAddress(org.n52.shetland.ogc.ows.OwsAddress)

Example 63 with Attribute

use of com.mindbright.security.x509.Attribute in project SOS by 52North.

the class AbstractNetcdfEncoder method addVariableLongitude.

protected Variable addVariableLongitude(NetcdfFileWriter writer, List<Dimension> dims) {
    Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.LONGITUDE.getName()), getDataType(), dims);
    v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.LONGITUDE.getName()));
    v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.LONGITUDE.getName())));
    v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_DEGREES_EAST));
    v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_X));
    v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue()));
    return v;
}
Also used : Variable(ucar.nc2.Variable) Attribute(ucar.nc2.Attribute)

Example 64 with Attribute

use of com.mindbright.security.x509.Attribute in project SOS by 52North.

the class AbstractOceanSITESEncoder method addVariableHeight.

@Override
protected Variable addVariableHeight(NetcdfFileWriter writer, List<Dimension> dims) {
    Variable variable = super.addVariableHeight(writer, dims);
    variable.addAttribute(new Attribute(OceanSITESConstants.REFERENCE, OceanSITESConstants.HEIGHT_DEPTH_REFERENCE_DEFAULT));
    variable.addAttribute(new Attribute(OceanSITESConstants.COORDINATE_REFERENCE_FRAME, OceanSITESConstants.EPSG_5829));
    variable.addAttribute(getDefaultQcIndicatorAttribute());
    return variable;
}
Also used : Variable(ucar.nc2.Variable) Attribute(ucar.nc2.Attribute)

Example 65 with Attribute

use of com.mindbright.security.x509.Attribute in project d3web-KnowWE by denkbares.

the class DOTRenderer method addTargetAttribute.

/**
 * Adds the target-attribute to the element.
 *
 * @created 21.12.2013
 */
private static void addTargetAttribute(Element element) {
    Attribute target = new Attribute("target", "_top");
    element.setAttribute(target);
}
Also used : Attribute(org.jdom2.Attribute)

Aggregations

Attribute (org.jdom2.Attribute)316 Element (org.jdom2.Element)210 Attribute (ucar.nc2.Attribute)65 IOException (java.io.IOException)55 ArrayList (java.util.ArrayList)51 Document (org.jdom2.Document)43 Variable (ucar.nc2.Variable)39 List (java.util.List)31 HashMap (java.util.HashMap)25 Namespace (org.jdom2.Namespace)24 File (java.io.File)21 Array (ucar.ma2.Array)21 DataConversionException (org.jdom2.DataConversionException)19 Test (org.junit.Test)19 Dimension (ucar.nc2.Dimension)19 Map (java.util.Map)17 JDOMException (org.jdom2.JDOMException)16 XmlDslUtils.addMigrationAttributeToElement (com.mulesoft.tools.migration.step.util.XmlDslUtils.addMigrationAttributeToElement)15 Editor (jmri.jmrit.display.Editor)15 NamedIcon (jmri.jmrit.catalog.NamedIcon)13