-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename WindupConfigurationPackageModel to PackageModel. TODO: Should …
…be in the Java addon. Add javadoc to WindupConfigurationModel.
- Loading branch information
1 parent
613d51e
commit 8eed922
Showing
5 changed files
with
211 additions
and
24 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
exec/impl/src/main/java/org/jboss/windup/exec/config/Configuration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package org.jboss.windup.exec.config; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* Holds global configuration and plugin-specific configuration. | ||
* | ||
* @author Ondrej Zizka | ||
*/ | ||
@XmlRootElement(name="config") | ||
@XmlAccessorType( XmlAccessType.NONE ) | ||
public class Configuration { | ||
|
||
@XmlElement | ||
private CoreConfiguration globalConfig = new CoreConfiguration(); | ||
|
||
private List<RulesetSpecificProperty> rulesetConfigs = new LinkedList(); | ||
|
||
|
||
|
||
/** | ||
* What to do if some resource already exists. | ||
* MERGE (ModelNode into current model) and ASK (interactive) are not supported yet. | ||
*/ | ||
public enum IfExists { | ||
FAIL, WARN, SKIP, MERGE, OVERWRITE, ASK, GUI; | ||
|
||
/** The same as valueOf(), only case-insensitive. */ | ||
public static IfExists valueOf_Custom(String str) throws IllegalArgumentException { | ||
try { | ||
return valueOf( str.toUpperCase() ); | ||
} | ||
catch( IllegalArgumentException | NullPointerException ex ){ | ||
throw new IllegalArgumentException("ifExists must be one of FAIL, WARN, SKIP, MERGE, OVERWRITE, ASK. Was: " + str); | ||
} | ||
} | ||
|
||
public static final String PARAM_NAME = "ifExists"; | ||
}// enum | ||
|
||
|
||
|
||
|
||
/** | ||
* Triplet for module specific property, e.g --conf.logging.merge=true . | ||
*/ | ||
public static class RulesetSpecificProperty{ | ||
|
||
private String moduleId; | ||
private String propName; | ||
private String value; | ||
|
||
public RulesetSpecificProperty(String moduleId, String propName, String value) { | ||
this.moduleId = moduleId; | ||
this.propName = propName; | ||
this.value = value; | ||
} | ||
|
||
public String getModuleId() { return moduleId; } | ||
public void setModuleId(String moduleId) { this.moduleId = moduleId; } | ||
public String getPropName() { return propName; } | ||
public void setPropName(String propName) { this.propName = propName; } | ||
public String getValue() { return value; } | ||
public void setValue(String value) { this.value = value; } | ||
} | ||
|
||
|
||
//<editor-fold defaultstate="collapsed" desc="get/set"> | ||
public CoreConfiguration getGlobal() { return globalConfig; } | ||
public void setGlobalConfig(CoreConfiguration options) { this.globalConfig = options; } | ||
public List<RulesetSpecificProperty> getModuleConfigs() { return rulesetConfigs; } | ||
public void setModuleConfigs(List<RulesetSpecificProperty> moduleConfigs) { this.rulesetConfigs = moduleConfigs; } | ||
//</editor-fold> | ||
|
||
}// class |
76 changes: 76 additions & 0 deletions
76
exec/impl/src/main/java/org/jboss/windup/exec/config/CoreConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 . | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
package org.jboss.windup.exec.config; | ||
|
||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
|
||
/** | ||
* Class for storing global information needed for migration. Like dir of AS7, AS5, and profiles | ||
* <p/> | ||
* With regard of possibility to migrate from other vendors' AS, | ||
* split to AS 7 config class, and then have 1 class per server (AS 5, WebLogic, ...). | ||
*/ | ||
@XmlRootElement(name="global") | ||
public class CoreConfiguration { | ||
|
||
private Set<String> appPaths = new HashSet(); | ||
|
||
private boolean skipValidation = false; | ||
|
||
private boolean dryRun = false; | ||
|
||
private boolean isTestRun = false; | ||
|
||
// This is rather for test purposes. If null, all are used. | ||
private List<String> onlyRulesets = new LinkedList(); | ||
|
||
private String reportDir = "MigrationReport"; | ||
|
||
private String externalMigratorsDir; | ||
|
||
// User vars - accessible in EL's and Groovy scripts. WINDUP-132 | ||
private Map<String, String> userVars = new HashMap(); | ||
|
||
|
||
|
||
//<editor-fold defaultstate="collapsed" desc="get/set"> | ||
public Set<String> getDeploymentsPaths() { return appPaths; } | ||
public void addDeploymentPath(String deplPath) { this.appPaths.add( deplPath ); } | ||
|
||
public boolean isSkipValidation() { return skipValidation; } | ||
public void setSkipValidation(boolean skipValidation) { this.skipValidation = skipValidation; } | ||
|
||
public boolean isDryRun() { return dryRun; } | ||
public void setDryRun( boolean dryRun ) { this.dryRun = dryRun; } | ||
|
||
public boolean isTestRun() { return isTestRun; } | ||
public void setTestRun( boolean isTestRun ) { this.isTestRun = isTestRun; } | ||
|
||
public String getReportDir() { return reportDir; } | ||
public void setReportDir( String reportDir ) { this.reportDir = reportDir; } | ||
|
||
public String getExternalMigratorsDir() { return externalMigratorsDir; } | ||
public void setExternalMigratorsDir( String externalMigratorsDir ) { this.externalMigratorsDir = externalMigratorsDir; } | ||
|
||
public List<String> getOnlyMigrators() { return onlyRulesets; } | ||
public List<String> addOnlyMigrator( String name ) { onlyRulesets.add(name); return onlyRulesets; } | ||
|
||
// WINDUP-132 | ||
public Map<String, String> getUserVars() { return userVars; } | ||
public String getUserVar( String name) { return userVars.get(name); } | ||
public void setUserVar( String name, String val ) { this.userVars.put( name, val ); } | ||
//</editor-fold> | ||
|
||
}// class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters