├── .github
└── workflows
│ └── maven.yml
├── .gitignore
├── LICENSE.txt
├── README.md
├── pom.xml
├── src
└── assembly
│ └── assembly.xml
├── upgrade-framework-core
├── instructions.bnd
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ ├── PersistenceContext.java
│ │ ├── Task.java
│ │ ├── UpgradeContext.java
│ │ ├── UpgradeDefinition.java
│ │ ├── context
│ │ ├── PersistenceContextHelper.java
│ │ ├── PersistenceContextReference.java
│ │ └── package-info.java
│ │ ├── factory
│ │ ├── CompositeUpgradeDefinitionFactory.java
│ │ ├── GraphUpgradeDefinitionFactory.java
│ │ ├── UpgradeDefinitionFactory.java
│ │ └── package-info.java
│ │ ├── logging
│ │ ├── Log4jLoggerImpl.java
│ │ ├── LogLevel.java
│ │ ├── Logger.java
│ │ ├── SecurityLevel.java
│ │ ├── UpgradeLogger.java
│ │ ├── UpgradeLoggerHelper.java
│ │ ├── UpgradeLoggerImpl.java
│ │ └── package-info.java
│ │ ├── package-info.java
│ │ ├── progress
│ │ ├── ExecutionState.java
│ │ ├── ExecutionStateAggregator.java
│ │ ├── ProgressReport.java
│ │ ├── ProgressReporter.java
│ │ ├── impl
│ │ │ ├── AbstractProgressReporter.java
│ │ │ ├── DefaultExecutionStateAggregator.java
│ │ │ ├── ImmutableProgressReport.java
│ │ │ ├── SimpleAggregatingProgressReporter.java
│ │ │ ├── SimpleProgressReporter.java
│ │ │ └── package-info.java
│ │ └── package-info.java
│ │ ├── sequencing
│ │ ├── AbstractGraph.java
│ │ ├── Graph.java
│ │ ├── GraphHelper.java
│ │ ├── Version.java
│ │ └── package-info.java
│ │ ├── task
│ │ ├── AbstractAggregateTask.java
│ │ ├── AbstractDelegatingTask.java
│ │ ├── AbstractSimpleTask.java
│ │ ├── AbstractTask.java
│ │ ├── ParallelAggregateTask.java
│ │ ├── SerialAggregateTask.java
│ │ ├── TrivialTask.java
│ │ └── package-info.java
│ │ └── transformation
│ │ ├── ReferenceTransformation.java
│ │ └── Transformation.java
│ └── test
│ ├── java
│ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ ├── DummyUpgradeContext.java
│ │ ├── TestGroups.java
│ │ ├── WorkflowTest.java
│ │ ├── context
│ │ └── PersistenceContextHelperTest.java
│ │ ├── factory
│ │ └── GraphUpgradeDefinitionFactoryTest.java
│ │ ├── progress
│ │ ├── DefaultExecutionStateAggregatorTest.java
│ │ └── ProgressReportingTest.java
│ │ ├── sequencing
│ │ └── VersionTest.java
│ │ └── task
│ │ ├── AbstractDelegatingTaskTest.java
│ │ ├── TaskAggregationTest.java
│ │ ├── TaskTestUtil.java
│ │ └── TrivialTaskTest.java
│ └── resources
│ └── testng.xml
├── upgrade-framework-distribution
└── pom.xml
├── upgrade-framework-dsl
├── instructions.bnd
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ └── dsl
│ │ ├── Loader.groovy
│ │ ├── Processor.java
│ │ ├── TaskResolver.java
│ │ ├── model
│ │ ├── ManifestModel.groovy
│ │ ├── NamespaceModel.groovy
│ │ ├── UpgradeDefinitionModel.groovy
│ │ ├── UpgradeTaskModel.groovy
│ │ └── package-info.java
│ │ ├── package-info.java
│ │ ├── syntax
│ │ ├── ManifestSyntax.groovy
│ │ ├── NamespaceSyntax.groovy
│ │ ├── ScriptSyntax.groovy
│ │ ├── UnknownKeywordWrapper.groovy
│ │ ├── UpgradeCompilationException.groovy
│ │ ├── UpgradeDefinitionSyntax.groovy
│ │ └── package-info.java
│ │ └── util
│ │ ├── AggregateProcessor.java
│ │ ├── BasicTaskResolver.groovy
│ │ ├── FinalVariableBinding.java
│ │ ├── NoopProcessor.java
│ │ ├── NoopTaskResolver.java
│ │ └── package-info.java
│ └── test
│ ├── java
│ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ └── dsl
│ │ ├── LoaderTest.groovy
│ │ ├── ManifestLoader.groovy
│ │ ├── syntax
│ │ ├── BadSyntaxTest.java
│ │ ├── FromToKeywordTest.java
│ │ ├── NamespaceKeywordTest.java
│ │ ├── RequiredKeywordProcessor.groovy
│ │ ├── ResourceInclusionTest.groovy
│ │ └── VersionKeywordTest.groovy
│ │ └── util
│ │ └── UpgradeLoader.groovy
│ └── resources
│ ├── testng.xml
│ └── upgrade
│ └── nullManifest.groovy
├── upgrade-framework-sql-dsl
├── instructions.bnd
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ └── dsl
│ │ └── sql
│ │ ├── model
│ │ ├── CommentModel.groovy
│ │ ├── ConstraintModel.groovy
│ │ ├── IndexModel.groovy
│ │ ├── ReferenceModel.groovy
│ │ ├── SQLStatementProxy.groovy
│ │ ├── TableAlterationModel.groovy
│ │ ├── TableCreationModel.groovy
│ │ ├── TransformingModel.groovy
│ │ ├── UnindexModel.groovy
│ │ ├── UnreferenceModel.groovy
│ │ ├── defaults
│ │ │ ├── DefaultCommentModel.groovy
│ │ │ ├── DefaultDropViewModel.groovy
│ │ │ ├── DefaultIndexModel.groovy
│ │ │ ├── DefaultReferenceModel.groovy
│ │ │ ├── DefaultSQLStatementProxy.groovy
│ │ │ ├── DefaultTableAlterationModel.groovy
│ │ │ ├── DefaultTableCreationModel.groovy
│ │ │ ├── DefaultUnindexModel.groovy
│ │ │ └── DefaultUnreferenceModel.groovy
│ │ ├── package-info.java
│ │ └── safe
│ │ │ ├── SafeCommentModel.groovy
│ │ │ ├── SafeDropViewModel.groovy
│ │ │ ├── SafeIndexModel.groovy
│ │ │ ├── SafeReferenceModel.groovy
│ │ │ ├── SafeSQLStatementProxy.groovy
│ │ │ ├── SafeSQLStatementWrapper.groovy
│ │ │ ├── SafeTableAlterationModel.groovy
│ │ │ ├── SafeTableCreationModel.groovy
│ │ │ ├── SafeUnindexModel.groovy
│ │ │ └── SafeUnreferenceModel.groovy
│ │ ├── package-info.java
│ │ ├── syntax
│ │ ├── ColumnType.groovy
│ │ ├── CommentSyntax.groovy
│ │ ├── Constraints.groovy
│ │ ├── DataType.java
│ │ ├── IndexSyntax.groovy
│ │ ├── ReferenceSyntax.groovy
│ │ ├── TableAlterationSyntax.groovy
│ │ ├── TableCreationColumnSyntax.groovy
│ │ ├── TableCreationSyntax.groovy
│ │ ├── UnindexSyntax.groovy
│ │ ├── UnreferenceSyntax.groovy
│ │ └── package-info.java
│ │ └── util
│ │ ├── AgnosticSqlProcessor.groovy
│ │ ├── BasicSqlProcessor.groovy
│ │ ├── ClassUtil.groovy
│ │ ├── ColumnTypeSyntaxUtil.groovy
│ │ ├── ConstraintNameUtil.groovy
│ │ ├── DefaultAware.java
│ │ ├── HasClosureMap.java
│ │ ├── InitialAware.java
│ │ ├── NullAware.java
│ │ ├── ReservedKeywords.groovy
│ │ ├── SQLStatementFactory.java
│ │ ├── SqlTaskResolver.groovy
│ │ ├── TransformingModelTaskResolver.groovy
│ │ └── ValidationUtil.groovy
│ └── test
│ ├── java
│ └── com
│ │ └── vmware
│ │ └── upgrade
│ │ └── dsl
│ │ └── sql
│ │ ├── semantics
│ │ ├── AlterSemanticsTest.java
│ │ ├── CommentSemanticsTest.java
│ │ ├── CreateSemanticsTest.java
│ │ ├── DropViewSemanticsTest.java
│ │ ├── IndexSemanticsTest.java
│ │ ├── ReferenceSemanticsTest.java
│ │ ├── SafeSemanticsTest.java
│ │ └── SemanticTestUtil.java
│ │ ├── syntax
│ │ ├── AlterSyntaxTest.java
│ │ ├── CommentSyntaxTest.java
│ │ ├── CreateSyntaxTest.java
│ │ ├── DropViewSyntaxTest.java
│ │ ├── IndexSyntaxTest.java
│ │ ├── ReferenceSyntaxTest.java
│ │ ├── SafeSyntaxTest.java
│ │ └── SyntaxTestUtil.groovy
│ │ └── util
│ │ ├── ClassUtilTest.java
│ │ ├── ConstraintNameUtilTest.java
│ │ ├── DefaultTestProcessor.groovy
│ │ └── UpgradeLoader.groovy
│ └── resources
│ └── testng.xml
└── upgrade-framework-sql
├── instructions.bnd
├── pom.xml
└── src
├── main
└── java
│ └── com
│ └── vmware
│ └── upgrade
│ └── sql
│ ├── DatabasePersistenceContext.java
│ ├── DatabaseType.java
│ ├── SQLStatement.java
│ ├── package-info.java
│ ├── script
│ ├── SQLParsedDataAggregator.java
│ ├── TaskAggregator.java
│ └── package-info.java
│ └── task
│ ├── RawSQLTask.java
│ ├── ScriptTask.java
│ ├── TransactionTask.java
│ └── package-info.java
└── test
├── java
└── com
│ └── vmware
│ └── upgrade
│ └── sql
│ └── task
│ └── TransactionTaskTest.java
└── resources
└── testng.xml
/.github/workflows/maven.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3 |
4 | name: Java CI with Maven
5 |
6 | on:
7 | push:
8 | branches: [ "master" ]
9 | pull_request:
10 | branches: [ "master" ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v3
19 | - name: Set up JDK 11
20 | uses: actions/setup-java@v3
21 | with:
22 | java-version: '11'
23 | distribution: 'temurin'
24 | cache: maven
25 | - name: Build with Maven
26 | run: mvn -B install --file pom.xml
27 |
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # System specific files
2 | *~
3 | ._.*
4 | .DS_Store
5 |
6 | # Eclipse files and directories
7 | .classpath
8 | .project
9 | .settings/
10 |
11 | # IntelliJ IDEA project stuff
12 | *.iml
13 | *.ipr
14 | *.iws
15 |
16 | # Visual Studio Code
17 | .vscode/
18 |
19 | # Directories created during the build process
20 | target/
21 | test-output/
22 | build/
23 |
24 | # Auto-generated OSGI manifests
25 | META-INF/
26 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Data Persistence Upgrade Framework for Java 1.0
2 | Copyright (c) 2008-2018 VMware, Inc.
3 | All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 | of the Software, and to permit persons to whom the Software is furnished to do
10 | so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/upgrade-framework-core/instructions.bnd:
--------------------------------------------------------------------------------
1 | Bundle-SymbolicName: com.vmware.upgrade
2 | Bundle-RequiredExecutionEnvironment: JavaSE-11
3 | Export-Package: *
4 | Import-Package: *
5 |
--------------------------------------------------------------------------------
/upgrade-framework-core/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | 4.0.0
7 | upgrade-framework-core
8 |
9 | upgrade-framework-core - Core Upgrade Framework
10 | Library which provides core upgrade logic.
11 |
12 | jar
13 |
14 |
15 | com.vmware.vcloud
16 | upgrade-framework-parent
17 | 2.0.0
18 | ../pom.xml
19 |
20 |
21 |
22 |
23 | org.apache.commons
24 | commons-lang3
25 |
26 |
27 |
28 | commons-math
29 | commons-math
30 |
31 |
32 |
33 | commons-collections
34 | commons-collections
35 | test
36 |
37 |
38 |
39 | ch.qos.reload4j
40 | reload4j
41 |
42 |
43 |
44 | com.fasterxml.jackson.core
45 | jackson-core
46 |
47 |
48 |
49 | com.fasterxml.jackson.core
50 | jackson-annotations
51 |
52 |
53 |
54 | com.fasterxml.jackson.core
55 | jackson-databind
56 |
57 |
58 |
59 | org.eclipse.osgi
60 | org.eclipse.osgi
61 |
62 |
63 |
64 |
65 |
66 |
67 | maven-compiler-plugin
68 |
69 | javac
70 |
71 |
72 |
73 |
74 |
75 | true
76 |
77 |
78 |
79 |
80 | org.apache.maven.plugins
81 | maven-jar-plugin
82 |
83 |
84 |
85 | org.apache.felix
86 | maven-bundle-plugin
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/PersistenceContext.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade;
24 |
25 | /**
26 | * A {@link PersistenceContext} encapsulates the information about a particular persistence store
27 | * and specific implementations act as entry points suitable for interacting with specific types of
28 | * persistence mechanisms.
29 | *
30 | * @see UpgradeContext#getPersistenceContext(Class)
31 | * @see UpgradeContext#getPersistenceContext(Class, String)
32 | *
33 | * @author Zach Shepherd shepherdz@vmware.com
34 | * @version 1.0
35 | * @since 1.0
36 | */
37 | public interface PersistenceContext {
38 | /**
39 | * Returns {@code true} if the context is in a usable state.
40 | *
41 | * @return Returns {@code true} if the context can be safely used. Returns {@code false}
42 | * otherwise.
43 | */
44 | public boolean isConnected();
45 | }
46 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/Task.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade;
24 |
25 | import java.util.concurrent.Callable;
26 |
27 | import com.vmware.upgrade.progress.ExecutionState;
28 | import com.vmware.upgrade.progress.ProgressReport;
29 | import com.vmware.upgrade.progress.ProgressReporter;
30 | import com.vmware.upgrade.progress.ProgressReporter.ProgressListener;
31 |
32 | /**
33 | * A {@link Task} represents some concrete piece of work to be performed as part of the upgrade
34 | * process.
35 | *
36 | * @author Zach Shepherd shepherdz@vmware.com
37 | * @version 1.0
38 | * @since 1.0
39 | */
40 | public interface Task extends Callable, ProgressReporter {
41 | /**
42 | * Returns a name for the task appropriate for displaying as part of a log statement, error
43 | * message, or progress information.
44 | *
45 | * @return a human-readable name for the task
46 | */
47 | String getName();
48 |
49 | /**
50 | * Perform the action represented by this {@link Task}.
51 | *
52 | * {@link ProgressReport}s are provided to {@link ProgressListener} to
53 | * indicate changes in {@link ExecutionState} or {@link ProgressReport#getProgress() progress}.
54 | */
55 | @Override
56 | Void call() throws Exception;
57 | }
58 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/UpgradeDefinition.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2010-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade;
24 |
25 | import java.util.List;
26 |
27 | import com.vmware.upgrade.factory.UpgradeDefinitionFactory;
28 |
29 | /**
30 | * Encapsulates the {@link Task}s which define a given upgrade process.
31 | *
32 | * @see UpgradeDefinitionFactory
33 | *
34 | * @author Stephen Evanchik evanchik@vmware.com
35 | * @version 1.0
36 | * @since 1.0
37 | */
38 | public interface UpgradeDefinition {
39 | /**
40 | * The {@link Task}s that define the upgrade steps, to be run in the order returned.
41 | *
42 | * @return list of {@link Task}s to be run
43 | */
44 | public List getUpgradeTasks();
45 | }
46 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/context/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * Utility classes to assist in the implementation of
25 | * {@link com.vmware.upgrade.UpgradeContext#getPersistenceContext(Class)} and
26 | * {@link com.vmware.upgrade.UpgradeContext#getPersistenceContext(Class, String)}.
27 | *
28 | * @since 1.0
29 | */
30 | package com.vmware.upgrade.context;
31 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/factory/UpgradeDefinitionFactory.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.factory;
24 |
25 | import java.io.IOException;
26 |
27 | import com.vmware.upgrade.UpgradeContext;
28 | import com.vmware.upgrade.UpgradeDefinition;
29 | import com.vmware.upgrade.sequencing.Version;
30 |
31 | /**
32 | * A factory which will create {@link UpgradeDefinition}s for a specified {@link UpgradeContext}.
33 | *
34 | * @author Zach Shepherd shepherdz@vmware.com
35 | * @version 1.0
36 | * @since 1.0
37 | */
38 | public interface UpgradeDefinitionFactory {
39 | /**
40 | * Determine whether an {@link UpgradeDefinition} can be produced for the given context.
41 | *
42 | * @param context The {@link UpgradeContext} within which the upgrade would run.
43 | * @return true if the factory should be able to produce an upgrade for that context
44 | * @throws IOException if an IO error occurs when reading files defining the upgrade.
45 | */
46 | boolean isUpgradeSupported (final UpgradeContext context) throws IOException;
47 |
48 | /**
49 | * Generate an {@link UpgradeDefinition} which, when executed, will result in upgrade from the
50 | * {@link UpgradeContext#getVersion() current version} to the
51 | * {@link #getTargetVersion() highest reachable version}.
52 | *
53 | * @param context The {@link UpgradeContext} within which the upgrade should run.
54 | * @return the created {@link UpgradeDefinition}
55 | * @throws IOException if an IO error occurs when reading files defining the upgrade.
56 | */
57 | UpgradeDefinition create(final UpgradeContext context) throws IOException;
58 |
59 | /**
60 | * Return the highest {@link Version} reachable via execution of an {@link UpgradeDefinition}
61 | * produced by this factory.
62 | *
63 | * @return the maximum reachable {@link Version}
64 | */
65 | Version getTargetVersion();
66 | }
67 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/factory/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * Factory classes for generating {@link com.vmware.upgrade.UpgradeDefinition} instances.
25 | *
26 | * @since 1.0
27 | */
28 | package com.vmware.upgrade.factory;
29 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/logging/LogLevel.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2009-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.logging;
24 |
25 | /**
26 | * LogLevel enumeration contains all possible log severities
27 | *
28 | * @author Vassil Popovski vpopovski@vmware.com
29 | * @version 1.0
30 | * @since 1.0
31 | */
32 | public enum LogLevel {
33 | /**
34 | * very severe error events that will presumably lead the application to
35 | * abort.
36 | */
37 | FATAL,
38 |
39 | /**
40 | * error events that might still allow the application to continue running.
41 | */
42 | ERROR,
43 |
44 | /**
45 | * potentially harmful situations.
46 | */
47 | WARN,
48 |
49 | /**
50 | * security related events such as invalid logins
51 | */
52 | SECURITY,
53 |
54 | /**
55 | * informational messages that highlight the progress of the application at
56 | * coarse-grained level.
57 | */
58 | INFO,
59 |
60 | /**
61 | * fine-grained informational events that are most useful to debug an
62 | * application.
63 | */
64 | DEBUG,
65 |
66 | /**
67 | * finer-grained informational events than the DEBUG.
68 | */
69 | TRACE
70 | }
71 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/logging/UpgradeLogger.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.logging;
24 |
25 | /**
26 | * Wrapper around {@link Logger} (which is not intended to be exposed to framework users and should
27 | * remain in-sync with the {@code Logger} interface in {@code com.vmware.vcloud.activity.logging}
28 | * and {@code com.vmware.vcloud.logging}) for project-specific customizations.
29 | *
30 | * @author Zach Shepherd shepherdz@vmware.com
31 | * @version 1.0
32 | * @since 1.0
33 | */
34 | public interface UpgradeLogger extends Logger {
35 | // Intentionally blank; intended for future extension
36 | }
37 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/logging/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * Utility classes for assisting with creation of {@link com.vmware.upgrade.logging.UpgradeLogger}
25 | * instances.
26 | *
27 | * @since 1.0
28 | */
29 | package com.vmware.upgrade.logging;
30 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * The core upgrade framework.
25 | *
26 | * The upgrade framework exists to generally describe the process of performing a set of actions,
27 | * represented as {@link com.vmware.upgrade.Task} objects, to transition one or more persistence
28 | * mechanisms, described by {@link com.vmware.upgrade.PersistenceContext} objects encapsulated
29 | * within an overall {@link com.vmware.upgrade.UpgradeContext}, from one
30 | * {@link com.vmware.upgrade.sequencing.Version} to another later
31 | * {@link com.vmware.upgrade.sequencing.Version}.
32 | *
33 | * In addition to encapsulating the {@linkplain com.vmware.upgrade.PersistenceContext} objects, the
34 | * {@link com.vmware.upgrade.UpgradeContext} is responsible for capturing information about
35 | * the environment within which the upgrade is occurring, including the current
36 | * {@link com.vmware.upgrade.sequencing.Version} of the environment and the process for
37 | * {@linkplain com.vmware.upgrade.logging.UpgradeLogger logging} the changes being made.
38 | *
39 | * @since 1.0
40 | */
41 | package com.vmware.upgrade;
42 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/progress/ExecutionStateAggregator.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.progress;
24 |
25 | import java.util.Collection;
26 |
27 | /**
28 | * This class contains a method to calculate task state of a parent task from a collection
29 | * of task states of its children.
30 | *
31 | * @author Zach Shepherd shepherdz@vmware.com
32 | * @version 1.0
33 | * @since 1.0
34 | */
35 | public interface ExecutionStateAggregator {
36 | /**
37 | * Calculates the state of a parent task from a collection of states of child tasks.
38 | *
39 | * Parent states calculated by this method must be compatible with the state transition diagram
40 | * defined in {@link ExecutionState}, e.g. valid state transitions of the child states must
41 | * produce valid state transitions of the parent state.
42 | *
43 | * @param childStates non-empty collection of task states to aggregate
44 | * @return an aggregate state
45 | * @throws IllegalArgumentException if {@code taskStates} is {@code null} or is empty or
46 | * contains a {@code null} member
47 | */
48 | public ExecutionState aggregate(Collection childStates);
49 | }
50 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/progress/ProgressReport.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.progress;
24 |
25 | /**
26 | * A point-in-time representation of the progress of a task.
27 | *
28 | * @author Zach Shepherd shepherdz@vmware.com
29 | * @version 1.0
30 | * @since 1.0
31 | */
32 | public interface ProgressReport {
33 |
34 | /**
35 | * Get current progress as a percentage.
36 | *
37 | * @return current progress between 0..100
38 | */
39 | int getProgress();
40 |
41 | /**
42 | * Get the task state.
43 | *
44 | * @return the current {@link ExecutionState}
45 | */
46 | ExecutionState getState();
47 | }
48 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/progress/impl/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * Generally applicable implementations of interfaces defined in the
25 | * {@linkplain com.vmware.upgrade.progress progress reporting framework}.
26 | *
27 | * This package contains default implementations and utility classes related to progress reporting.
28 | *
29 | * @since 1.0
30 | */
31 | package com.vmware.upgrade.progress.impl;
32 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/progress/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * The progress reporting framework for the upgrade process.
25 | *
26 | * This package contains interfaces and helper classes for long running operations to
27 | * report progress and for clients to subscribe to progress updates.
28 | *
29 | * @since 1.0
30 | */
31 | package com.vmware.upgrade.progress;
32 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/sequencing/GraphHelper.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.sequencing;
24 |
25 | import java.util.LinkedList;
26 | import java.util.List;
27 |
28 | import com.vmware.upgrade.sequencing.Graph.Edge;
29 |
30 | /**
31 | * Utility class for convenience methods related to use of {@link Graph} instances.
32 | *
33 | * @author Zach Shepherd shepherdz@vmware.com
34 | * @version 1.0
35 | * @since 1.0
36 | */
37 | public class GraphHelper {
38 | public static List extractPath(final Graph graph, final Version version) {
39 | final List upgrades = new LinkedList();
40 |
41 | Version runningSourceVersionPart = version;
42 |
43 | Edge nextModel = graph.getEdge(runningSourceVersionPart);
44 | while (nextModel != null) {
45 | final Version nextSourceVersionPart = nextModel.getTarget();
46 |
47 | // This should never happen as it is checked elsewhere, but is double-checked here to
48 | // be safe (i.e. prevent a potential infinite loop).
49 | if (runningSourceVersionPart.compareTo(nextSourceVersionPart) > 0) {
50 | throw new AssertionError(runningSourceVersionPart);
51 | }
52 |
53 | upgrades.add(nextModel);
54 |
55 | runningSourceVersionPart = nextSourceVersionPart;
56 | nextModel = graph.getEdge(runningSourceVersionPart);
57 | }
58 |
59 | return upgrades;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/sequencing/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * Objects related to expressing the sequential relationship between a collection of
25 | * {@link com.vmware.upgrade.Task}s.
26 | *
27 | * @since 1.0
28 | */
29 | package com.vmware.upgrade.sequencing;
30 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/task/SerialAggregateTask.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.task;
24 |
25 | import java.util.List;
26 |
27 | import com.vmware.upgrade.Task;
28 | import com.vmware.upgrade.UpgradeContext;
29 | import com.vmware.upgrade.logging.UpgradeLogger;
30 |
31 | /**
32 | * A {@link Task} which aggregates other {@link Task}s and executes them in series
33 | *
34 | * @author Zach Shepherd shepherdz@vmware.com
35 | * @version 1.0
36 | * @since 1.0
37 | */
38 | public final class SerialAggregateTask extends AbstractAggregateTask {
39 | private final UpgradeLogger logger;
40 |
41 | /**
42 | * Constructs a named task which aggregates the supplied tasks.
43 | *
44 | * @param context
45 | * the {@link UpgradeContext}
46 | * @param name
47 | * see {@link Task#getName()}
48 | * @param children
49 | * the children to execute
50 | * @throws IllegalArgumentException
51 | * if {@code children} is {@code null}
52 | */
53 | public SerialAggregateTask(final UpgradeContext context, final String name, final List children) {
54 | super(name, children);
55 | logger = context.getLogger(getClass());
56 | }
57 |
58 | @Override
59 | public Void call() throws Exception {
60 | logger.trace("{0}: Beginning execution", getName());
61 |
62 | try {
63 | for (final Task child : getChildren()) {
64 | logger.debug("{0}: Beginning execution of task {1}", getName(), child.getName());
65 | child.call();
66 | }
67 | } catch (Exception e) {
68 | logger.warn(e, "{0}: Task failed due to uncaught exception", getName());
69 | getReporter().terminateWithFailure();
70 | throw e;
71 | }
72 |
73 | logger.trace("{0}: Completed successfully", getName());
74 |
75 | return null;
76 | }
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/task/TrivialTask.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.task;
24 |
25 | import java.util.concurrent.Callable;
26 | import java.util.concurrent.Executors;
27 |
28 | import com.vmware.upgrade.progress.ExecutionState;
29 |
30 | /**
31 | * Creates a trivial task from a {@link Runnable} or {@link Callable}.
32 | *
33 | * @author Zach Shepherd shepherdz@vmware.com
34 | * @version 1.0
35 | * @since 1.0
36 | */
37 | public class TrivialTask extends AbstractSimpleTask {
38 |
39 | private final Callable> callable;
40 |
41 | public TrivialTask(String name, Runnable r) {
42 | this(name, Executors.callable(r));
43 | }
44 |
45 | public TrivialTask(String name, Callable> callable) {
46 | super(name, 1);
47 |
48 | this.callable = callable;
49 | }
50 |
51 | @Override
52 | public Void call() throws Exception {
53 | setState(ExecutionState.RUNNING);
54 | try {
55 | callable.call();
56 | incrementProgress();
57 | } catch (Exception e) {
58 | setState(ExecutionState.FAILED);
59 | throw e;
60 | }
61 | setState(ExecutionState.COMPLETED);
62 |
63 | return null;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/main/java/com/vmware/upgrade/transformation/ReferenceTransformation.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2016 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.transformation;
24 |
25 | import com.vmware.upgrade.Task;
26 |
27 | /**
28 | * Extension of {@link Transformation} to hold information detailing how a {@link Task}
29 | * that adds or drops a reference would alter a database.
30 | *
31 | * @author Matthew Frost mfrost@vmware.com
32 | * @version 1.0
33 | * @since 1.0
34 | */
35 | public class ReferenceTransformation extends Transformation {
36 |
37 | private final String referencedTableName;
38 | private final boolean hasDeleteConstraint;
39 |
40 | public ReferenceTransformation(String tableName, String referencedTableName,
41 | boolean hasDeleteConstraint, TransformationType alterationType) {
42 | super(tableName, alterationType);
43 | if (alterationType != TransformationType.ADD_FOREIGN_KEY && alterationType != TransformationType.DROP_FOREIGN_KEY) {
44 | throw new AssertionError("alterationType must be either ADD_FOREIGN_KEY or DROP_FOREIGN_KEY");
45 | }
46 | this.referencedTableName = referencedTableName;
47 | this.hasDeleteConstraint = hasDeleteConstraint;
48 | }
49 |
50 | /**
51 | * The name of the table that would be referenced by a foreign key.
52 | *
53 | * @return {@link String} the referenced table name
54 | */
55 | public String getReferencedTableName() {
56 | return referencedTableName;
57 | }
58 |
59 | public boolean hasDeleteConstraint() {
60 | return hasDeleteConstraint;
61 | }
62 |
63 | @Override
64 | public String toString() {
65 | return String.format("Transforming table %s (referencing %s) via %s",
66 | tableName, referencedTableName, transformationType);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/test/java/com/vmware/upgrade/DummyUpgradeContext.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade;
24 |
25 | import java.util.NoSuchElementException;
26 |
27 | import com.vmware.upgrade.logging.UpgradeLogger;
28 | import com.vmware.upgrade.logging.UpgradeLoggerHelper;
29 | import com.vmware.upgrade.sequencing.Version;
30 |
31 | /**
32 | * A fake implementation of {@link UpgradeContext} for use in test code.
33 | *
34 | * Suitable for use only when a non-{@code null} placeholder {@link UpgradeContext} is needed.
35 | *
36 | * @author Zach Shepherd shepherdz@vmware.com
37 | * @version 1.0
38 | * @since 1.0
39 | */
40 | public class DummyUpgradeContext implements UpgradeContext {
41 | @Override
42 | public UpgradeLogger getLogger(Class> clazz) {
43 | return UpgradeLoggerHelper.NO_OP_LOGGER;
44 | }
45 |
46 | @Override
47 | public T getPersistenceContext(Class type) {
48 | throw new NoSuchElementException();
49 | }
50 |
51 | @Override
52 | public T getPersistenceContext(Class type, String qualifier) {
53 | throw new NoSuchElementException();
54 | }
55 |
56 | @Override
57 | public Version getVersion() {
58 | return Version.INITIAL;
59 | }
60 |
61 | @Override
62 | public void setVersion(Version version) {
63 | // TODO Auto-generated method stub
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/test/java/com/vmware/upgrade/TestGroups.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade;
24 |
25 | /**
26 | * Constants for use as TestNG Test Groups.
27 | *
28 | * @author Stephen Evanchik evanchik@vmware.com
29 | * @version 1.0
30 | * @since 1.0
31 | */
32 | public interface TestGroups {
33 | public static final String UNIT = "Unit";
34 |
35 | public static final String MINIMUM = "Minimum";
36 |
37 | public static final String REQUIRE_SPECIFIC_RESOURCE = "RequireSpecificResource";
38 | }
39 |
--------------------------------------------------------------------------------
/upgrade-framework-core/src/test/resources/testng.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/instructions.bnd:
--------------------------------------------------------------------------------
1 | Bundle-SymbolicName: com.vmware.upgrade.dsl
2 | Bundle-RequiredExecutionEnvironment: JavaSE-11
3 | Export-Package: *
4 | Import-Package: org.apache.commons.lang, *
5 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | 4.0.0
7 | upgrade-framework-dsl
8 |
9 | upgrade-framework-dsl - Domain Specific Language for Upgrade Framework
10 | Library which provides DSL processing logic for the upgrade framework.
11 |
12 | jar
13 |
14 |
15 | com.vmware.vcloud
16 | upgrade-framework-parent
17 | 2.0.0
18 | ../pom.xml
19 |
20 |
21 |
22 |
23 | org.codehaus.groovy
24 | groovy-all
25 | ${groovy.version}
26 | pom
27 |
28 |
29 |
30 | com.vmware.vcloud
31 | upgrade-framework-core
32 |
33 |
34 |
35 | com.vmware.vcloud
36 | upgrade-framework-core
37 | test-jar
38 | test
39 |
40 |
41 |
42 |
43 |
44 |
45 | maven-compiler-plugin
46 |
47 | groovy-eclipse-compiler
48 |
49 |
50 |
51 | org.codehaus.groovy
52 | groovy-eclipse-compiler
53 | ${groovy.eclipse.compiler.version}
54 |
55 |
56 | org.codehaus.groovy
57 | groovy-eclipse-batch
58 |
59 |
60 |
61 |
62 | org.codehaus.groovy
63 | groovy-eclipse-batch
64 | ${groovy.eclipse.batch.version}
65 |
66 |
67 |
68 |
69 |
70 | org.apache.maven.plugins
71 | maven-jar-plugin
72 |
73 |
74 |
75 | org.apache.felix
76 | maven-bundle-plugin
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/Processor.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl;
24 |
25 | import groovy.lang.Closure;
26 |
27 | import java.util.List;
28 | import java.util.Map;
29 |
30 | public interface Processor extends Cloneable {
31 | Map> getKeywordProcessors();
32 | List> getPropertyProcessors();
33 | }
34 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/TaskResolver.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl;
24 |
25 | import java.util.List;
26 |
27 | import com.vmware.upgrade.Task;
28 | import com.vmware.upgrade.UpgradeContext;
29 |
30 | public interface TaskResolver {
31 | Task resolve(UpgradeContext context, Class> taskClass, String name, List> args);
32 |
33 | Task combine(UpgradeContext context, List tasks, String name);
34 | }
35 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/model/ManifestModel.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.model
24 |
25 | import com.vmware.upgrade.sequencing.AbstractGraph
26 | import com.vmware.upgrade.sequencing.Graph
27 | import com.vmware.upgrade.sequencing.Version
28 |
29 | /**
30 | * A DSL model object representing a {@link Graph} of {@link Graph.Edge}s represented by
31 | * {@link UpgradeTaskModel}s.
32 | *
33 | * @author Emil Sit sit@vmware.com
34 | * @version 1.0
35 | * @since 1.0
36 | */
37 | class ManifestModel extends AbstractGraph {
38 | private Map upgrades = [:]
39 | def name
40 |
41 | def addUpgrade(UpgradeTaskModel upgrade) {
42 | Version source = upgrade.getSource()
43 | upgrades.put(source, upgrade)
44 | }
45 |
46 | def addAll(Collection upgrades) {
47 | for (UpgradeTaskModel upgrade : upgrades) {
48 | addUpgrade(upgrade)
49 | }
50 | }
51 |
52 | UpgradeTaskModel getUpgrade(Version source) {
53 | return upgrades.get(source)
54 | }
55 |
56 | Collection getUpgrades() {
57 | return upgrades.values()
58 | }
59 |
60 | @Override
61 | public Map getEdges() {
62 | return upgrades
63 | }
64 |
65 | @Override
66 | public String toString() {
67 | return name ?: "Unnamed Manifest"
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/model/NamespaceModel.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.model
24 |
25 | import com.vmware.upgrade.dsl.util.FinalVariableBinding
26 |
27 | /**
28 | * A DSL model object defining a namespace within which {@link UpgradeDefinitionModel}s must be
29 | * uniquely named.
30 | *
31 | * @author Ankit Shah ankitsha@vmware.com
32 | * @version 1.0
33 | * @since 1.0
34 | */
35 | class NamespaceModel {
36 | Binding upgrades
37 |
38 | NamespaceModel() {
39 | upgrades = new FinalVariableBinding()
40 | }
41 |
42 | def addUpgrade(String name, UpgradeDefinitionModel upgrade) {
43 | upgrades.setVariable(name, upgrade)
44 | }
45 |
46 | def propertyMissing(String name) {
47 | upgrades.getVariable(name)
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/model/UpgradeTaskModel.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.model;
24 |
25 | import com.vmware.upgrade.Task
26 | import com.vmware.upgrade.UpgradeContext
27 | import com.vmware.upgrade.sequencing.Graph
28 | import com.vmware.upgrade.sequencing.Version
29 |
30 | /**
31 | * A DSL model object representing a {@link Graph.Edge} within the {@link Graph} represented
32 | * by the {@link ManifestModel}.
33 | *
34 | * This class represents the association between a concrete {@link UpgradeDefinitionModel} and the
35 | * version information related to that process (the required source version and the resulting
36 | * version assuming successful execution).
37 | *
38 | * @author Zach Shepherd shepherdz@vmware.com
39 | * @version 1.0
40 | * @since 1.0
41 | */
42 | class UpgradeTaskModel implements Graph.Edge {
43 | Version source
44 | Version target
45 | UpgradeDefinitionModel definition
46 |
47 | @Override
48 | public Task createTask(UpgradeContext context) {
49 | return definition.createTask(context);
50 | }
51 |
52 | @Override
53 | public Version getSource() {
54 | return source;
55 | }
56 |
57 | @Override
58 | public Version getTarget() {
59 | return target;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/model/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * The core model objects which compose the domain specific language for defining upgrade
25 | * framework constructs.
26 | *
27 | * A com.vmware.upgrade.dsl.model.ManifestModel consists of
28 | * com.vmware.upgrade.dsl.model.UpgradeTaskModels which reference
29 | * com.vmware.upgrade.dsl.model.UpgradeDefinitionModels within
30 | * com.vmware.upgrade.dsl.model.NamespaceModels
31 | *
32 | * (Package contains Groovy classes.)
33 | *
34 | * @since 1.0
35 | */
36 | package com.vmware.upgrade.dsl.model;
37 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/syntax/ManifestSyntax.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.syntax
24 |
25 | import com.vmware.upgrade.dsl.model.ManifestModel
26 | import com.vmware.upgrade.dsl.model.UpgradeTaskModel
27 | import com.vmware.upgrade.sequencing.Version
28 |
29 | /**
30 | * Syntax to parse a manifest object describing zero or more {@link UpgradeTaskModel}s.
31 | *
32 | * @author Emil Sit sit@vmware.com
33 | * @version 1.0
34 | * @since 1.0
35 | */
36 | class ManifestSyntax {
37 | ManifestModel manifest = new ManifestModel()
38 |
39 | def name(manifestName) {
40 | manifest.name = manifestName
41 | }
42 |
43 | def from(version) {
44 | [see: { subManifest ->
45 | manifest.addAll(subManifest.upgrades)
46 | },
47 | call: { upgrade ->
48 | addUpgrade(new Version(version), new Version(version).getNext(), upgrade)
49 | },
50 | to: { target ->
51 | [call: { upgrade ->
52 | addUpgrade(new Version(version), new Version(target), upgrade)
53 | }
54 | ]
55 | }
56 | ]
57 | }
58 |
59 | def to(version) {
60 | [call: { upgrade ->
61 | final Version toVersion = new Version("${version}")
62 |
63 | for (int i = 0; new Version("${i}") < toVersion; i++) {
64 | addUpgrade(new Version("${i}"), toVersion, upgrade)
65 | }
66 | }]
67 | }
68 |
69 | def addUpgrade(source, target, definition) {
70 | if (manifest.getUpgrade(source) != null) {
71 | throw new DuplicateSourceException(source)
72 | }
73 | UpgradeTaskModel taskModel = [definition: definition, source: source, target: target] as UpgradeTaskModel
74 | manifest.addUpgrade(taskModel)
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/syntax/NamespaceSyntax.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2011-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.syntax
24 |
25 | import com.vmware.upgrade.dsl.model.NamespaceModel
26 | import com.vmware.upgrade.dsl.model.UpgradeDefinitionModel
27 |
28 | /**
29 | * Syntax to parse a namespace object containing zero or more uniquely-named
30 | * {@link UpgradeDefinitionModel}s.
31 | *
32 | * @author Ankit Shah ankitsha@vmware.com
33 | * @version 1.0
34 | * @since 1.0
35 | */
36 | class NamespaceSyntax {
37 | NamespaceModel namespace
38 |
39 | NamespaceSyntax() {
40 | namespace = new NamespaceModel()
41 | }
42 |
43 | def propertyMissing(String name, value) {
44 | if (!(value instanceof UpgradeDefinitionModel)) {
45 | throw new UpgradeCompilationException("${value} is not an upgrade definition for upgrade named ${name}")
46 | }
47 |
48 | namespace.addUpgrade name, value
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/syntax/UnknownKeywordWrapper.groovy:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.syntax
24 |
25 | /**
26 | * A wrapper for DSL closures to provide improved error handling for invalid keywords.
27 | * Wrapped delegates will throw an {@link UnknownKeywordException} (with a message noting
28 | * the unknown keyword) when an undefined keyword is encountered. This functions as an
29 | * improvement over the default behavior of a generic {@link MissingMethodException}.
30 | *
31 | * The improved error handling applies only if the delegate is a map [this wrapper is safe
32 | * to use if delegate is not a map, but it will not provide any benefit].
33 | *
34 | * @author Matthew Frost mfrost@vmware.com
35 | * @version 1.0
36 | * @since 1.0
37 | */
38 | public class UnknownKeywordWrapper {
39 | private Map> keywords
40 |
41 | static def wrap(delegate) {
42 | return (delegate instanceof Map) ? new UnknownKeywordWrapper(delegate) : delegate
43 | }
44 |
45 | private def UnknownKeywordWrapper(Map> keywords) {
46 | this.keywords = keywords
47 | }
48 |
49 | def methodMissing(String name, args) {
50 | if (name in keywords.keySet()) {
51 | def processor = keywords.get(name)
52 | processor.delegate = this
53 | return wrap(processor.call(*args))
54 | } else {
55 | throw new UnknownKeywordException("Unknown keyword: " + name)
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/syntax/package-info.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | /**
24 | * The core syntax objects which define the domain specific language for the upgrade framework.
25 | *
26 | * com.vmware.upgrade.dsl.syntax.ScriptSyntax serves as the primary entry point for
27 | * processing scripts.
28 | *
29 | * (Package contains Groovy classes.)
30 | *
31 | * @since 1.0
32 | */
33 | package com.vmware.upgrade.dsl.syntax;
34 |
--------------------------------------------------------------------------------
/upgrade-framework-dsl/src/main/java/com/vmware/upgrade/dsl/util/AggregateProcessor.java:
--------------------------------------------------------------------------------
1 | /* ****************************************************************************
2 | * Copyright (c) 2012-2014 VMware, Inc. All Rights Reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to
6 | * deal in the Software without restriction, including without limitation the
7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 | * sell copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | * ****************************************************************************/
22 |
23 | package com.vmware.upgrade.dsl.util;
24 |
25 | import groovy.lang.Closure;
26 |
27 | import java.util.ArrayList;
28 | import java.util.Collections;
29 | import java.util.HashMap;
30 | import java.util.List;
31 | import java.util.Map;
32 |
33 | import com.vmware.upgrade.dsl.Processor;
34 |
35 | /**
36 | * Aggregates zero or more {@link Processor} implementations.
37 | *
38 | * @author Zach Shepherd shepherdz@vmware.com
39 | * @version 1.0
40 | * @since 1.0
41 | */
42 | public class AggregateProcessor implements Processor {
43 | private final Map> keywordProcessors;
44 | private final List