Build event attribute map map.

@param principal the principal
@param service   the service
@param provider  the provider
@return the map
165612
public static Map<String, Object> buildEventAttributeMap(final Principal principal,
                                                             final Optional<RegisteredService> service,
                                                             final MultifactorAuthenticationProvider provider) {
        val map = new HashMap<String, Object>();
        map.put(Principal.class.getName(), principal);
        service.ifPresent(svc -> map.put(RegisteredService.class.getName(), svc));
        map.put(MultifactorAuthenticationProvider.class.getName(), provider);
        return map;
    }
1059553
private static Principal getPrimaryPrincipal(final PrincipalElectionStrategy principalElectionStrategy,
                                                 final Set<Authentication> authentications,
                                                 final Map<String, List<Object>> principalAttributes) {
        return principalElectionStrategy.nominate(new LinkedHashSet<>(authentications), principalAttributes);
    }
816651
static <T,X extends T> T createProviderForClass(final PluggableService<T> service, final Class<X> cls) throws PluginException,
            ProviderCreationException {
        debug("Try loading provider " + cls.getName());
        if(!(service instanceof JavaClassProviderLoadable)){
            return null;
        }
        JavaClassProviderLoadable<T> loadable = (JavaClassProviderLoadable<T>) service;
        final Plugin annotation = getPluginMetadata(cls);

        final String pluginname = annotation.name();

        if (!loadable.isValidProviderClass(cls)) {
            throw new PluginException("Class " + cls.getName() + " was not a valid plugin class for service: " 
                    + service.getName() + ". Expected class " + cls.getName() + ", with a public constructor with no parameter");
        }
        debug("Succeeded loading plugin " + cls.getName() + " for service: " + service.getName());
        return loadable.createProviderInstance(cls, pluginname);
    }
1273490
public static IEventTrigger createEventTrigger(final EventType eventType, final AttributeImpl attribute)
            throws DevFailed {
        LOGGER.debug("create event trigger for attribute {} of type {}", attribute.getName(), eventType);
        final EventProperties props = attribute.getProperties().getEventProp();
        IEventTrigger eventTrigger;
        switch (eventType) {
            case PERIODIC_EVENT:
                final long period = Long.parseLong(props.per_event.period);
                eventTrigger = new PeriodicEventTrigger(period, attribute);
                break;
            case CHANGE_EVENT:
                eventTrigger = new ChangeEventTrigger(attribute, props.ch_event.abs_change, props.ch_event.rel_change);
                break;
            case ARCHIVE_EVENT:
                long periodA;
                try {
                    // Check if specified and a number
                    periodA = Long.parseLong(props.arch_event.period);
                } catch (final NumberFormatException e) {
                    periodA = -1;
                }
                eventTrigger = new ArchiveEventTrigger(periodA, props.arch_event.abs_change,
                        props.arch_event.rel_change, attribute);
                break;
            case ATT_CONF_EVENT:
            case DATA_READY_EVENT:
            case USER_EVENT:
            case INTERFACE_CHANGE_EVENT:
            case PIPE_EVENT:
            default:
                eventTrigger = new DefaultEventTrigger();
                break;

        }
        return eventTrigger;
    }
113638
public Map<String, AttributeValue> buildTableAttributeValuesMapFromService(final RegisteredService service) {
        val values = new HashMap<String, AttributeValue>();
        values.put(ColumnNames.ID.getColumnName(), new AttributeValue(String.valueOf(service.getId())));
        values.put(ColumnNames.NAME.getColumnName(), new AttributeValue(service.getName()));
        values.put(ColumnNames.DESCRIPTION.getColumnName(), new AttributeValue(service.getDescription()));
        values.put(ColumnNames.SERVICE_ID.getColumnName(), new AttributeValue(service.getServiceId()));
        val out = new ByteArrayOutputStream();
        jsonSerializer.to(out, service);
        values.put(ColumnNames.ENCODED.getColumnName(), new AttributeValue().withB(ByteBuffer.wrap(out.toByteArray())));
        LOGGER.debug("Created attribute values [{}] based on provided service [{}]", values, service);
        return values;
    }
