Package com.volantis.mcs.migrate.api.framework

Examples of com.volantis.mcs.migrate.api.framework.ResourceMigratorBuilder


        Version version2 = factory.createVersion("version 2");

        SimpleCLINotificationReporter notificationReporter =
                new SimpleCLINotificationReporter();

        ResourceMigratorBuilder builder =
                factory.createResourceMigratorBuilder(notificationReporter);

        builder.setTarget(version2);

        builder.startType("type");
        builder.setRegexpPathRecogniser(filename);
        builder.addRegexpContentRecogniser(version1, inputData);
        builder.addStep(version1, version2,
                new TestStreamMigrator(inputData, outputData));
        builder.endType();

        ResourceMigrator resourceMigrator = builder.getCompletedResourceMigrator();

        ByteArrayInputStream bais = new ByteArrayInputStream(
                inputData.getBytes());
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DefaultInputMetadata meta = new DefaultInputMetadata(filename, true);
View Full Code Here


        Version v35 = factory.createVersion("3.4");

        SimpleCLINotificationReporter notificationReporter =
                new SimpleCLINotificationReporter();

        ResourceMigratorBuilder builder =
                factory.createResourceMigratorBuilder(notificationReporter);

        builder.setTarget(v35);

        builder.startType("lpdm");
        builder.setRegexpPathRecogniser(".*mthm");
        builder.addRegexpContentRecogniser(v30,
                PolicySchemas.MARLIN_LPDM_V3_0.getLocationURL());
        builder.addRegexpContentRecogniser(v35,
                PolicySchemas.MARLIN_LPDM_2005_09.getLocationURL());
        XSLStreamMigratorBuilder xslBuilder =
                builder.createXSLStreamMigratorBuilder();
        xslBuilder.setXSL("../../config/lpdm/xsl/lpdm-v30-to-200509.xsl");
        builder.addStep(v30, v35, xslBuilder.getCompletedMigrator());
        builder.endType();

        /*ResourceMigrator migrator = */builder.getCompletedResourceMigrator();

    }
View Full Code Here

        Version repository200509 = factory.createVersion("repository 2005/09");
        Version repository200512 = factory.createVersion("repository 2005/12");
        Version repository200602 = factory.createVersion("repository 2006/02");

        ResourceMigratorBuilder builder =
                factory.createResourceMigratorBuilder(reporter);

        // ====================================================================
        //     Repository Migration
        // ====================================================================

        // Set the target version for the next type (YEUCH).
        // todo: add this inside the type, and validate to make sure that it is set properly.
        builder.setTarget(repository200602);

        builder.startType("repository");

        builder.setRegexpPathRecogniser(".*\\.(mthm|mimg|mlyt|mtxt|mlnk|" +
                "mrlv|mscr|mdyv|mcht|mbtn|mauc|mgrp)");

        // --------------------------------------------------------------------
        // Repository Versions
        // --------------------------------------------------------------------
        builder.addRegexpContentRecogniser(lpdm30,
                PolicySchemas.MARLIN_LPDM_V3_0.getNamespaceURL());

        builder.addRegexpContentRecogniser(rpdm27to30,
                "</remotePolicySetResponse>|</remotePolicyResponse>");

        // todo the namespace URLs may contain characters that have a special
        // todo meaning in a RE and they should really be quoted.
        builder.addRegexpContentRecogniser(repository200509,
                PolicySchemas.MARLIN_LPDM_2005_09.getNamespaceURL() + "|" +
                PolicySchemas.MARLIN_RPDM_2005_09.getNamespaceURL());

        builder.addRegexpContentRecogniser(repository200512,
                PolicySchemas.MARLIN_LPDM_2005_12.getNamespaceURL() + "|" +
                PolicySchemas.MARLIN_RPDM_2005_12.getNamespaceURL());

        builder.addRegexpContentRecogniser(repository200602,
                PolicySchemas.MARLIN_LPDM_2006_02.getNamespaceURL() + "|" +
                PolicySchemas.MARLIN_RPDM_2006_02.getNamespaceURL());

        XSLStreamMigratorBuilder xslBuilder;

        // --------------------------------------------------------------------
        // Step: LPDM 3.0 -> 2005/09
        // --------------------------------------------------------------------
        xslBuilder = builder.createXSLStreamMigratorBuilder();
        xslBuilder.setXSL(
                "/com/volantis/mcs/migrate/impl/config/lpdm/xsl/lpdm-v30-to-200509.xsl");

        xslBuilder.setStrictMode(strictMode);
        // Add the 3.0 LPDM schemas for input validation.
        xslBuilder.addInputSchema(PolicySchemas.MARLIN_LPDM_V3_0);

        // Add the 2005/09 LPDM schemas for output validation.
        xslBuilder.addOutputSchemata(PolicySchemas.REPOSITORY_2005_09);
        builder.addStep(lpdm30, repository200509, xslBuilder.getCompletedMigrator());

        // --------------------------------------------------------------------
        // Step: RPDM 2.7-3.0 -> 2005/09
        // --------------------------------------------------------------------
        xslBuilder = builder.createXSLStreamMigratorBuilder();
        xslBuilder.setXSL(
                "/com/volantis/mcs/migrate/impl/config/lpdm/xsl/rpdm-v30-to-200509.xsl");

        // Input DTDs are handled via the repository resolver.
        // TODO: handle rpdm DTDs explicitly.
        xslBuilder.addEntityResolver(createRepositoryEntityResolver());
        // Turn of strict mode because previous version of MCS allowed
        // garbage to de entered.
        xslBuilder.setStrictMode(false);

        // Add the 2005/12 RPDM schemas for output validation.
        xslBuilder.addOutputSchemata(PolicySchemas.REPOSITORY_2005_09);
        builder.addStep(rpdm27to30, repository200509, xslBuilder.getCompletedMigrator());

        // --------------------------------------------------------------------
        // Step: 2005/09 -> 2005/12
        // --------------------------------------------------------------------
        xslBuilder = builder.createXSLStreamMigratorBuilder();
        xslBuilder.setXSL(
                "/com/volantis/mcs/migrate/impl/config/lpdm/xsl/rpdm-200509-to-200512.xsl");

        xslBuilder.setStrictMode(strictMode);

        // Add schema for 2005/09
        xslBuilder.addInputSchemata(PolicySchemas.REPOSITORY_2005_09);
        // Add schema for 2005/12
        xslBuilder.addOutputSchemata(PolicySchemas.REPOSITORY_2005_12);
        builder.addStep(repository200509, repository200512,
                xslBuilder.getCompletedMigrator());

        // --------------------------------------------------------------------
        // Step: 2005/12 -> 2006/02
        // --------------------------------------------------------------------
        xslBuilder = builder.createXSLStreamMigratorBuilder();
        xslBuilder.setXSL(
                "/com/volantis/mcs/migrate/impl/config/lpdm/xsl/rpdm-200512-to-200602.xsl");
        xslBuilder.setStrictMode(strictMode);

        // Add schema for 2005/12
        xslBuilder.addInputSchemata(PolicySchemas.REPOSITORY_2005_12);

        // Add schema for 2006/02
        xslBuilder.addOutputSchemata(PolicySchemas.REPOSITORY_2006_02);
        builder.addStep(repository200512, repository200602,
                xslBuilder.getCompletedMigrator());

        builder.endType();

        return builder.getCompletedResourceMigrator();
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.migrate.api.framework.ResourceMigratorBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.