Search in sources :

Example 81 with JsonIgnore

use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class PageListItemImpl method getTeaserResource.

@Override
@JsonIgnore
public Resource getTeaserResource() {
    if (teaserResource == null && component != null) {
        String delegateResourceType = component.getProperties().get(PN_TEASER_DELEGATE, String.class);
        if (StringUtils.isEmpty(delegateResourceType)) {
            LOGGER.error("In order for list rendering delegation to work correctly you need to set up the teaserDelegate property on" + " the {} component; its value has to point to the resource type of a teaser component.", component.getPath());
        } else {
            Resource resourceToBeWrapped = ComponentUtils.getFeaturedImage(page);
            if (resourceToBeWrapped != null) {
                // use the page featured image and inherit properties from the page item
                overriddenProperties.put(JcrConstants.JCR_TITLE, this.getTitle());
                if (showDescription) {
                    overriddenProperties.put(JcrConstants.JCR_DESCRIPTION, this.getDescription());
                }
                if (linkItems) {
                    overriddenProperties.put(ImageResource.PN_LINK_URL, this.getPath());
                }
            } else {
                // use the page content node and inherit properties from the page item
                resourceToBeWrapped = page.getContentResource();
                if (resourceToBeWrapped == null) {
                    return null;
                }
                if (!showDescription) {
                    hiddenProperties.add(JcrConstants.JCR_DESCRIPTION);
                }
                if (linkItems) {
                    overriddenProperties.put(ImageResource.PN_LINK_URL, this.getPath());
                }
            }
            teaserResource = new CoreResourceWrapper(resourceToBeWrapped, delegateResourceType, hiddenProperties, overriddenProperties);
        }
    }
    return teaserResource;
}
Also used : Resource(org.apache.sling.api.resource.Resource) ImageResource(com.day.cq.commons.ImageResource) CoreResourceWrapper(com.adobe.cq.wcm.core.components.internal.resource.CoreResourceWrapper) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 82 with JsonIgnore

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

the class TenantObject method addTrustAnchor.

/**
 * Adds a trusted certificate authority to use for authenticating devices of this tenant.
 *
 * @param publicKey The CA's public key in encoded form.
 * @param publicKeyAlgorithm The algorithm of the public key.
 * @param subjectDn The CA's subject DN.
 * @param authIdTemplate The template to generate the authentication identifier.
 * @param autoProvisioningEnabled A flag indicating whether this CA may be used for automatic provisioning.
 * @return This tenant for command chaining.
 * @throws NullPointerException if the public key, algorithm or subjectDN parameters is {@code null}.
 */