234729
@Override
	public Tree generateListenerDescriptor(String service) {
		LinkedHashMap<String, Object> descriptor = new LinkedHashMap<>();
		readLock.lock();
		try {
			for (HashMap<String, Strategy<ListenerEndpoint>> groups : listeners.values()) {
				for (Strategy<ListenerEndpoint> strategy : groups.values()) {
					for (ListenerEndpoint endpoint : strategy.getAllEndpoints()) {
						if (endpoint.isLocal() && endpoint.serviceName.equals(service)) {
							LinkedHashMap<String, Object> map = new LinkedHashMap<>();
							descriptor.put(endpoint.subscribe, map);
							map.put("name", endpoint.subscribe);
							map.put("group", endpoint.group);
						}
					}
				}
			}
		} finally {
			readLock.unlock();
		}
		return new CheckedTree(descriptor);
	}
711371
protected void fireProviderConnectionEvent(IProvider provider, PipeConnectionEvent.EventType type, Map<String, Object> paramMap) {
        firePipeConnectionEvent(PipeConnectionEvent.build(this, type, provider, paramMap));
    }
327606
protected static Optional<URIBuilder.BasicNameValuePair> getEntityIdAsParameter(final Service service) {
        val builder = new URIBuilder(service.getId());
        return builder.getQueryParams()
            .stream()
            .filter(p -> p.getName().equals(SamlProtocolConstants.PARAMETER_ENTITY_ID))
            .findFirst();
    }
953764
@SneakyThrows
    @SuppressWarnings("unchecked")
    public static <T> Collection<T> newServiceInstances(final Class<T> service) {
        Collection<T> result = new LinkedList<>();
        if (null == SERVICE_MAP.get(service)) {
            return result;
        }
        for (Class<?> each : SERVICE_MAP.get(service)) {
            result.add((T) each.newInstance());
        }
        return result;
    }
890448
protected Map<String, List<Object>> returnFinalAttributesCollection(final Map<String, List<Object>> attributesToRelease, final RegisteredService service) {
        LOGGER.debug("Final collection of attributes allowed are: [{}]", attributesToRelease);
        return attributesToRelease;
    }
422150
protected String produceTicketIdentifier(final Service service, final TicketGrantingTicket ticketGrantingTicket,
                                             final boolean credentialProvided) {
        val uniqueTicketIdGenKey = service.getClass().getName();
        var serviceTicketUniqueTicketIdGenerator = (UniqueTicketIdGenerator) null;
        if (this.uniqueTicketIdGeneratorsForService != null && !this.uniqueTicketIdGeneratorsForService.isEmpty()) {
            LOGGER.debug("Looking up service ticket id generator for [{}]", uniqueTicketIdGenKey);
            serviceTicketUniqueTicketIdGenerator = this.uniqueTicketIdGeneratorsForService.get(uniqueTicketIdGenKey);
        }
        if (serviceTicketUniqueTicketIdGenerator == null) {
            serviceTicketUniqueTicketIdGenerator = this.defaultServiceTicketIdGenerator;
            LOGGER.debug("Service ticket id generator not found for [{}]. Using the default generator.", uniqueTicketIdGenKey);
        }

        return serviceTicketUniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX);
    }
1069038
public static Map<String, TraceEvent> tocManagedConnections(List<TraceEvent> data) throws Exception
   {
      Map<String, TraceEvent> result = new TreeMap<String, TraceEvent>();

      for (TraceEvent te : data)
      {
         if (te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_GET ||
             te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_PREFILL ||
             te.getType() == TraceEvent.CREATE_CONNECTION_LISTENER_INCREMENTER)
         {
            result.put(te.getPayload1(), te);
         }
      }

      return result;
   }
