Search in sources :

Example 1 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project druid by druid-io.

the class DataSchema method getParser.

@JsonIgnore
public InputRowParser getParser() {
    if (parser == null) {
        log.warn("No parser has been specified");
        return null;
    }
    final InputRowParser inputRowParser = jsonMapper.convertValue(this.parser, InputRowParser.class);
    final Set<String> dimensionExclusions = Sets.newHashSet();
    for (AggregatorFactory aggregator : aggregators) {
        dimensionExclusions.addAll(aggregator.requiredFields());
        dimensionExclusions.add(aggregator.getName());
    }
    if (inputRowParser.getParseSpec() != null) {
        final DimensionsSpec dimensionsSpec = inputRowParser.getParseSpec().getDimensionsSpec();
        final TimestampSpec timestampSpec = inputRowParser.getParseSpec().getTimestampSpec();
        // exclude timestamp from dimensions by default, unless explicitly included in the list of dimensions
        if (timestampSpec != null) {
            final String timestampColumn = timestampSpec.getTimestampColumn();
            if (!(dimensionsSpec.hasCustomDimensions() && dimensionsSpec.getDimensionNames().contains(timestampColumn))) {
                dimensionExclusions.add(timestampColumn);
            }
        }
        if (dimensionsSpec != null) {
            final Set<String> metSet = Sets.newHashSet();
            for (AggregatorFactory aggregator : aggregators) {
                metSet.add(aggregator.getName());
            }
            final Set<String> dimSet = Sets.newHashSet(dimensionsSpec.getDimensionNames());
            final Set<String> overlap = Sets.intersection(metSet, dimSet);
            if (!overlap.isEmpty()) {
                throw new IAE("Cannot have overlapping dimensions and metrics of the same name. Please change the name of the metric. Overlap: %s", overlap);
            }
            return inputRowParser.withParseSpec(inputRowParser.getParseSpec().withDimensionsSpec(dimensionsSpec.withDimensionExclusions(Sets.difference(dimensionExclusions, dimSet))));
        } else {
            return inputRowParser;
        }
    } else {
        log.warn("No parseSpec in parser has been specified.");
        return inputRowParser;
    }
}
Also used : TimestampSpec(io.druid.data.input.impl.TimestampSpec) DimensionsSpec(io.druid.data.input.impl.DimensionsSpec) InputRowParser(io.druid.data.input.impl.InputRowParser) AggregatorFactory(io.druid.query.aggregation.AggregatorFactory) IAE(io.druid.java.util.common.IAE) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 2 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project OpenAM by OpenRock.

the class PolicyCondition method getPolicyCondition.

/**
     * Constructs a legacy policy {@link Condition} object based on the information contained in this adapter.
     *
     * @return the legacy policy condition.
     * @throws EntitlementException if an error occurs constructing the condition.
     */