@JsonIgnore
public TenantObject addTrustAnchor(final byte[] publicKey, final String publicKeyAlgorithm, final X500Principal subjectDn, final String authIdTemplate, final Boolean autoProvisioningEnabled) {
    Objects.requireNonNull(publicKey);
    Objects.requireNonNull(publicKeyAlgorithm);
    Objects.requireNonNull(subjectDn);
    final JsonObject trustedCa = new JsonObject();
    trustedCa.put(TenantConstants.FIELD_PAYLOAD_SUBJECT_DN, subjectDn.getName(X500Principal.RFC2253));
    trustedCa.put(TenantConstants.FIELD_PAYLOAD_PUBLIC_KEY, publicKey);
    trustedCa.put(TenantConstants.FIELD_PAYLOAD_KEY_ALGORITHM, publicKeyAlgorithm);
    trustedCa.put(TenantConstants.FIELD_AUTO_PROVISIONING_ENABLED, autoProvisioningEnabled);
    Optional.ofNullable(authIdTemplate).ifPresent(t -> trustedCa.put(TenantConstants.FIELD_PAYLOAD_AUTH_ID_TEMPLATE, t));
    final JsonArray cas = getProperty(TenantConstants.FIELD_PAYLOAD_TRUSTED_CA, JsonArray.class, new JsonArray());
    trustAnchors = null;
    return setProperty(TenantConstants.FIELD_PAYLOAD_TRUSTED_CA, cas.add(trustedCa));
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonObject(io.vertx.core.json.JsonObject) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 83 with JsonIgnore

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

the class TenantObject method getTrustAnchorForPublicKey.

@JsonIgnore
private TrustAnchor getTrustAnchorForPublicKey(final JsonObject keyProps) {
    if (keyProps == null) {
        return null;
    } else {
        final String subjectDn = getProperty(keyProps, RequestResponseApiConstants.FIELD_PAYLOAD_SUBJECT_DN, String.class);
        if (subjectDn == null) {
            LOG.debug("trust anchor definition does not contain required property {}", RequestResponseApiConstants.FIELD_PAYLOAD_SUBJECT_DN);
            return null;
        }
        final byte[] encodedKey = getProperty(keyProps, TenantConstants.FIELD_PAYLOAD_PUBLIC_KEY, byte[].class);
        if (encodedKey == null) {
            LOG.debug("trust anchor definition does not contain required property {}", TenantConstants.FIELD_PAYLOAD_PUBLIC_KEY);
            return null;
        }
        try {
            final String type = getProperty(keyProps, TenantConstants.FIELD_PAYLOAD_KEY_ALGORITHM, String.class, "RSA");
            final X509EncodedKeySpec keySpec = new X509EncodedKeySpec(encodedKey);
            final KeyFactory factory = KeyFactory.getInstance(type);
            final PublicKey publicKey = factory.generatePublic(keySpec);
            return new TrustAnchor(subjectDn, publicKey, null);
        } catch (final GeneralSecurityException e) {
            LOG.debug("failed to instantiate trust anchor's public key", e);
            return null;
        }
    }
}
Also used : PublicKey(java.security.PublicKey) GeneralSecurityException(java.security.GeneralSecurityException) X509EncodedKeySpec(java.security.spec.X509EncodedKeySpec) TrustAnchor(java.security.cert.TrustAnchor) KeyFactory(java.security.KeyFactory) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 84 with JsonIgnore

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

the class CredentialsObject method getSecrets.

/**
 * Gets this credentials' secret(s).
 * <p>
 * The elements of the returned list are of type {@code JsonObject}.
 *
 * @return The (potentially empty) list of secrets.
 */
@JsonIgnore
public JsonArray getSecrets() {
    return Optional.ofNullable(getProperty(CredentialsConstants.FIELD_SECRETS, JsonArray.class)).orElseGet(() -> {
        final JsonArray result = new JsonArray();
        setProperty(CredentialsConstants.FIELD_SECRETS, result);
        return result;
    });
}
Also used : JsonArray(io.vertx.core.json.JsonArray) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 85 with JsonIgnore

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

the class PigJob method setJobStats.

@JsonIgnore
public void setJobStats(JobStats stats) {
    this.inputInfoList = inputInfoList(stats.getInputs());
    this.outputInfoList = outputInfoList(stats.getOutputs());
    // job metrics
    Map<String, Number> metrics = Maps.newHashMap();
    metrics.put("hdfsBytesRead", stats.getHdfsBytesRead());
    metrics.put("hdfsBytesWritten", stats.getHdfsBytesWritten());
    metrics.put("bytesWritten", stats.getBytesWritten());
    metrics.put("recordWritten", stats.getRecordWrittern());
    if (stats instanceof MRJobStats) {
        MRJobStats mrStats = (MRJobStats) stats;
        setCounterGroupMap(CounterGroup.counterGroupsByName(mrStats.getHadoopCounters()));
        metrics.put("avgMapTime", mrStats.getAvgMapTime());
        // internal pig seems to have fixed typo in OSS pig method name; avoid NoSuchMethodException
        // TODO: Remove this once internal pig is replaced w/ OSS pig
        Number avgReduceTime = null;
        try {
            Method method = mrStats.getClass().getMethod("getAvgReduceTime");
            avgReduceTime = (Number) method.invoke(mrStats);
        } catch (NoSuchMethodException e) {
        // assume we're dealing with OSS pig; ignore
        } catch (InvocationTargetException e) {
            throw new RuntimeException("Failed to invoke MRJobStats.getAvgReduceTime", e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Failed to invoke MRJobStats.getAvgReduceTime", e);
        }
        if (avgReduceTime == null) {
            avgReduceTime = mrStats.getAvgREduceTime();
        }
        metrics.put("avgReduceTime", avgReduceTime);
        metrics.put("mapInputRecords", mrStats.getMapInputRecords());
        metrics.put("mapOutputRecords", mrStats.getMapOutputRecords());
        metrics.put("maxMapTime", mrStats.getMaxMapTime());
        metrics.put("maxReduceTime", mrStats.getMaxReduceTime());
        metrics.put("minMapTime", mrStats.getMinMapTime());
        metrics.put("minReduceTime", mrStats.getMinReduceTime());
        metrics.put("numberMaps", mrStats.getNumberMaps());
        metrics.put("numberReduces", mrStats.getNumberReduces());
        metrics.put("proactiveSpillCountObjects", mrStats.getProactiveSpillCountObjects());
        metrics.put("proactiveSpillCountRecs", mrStats.getProactiveSpillCountRecs());
        metrics.put("reduceInputRecords", mrStats.getReduceInputRecords());
        metrics.put("reduceOutputRecords", mrStats.getReduceOutputRecords());
        metrics.put("SMMSpillCount", mrStats.getSMMSpillCount());
    }
    setMetrics(metrics);
}
Also used : MRJobStats(org.apache.pig.tools.pigstats.mapreduce.MRJobStats) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)113 lombok.val (lombok.val)14 ArrayList (java.util.ArrayList)12 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 TrustAndKeyProvider (com.codingchili.core.security.TrustAndKeyProvider)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2