1210319
@SuppressWarnings("unchecked")
    @Override
    public final PipelineEventReader<R, E> getEventReader(
            HttpServletRequest request, HttpServletResponse response) {
        if (Included.PLAIN == this.resourcesElementsProvider.getDefaultIncludedType()) {
            this.logger.trace(
                    "{} - Resoure Aggregation Disabled, ignoring event cache and returning parent event reader directly",
                    this.beanName);
            return this.wrappedComponent.getEventReader(request, response);
        }

        // Get the key for this request from the target component and see if there is a cache entry
        final CacheKey cacheKey = this.wrappedComponent.getCacheKey(request, response);
        Element element = this.cache.get(cacheKey);
        CachedEventReader<E> cachedEventReader = null;
        if (element != null) {
            cachedEventReader = (CachedEventReader<E>) element.getObjectValue();
        }

        // If there was a cached reader return it immediately
        if (cachedEventReader == null) {
            // No cached data for key, call target component to get events and an updated cache key
            logger.debug(
                    "{} - No cached events found for key {}, calling parent",
                    this.beanName,
                    cacheKey);
            final PipelineEventReader<R, E> pipelineEventReader =
                    this.wrappedComponent.getEventReader(request, response);

            // Copy the events from the reader into a buffer to be cached
            final List<E> eventCache = new LinkedList<E>();
            for (final E event : pipelineEventReader) {
                // TODO add de-duplication logic here
                eventCache.add(event);
            }

            final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
            cachedEventReader =
                    new CachedEventReader<E>(
                            eventCache, new LinkedHashMap<String, String>(outputProperties));

            // Cache the buffer
            element = new Element(cacheKey, cachedEventReader);
            this.cache.put(element);
            logger.debug(
                    "{} - Cached {} events for key {}", this.beanName, eventCache.size(), cacheKey);
        } else {
            logger.debug("{} - Found cached events for key {}", this.beanName, cacheKey);
        }

        final List<E> eventCache = cachedEventReader.getEventCache();
        final Map<String, String> outputProperties = cachedEventReader.getOutputProperties();

        final R eventReader = this.createEventReader(eventCache.listIterator());
        return new PipelineEventReaderImpl<R, E>(eventReader, outputProperties);
    }
498282
@SuppressWarnings({ "unchecked", "rawtypes" })
    public Map<String, String> getAttributes() {
        return (Map) this.get(CloudTrailEventField.attributes.name());
    }
404175
public ServerBuilder service(PathMapping pathMapping, Service<HttpRequest, HttpResponse> service) {
        defaultVirtualHostBuilderUpdated();
        defaultVirtualHostBuilder.service(pathMapping, service);
        return this;
    }
999122
private Map<String, String> buildEventMap() {

    Map<String, String> eventMetadataMap = Maps.newHashMap();
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.DATASET_URN_KEY), datasetUrn);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.PARTITION_KEY), partition);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.ORIGIN_TS_IN_MILLI_SECS_KEY), originTimestamp);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.UPSTREAM_TS_IN_MILLI_SECS_KEY), upstreamTimestamp);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.COMPLETENESS_PERCENTAGE_KEY), completenessPercentage);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.RECORD_COUNT_KEY), recordCount);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY), previousPublishTimestamp);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.DEDUPE_STATUS_KEY), dedupeStatus);
    eventMetadataMap.put(withoutPropertiesPrefix(SlaEventKeys.IS_FIRST_PUBLISH), isFirstPublish);

    if (additionalMetadata != null) {
      eventMetadataMap.putAll(additionalMetadata);
    }
    return Maps.newHashMap(Maps.filterValues(eventMetadataMap, NOT_NULL_OR_EMPTY_PREDICATE));
  }
335968
public final static PipeConnectionEvent build(AbstractPipe source, EventType type, IProvider provider, Map<String, Object> paramMap) {
        return new PipeConnectionEvent(source, type, provider, paramMap);
    }