All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.granite.crx2oak.profile.ProfileComponent Maven / Gradle / Ivy

The newest version!
/*************************************************************************
 * ADOBE CONFIDENTIAL
 * ___________________
 *
 * Copyright 2016 Adobe
 * All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains
 * the property of Adobe and its suppliers, if any. The intellectual
 * and technical concepts contained herein are proprietary to Adobe
 * and its suppliers and are protected by all applicable intellectual
 * property laws, including trade secret and copyright laws.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe.
 **************************************************************************/
package com.adobe.granite.crx2oak.profile;

import com.adobe.granite.crx2oak.cli.transformer.CommandLineTransformerEngine;
import com.adobe.granite.crx2oak.profile.merge.AdditiveProfileMerger;
import com.adobe.granite.crx2oak.profile.normalize.TagsDefinitionCleaner;
import com.adobe.granite.crx2oak.profile.parse.ProfileParserFactory;
import com.adobe.granite.crx2oak.profile.process.TagProfileProcessor;
import com.adobe.granite.crx2oak.profile.read.ClasspathProfileReader;
import com.adobe.granite.crx2oak.profile.read.FilesystemProfileReader;
import com.adobe.granite.crx2oak.profile.read.MaterializedCommandLineReader;
import com.adobe.granite.crx2oak.profile.save.FilesystemProfileWriter;
import com.adobe.granite.crx2oak.profile.tags.CRX2DataStoreTagProvider;
import com.adobe.granite.crx2oak.profile.tags.CommandLineTagHandler;
import com.adobe.granite.crx2oak.profile.tags.OakFileDataStoreTagProvider;
import joptsimple.OptionParser;

import static com.google.common.collect.ImmutableList.of;

public class ProfileComponent {

    public static ProfileMainProcessor create(final CommandLineTransformerEngine commandLineTransformerEngine,
                                               final OptionParser parser,
                                               final CommandLineTagHandler commandLineTagHandler) {
        final MaterializedCommandLineReader materializedCommandLineReader = new MaterializedCommandLineReader();
        final ProfileParserFactory profileParserFactory = new ProfileParserFactory(parser);
        return new ProfileMainProcessor(
                new ProfileLoader(
                        new FilesystemProfileReader(materializedCommandLineReader),
                        profileParserFactory,
                        new ClasspathProfileReader(materializedCommandLineReader)
                ),
                new ProfileChainMerger(
                        new AdditiveProfileMerger(commandLineTransformerEngine),
                        profileParserFactory
                ),
                new ProfileHandler(
                        profileParserFactory,
                        new FilesystemProfileWriter(),
                        new TagProfileProcessor(commandLineTransformerEngine),
                        of(
                                new CRX2DataStoreTagProvider(),
                                new OakFileDataStoreTagProvider(),
                                commandLineTagHandler
                        ),
                        new TagsDefinitionCleaner(commandLineTransformerEngine, profileParserFactory)
                )
        );
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy