Package com.volantis.mcs.migrate.impl.framework.identification

Examples of com.volantis.mcs.migrate.impl.framework.identification.Step


        type.setPathRecogniser(new RegexpPathRecogniser(filename));
        type.addContentIdentifier(
                new DefaultContentIdentifier(version1,
                        new RegexpContentRecogniser(inputData)));
        DefaultGraph graph = new DefaultGraph(version2);
        Step step = new DefaultStep(version1, version2,
                new TestStreamMigrator(inputData, outputData));
        graph.addStep(step);
        type.setGraph(graph);
        resourceRecogniser.addType(type);
        DefaultResourceMigrator resourceMigrator =
View Full Code Here


            // Type of validation to be performed by each step
            StepType stepType = null;

            while (steps.hasNext()) {
                final Step step = (Step) steps.next();

                if (logger.isDebugEnabled()) {
                    logger.debug("Invoking migration step :"+step);
                }

                // Calculate the input stream for this step.
                // If we have a previous output, then that must be the
                // input for this step, otherwise use the original
                // input.
                if (buffer != null) {
                    stepInput = buffer.getInput();
                } else {
                    stepInput = inputStream;
                }
                // Calculate the output stream for this step.
                // If we have another step to process, then we must
                // buffer the output of the step, otherwise use the
                // original output.
                if (steps.hasNext()) {
                    buffer = streamBufferFactory.create();
                    stepOutput = buffer.getOutput();
                } else {
                    stepOutput = outputCreator.createOutputStream();
                }

                // Workout which step this is
                stepType = getCurrentStepType(stepType, steps);

                // Do the migration.
                Exception firstException = null;
                try {
                    step.migrate(stepInput, stepOutput, stepType);
                } catch (ResourceMigrationException e) {
                    firstException = e;
                } finally {
                    try {
                        stepInput.close();
View Full Code Here

        List path = new ArrayList();

        // Loop around over the steps until no more steps can be added or the
        // path from the specified version to the target version is complete.
        Version inputVersion = version;
        Step addedStep;
        do {
            Version nextVersion = null;
            addedStep = null;
            for (Iterator i = steps.iterator(); i.hasNext();) {
                Step step = (Step) i.next();
                if (step.getInput() == inputVersion) {
                    if (addedStep != null) {
                        throw new IllegalStateException("Multiple steps from " +
                                inputVersion + ", " + addedStep +
                                " and " + step);
                    } else {
                        path.add(step);
                        nextVersion = step.getOutput();
                        addedStep = step;
                    }
                }
            }

            inputVersion = nextVersion;
        }
        while (addedStep != null && inputVersion != targetVersion);

        if (path.size() == 0) {
            throw new IllegalStateException(
                    "version requested not present in graph");
        }

        // Ensure the sequence ends with the target version.
        Step finalStep = (Step) path.get(path.size() - 1);
        if (finalStep.getOutput() != targetVersion) {
            throw new IllegalStateException("Step sequence ends with " +
                    finalStep.getOutput() + " instead of target " +
                    targetVersion);
        }

//        if (logger.isDebugEnabled()) {
//            for (int i = 0; i < path.size(); i++) {
View Full Code Here

TOP

Related Classes of com.volantis.mcs.migrate.impl.framework.identification.Step

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.