@JsonIgnore
public Condition getPolicyCondition() throws EntitlementException {
    try {
        Condition cond = Class.forName(className).asSubclass(Condition.class).newInstance();
        cond.setProperties(properties);
        return cond;
    } catch (ClassNotFoundException cnfe) {
        throw new EntitlementException(UNKNOWN_POLICY_CLASS, new String[] { className }, cnfe);
    } catch (ClassCastException cce) {
        throw new EntitlementException(POLICY_CLASS_CAST_EXCEPTION, new String[] { className, Condition.class.getName() }, cce);
    } catch (InstantiationException ie) {
        throw new EntitlementException(POLICY_CLASS_NOT_INSTANTIABLE, new String[] { className }, ie);
    } catch (IllegalAccessException iae) {
        throw new EntitlementException(POLICY_CLASS_NOT_ACCESSIBLE, new String[] { className }, iae);
    } catch (PolicyException pe) {
        throw new EntitlementException(INVALID_PROPERTY_VALUE_UNKNOWN_VALUE, new String[] { className }, pe);
    }
}
Also used : Condition(com.sun.identity.policy.interfaces.Condition) EntitlementException(com.sun.identity.entitlement.EntitlementException) PolicyException(com.sun.identity.policy.PolicyException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 3 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project OpenAM by OpenRock.

the class PolicyResponseProvider method getResponseProvider.

/**
     * Constructs a legacy response provider based on the information in this adapter.
     *
     * @return the legacy response provider
     * @throws EntitlementException if an error occurs constructing the response provider.
     */
@JsonIgnore
public ResponseProvider getResponseProvider() throws EntitlementException {
    try {
        ResponseProvider rp = Class.forName(className).asSubclass(ResponseProvider.class).newInstance();
        Map<String, Set<String>> properties = new HashMap<String, Set<String>>();
        properties.put(propertyName, propertyValues);
        rp.setProperties(properties);
        return rp;
    } catch (Exception ex) {
        throw new EntitlementException(510, ex);
    }
}
Also used : EntitlementException(com.sun.identity.entitlement.EntitlementException) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) ResponseProvider(com.sun.identity.policy.interfaces.ResponseProvider) JSONException(org.json.JSONException) EntitlementException(com.sun.identity.entitlement.EntitlementException) SSOException(com.iplanet.sso.SSOException) PolicyException(com.sun.identity.policy.PolicyException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 4 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project OpenAM by OpenRock.

the class PolicySubject method getPolicySubject.

/**
     * Constructs a legacy policy subject based on the information in this adapter.
     *
     * @return the legacy policy subject
     * @throws EntitlementException if an error occurs constructing the subject.
     */
@JsonIgnore
public Subject getPolicySubject() throws EntitlementException {
    try {
        Subject subject = Class.forName(className).asSubclass(Subject.class).newInstance();
        subject.setValues(values);
        return subject;
    } catch (Exception ex) {
        throw new EntitlementException(508, ex);
    }
}
Also used : EntitlementException(com.sun.identity.entitlement.EntitlementException) EntitlementSubject(com.sun.identity.entitlement.EntitlementSubject) Subject(com.sun.identity.policy.interfaces.Subject) JSONException(org.json.JSONException) EntitlementException(com.sun.identity.entitlement.EntitlementException) SSOException(com.iplanet.sso.SSOException) PolicyException(com.sun.identity.policy.PolicyException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 5 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project pulsar by yahoo.

the class LoadReport method getBottleneckResourceType.

@JsonIgnore
public ResourceType getBottleneckResourceType() {
    ResourceType type = ResourceType.CPU;
    double maxUsage = systemResourceUsage.cpu.percentUsage();
    if (systemResourceUsage.memory.percentUsage() > maxUsage) {
        maxUsage = systemResourceUsage.memory.percentUsage();
        type = ResourceType.Memory;
    }
    if (systemResourceUsage.bandwidthIn.percentUsage() > maxUsage) {
        maxUsage = systemResourceUsage.bandwidthIn.percentUsage();
        type = ResourceType.BandwidthIn;
    }
    if (systemResourceUsage.bandwidthOut.percentUsage() > maxUsage) {
        maxUsage = systemResourceUsage.bandwidthOut.percentUsage();
        type = ResourceType.BandwidthOut;
    }
    return type;
}
Also used : ResourceType(com.yahoo.pulsar.common.policies.data.loadbalancer.SystemResourceUsage.ResourceType) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)109 lombok.val (lombok.val)14 ArrayList (java.util.ArrayList)11 HashMap (java.util.HashMap)8 Map (java.util.Map)8 HashSet (java.util.HashSet)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 Date (java.util.Date)5 Field (com.hortonworks.registries.common.Schema.Field)4 Set (java.util.Set)4 Schema (com.hortonworks.registries.common.Schema)3 PrimaryKey (com.hortonworks.registries.storage.PrimaryKey)3 EntitlementException (com.sun.identity.entitlement.EntitlementException)3 PolicyException (com.sun.identity.policy.PolicyException)3 JsonArray (io.vertx.core.json.JsonArray)3 List (java.util.List)3 SequenceFile (ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFile)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 SSOException (com.iplanet.sso.SSOException)2