public ProcessorConfigurationImpl()

in src/main/java/org/apache/sling/rewriter/impl/ProcessorConfigurationImpl.java [167:204]


    public ProcessorConfigurationImpl(final Resource resource) {
        this.name = resource.getName();
        final ValueMap properties = ResourceUtil.getValueMap(resource);
        this.contentTypes = properties.get(PROPERTY_CONTENT_TYPES, String[].class);
        this.resourceTypes = properties.get(PROPERTY_RESOURCE_TYPES, String[].class);
        this.unwrapResources = properties.get(PROPERTY_UNWRAP_RESOURCES, false);
        this.selectors = properties.get(PROPERTY_SELECTORS, String[].class);
        this.paths = properties.get(PROPERTY_PATHS, String[].class);
        this.extensions = properties.get(PROPERTY_EXTENSIONS, String[].class);

        this.processorConfig = this.getComponentConfig(resource, PROPERTY_PROCESSOR_TYPE, "processor");
        this.generatorConfiguration = this.getComponentConfig(resource, PROPERTY_GENERATOR, "generator");
        this.transformerConfigurations = this.getComponentConfigs(resource, PROPERTY_TRANFORMERS, "transformer");
        this.serializerConfiguration = this.getComponentConfig(resource, PROPERTY_SERIALIZER, "serializer");

        this.order = properties.get(PROPERTY_ORDER, 0);
        this.isActive = properties.get(PROPERTY_ACTIVE, true);
        this.processErrorResponse = properties.get(PROPERTY_PROCESS_ERROR, true);
        this.isPipeline = this.processorConfig == null;

        // let's do a sanity check!
        if ( this.isPipeline ) {
            if ( this.generatorConfiguration == null
                 || this.generatorConfiguration.getType() == null
                 || this.generatorConfiguration.getType().length() == 0 ) {
                this.isValid = false;
            } else if ( this.serializerConfiguration == null
                        || this.generatorConfiguration.getType() == null
                        || this.generatorConfiguration.getType().length() == 0 ) {
                this.isValid = false;
            } else {
                this.isValid = true;
            }
        } else {
            this.isValid = (this.processorConfig != null);
        }
        this.descString = this.buildDescString();
    }