Search in sources :

Example 1 with PreprocessorDTO

use of org.osgi.service.http.runtime.dto.PreprocessorDTO in project felix by apache.

the class WhiteboardManager method getRuntimeInfo.

public RegistryRuntime getRuntimeInfo() {
    final FailedDTOHolder failedDTOHolder = new FailedDTOHolder();
    final Collection<ServletContextDTO> contextDTOs = new ArrayList<>();
    // get sort list of context handlers
    final List<WhiteboardContextHandler> contextHandlerList = new ArrayList<>();
    synchronized (this.contextMap) {
        for (final List<WhiteboardContextHandler> list : this.contextMap.values()) {
            if (!list.isEmpty()) {
                contextHandlerList.add(list.get(0));
            }
        }
        this.failureStateHandler.getRuntimeInfo(failedDTOHolder);
    }
    Collections.sort(contextHandlerList);
    for (final WhiteboardContextHandler handler : contextHandlerList) {
        final ServletContextDTO scDTO = ServletContextDTOBuilder.build(handler.getContextInfo(), handler.getSharedContext(), -1);
        if (registry.getRuntimeInfo(scDTO, failedDTOHolder)) {
            contextDTOs.add(scDTO);
        }
    }
    final List<PreprocessorDTO> preprocessorDTOs = new ArrayList<>();
    final List<PreprocessorHandler> localHandlers = this.preprocessorHandlers;
    for (final PreprocessorHandler handler : localHandlers) {
        preprocessorDTOs.add(PreprocessorDTOBuilder.build(handler.getPreprocessorInfo(), -1));
    }
    return new RegistryRuntime(failedDTOHolder, contextDTOs, preprocessorDTOs);
}
Also used : FailedDTOHolder(org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder) ServletContextDTO(org.osgi.service.http.runtime.dto.ServletContextDTO) PreprocessorDTO(org.osgi.service.http.runtime.dto.PreprocessorDTO) PreprocessorHandler(org.apache.felix.http.base.internal.handler.PreprocessorHandler) ArrayList(java.util.ArrayList) RegistryRuntime(org.apache.felix.http.base.internal.runtime.dto.RegistryRuntime)

Example 2 with PreprocessorDTO

use of org.osgi.service.http.runtime.dto.PreprocessorDTO in project felix by apache.

the class PreprocessorDTOBuilder method build.

/**
 * Build a preprocessor DTO from a filter info
 * @param info The preprocessor info
 * @return A preprocessor DTO
 */
@Nonnull
public static PreprocessorDTO build(@Nonnull final PreprocessorInfo info, final int reason) {
    final PreprocessorDTO dto = (reason != -1 ? new FailedPreprocessorDTO() : new PreprocessorDTO());
    dto.initParams = info.getInitParameters();
    dto.serviceId = info.getServiceId();
    if (reason != -1) {
        ((FailedPreprocessorDTO) dto).failureReason = reason;
    }
    return dto;
}
Also used : PreprocessorDTO(org.osgi.service.http.runtime.dto.PreprocessorDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) FailedPreprocessorDTO(org.osgi.service.http.runtime.dto.FailedPreprocessorDTO) Nonnull(javax.annotation.Nonnull)

Aggregations

PreprocessorDTO (org.osgi.service.http.runtime.dto.PreprocessorDTO)2 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1 PreprocessorHandler (org.apache.felix.http.base.internal.handler.PreprocessorHandler)1 FailedDTOHolder (org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder)1 RegistryRuntime (org.apache.felix.http.base.internal.runtime.dto.RegistryRuntime)1 FailedPreprocessorDTO (org.osgi.service.http.runtime.dto.FailedPreprocessorDTO)1 ServletContextDTO (org.osgi.service.http.runtime.dto.ServletContextDTO)1