Skip to content

Commit 0cda99e

Browse files
author
qwazer
committed
scheme2ddl-28 rename refactoring
1 parent d372796 commit 0cda99e

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

src/main/java/com/googlecode/scheme2ddl/Main.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.googlecode.scheme2ddl;
22

33
import com.googlecode.scheme2ddl.dao.ConnectionDao;
4-
import com.googlecode.scheme2ddl.dao.UserObjectDao;
54
import oracle.jdbc.pool.OracleDataSource;
65
import org.apache.commons.logging.Log;
76
import org.apache.commons.logging.LogFactory;
@@ -33,7 +32,7 @@ public class Main {
3332
private static boolean justTestConnection = false;
3433
private static boolean skipPublicDbLinks = false;
3534
private static boolean stopOnWarning = false;
36-
private static boolean filterSequenceValues = false;
35+
private static boolean replaceSequenceValues = false;
3736
private static String customConfigLocation = null;
3837
private static String defaultConfigLocation = "scheme2ddl.config.xml";
3938
private static String dbUrl = null;
@@ -121,9 +120,9 @@ private static void modifyContext(ConfigurableApplicationContext context) {
121120
UserObjectProcessor processor = (UserObjectProcessor) context.getBean("processor");
122121
processor.setStopOnWarning(stopOnWarning);
123122
}
124-
if (filterSequenceValues){
123+
if (replaceSequenceValues){
125124
UserObjectProcessor processor = (UserObjectProcessor) context.getBean("processor");
126-
processor.setFilterSequenceValues(filterSequenceValues);
125+
processor.setReplaceSequenceValues(replaceSequenceValues);
127126
}
128127

129128
}
@@ -245,23 +244,25 @@ private static void printUsage() {
245244
msg.append("internally call to dbms_metadata.get_ddl " + lSep);
246245
msg.append("more config options in scheme2ddl.config.xml " + lSep);
247246
msg.append("Options: " + lSep);
248-
msg.append(" -help, -h print this message" + lSep);
249-
// msg.append(" -verbose, -v be extra verbose" + lSep);
250-
msg.append(" -url, DB connection URL" + lSep);
251-
msg.append(" example: scott/tiger@localhost:1521:ORCL" + lSep);
247+
msg.append(" -help, -h print this message" + lSep);
248+
// msg.append(" -verbose, -v be extra verbose" + lSep);
249+
msg.append(" -url, DB connection URL" + lSep);
250+
msg.append(" example: scott/tiger@localhost:1521:ORCL" + lSep);
252251

253-
msg.append(" -o, --output, output dir" + lSep);
254-
msg.append(" -p, --parallel, number of parallel thread (default 4)" + lSep);
255-
msg.append(" -s, --schemas, a comma separated list of schemas for processing" + lSep);
256-
msg.append(" (works only if connected to oracle as sysdba)" + lSep);
257-
msg.append(" -c, --config, path to scheme2ddl config file (xml)" + lSep);
258-
msg.append(" -f, --filter, filter for specific DDL objects" + lSep);
259-
msg.append(" every LIKE wildcard can be used" + lSep);
260-
msg.append(" -tf, --type-filter, filter for specific DDL object types" + lSep);
261-
msg.append(" -tfm, --type-filtermode, mode for type filter: include(default) or exclude" + lSep);
262-
msg.append(" --stop-on-warning, stop on getting DDL error (skip by default)" + lSep);
263-
msg.append(" -tc,--test-connection, test db connection available" + lSep);
264-
msg.append(" -version, print version info and exit" + lSep);
252+
msg.append(" -o, --output, output dir" + lSep);
253+
msg.append(" -p, --parallel, number of parallel thread (default 4)" + lSep);
254+
msg.append(" -s, --schemas, a comma separated list of schemas for processing" + lSep);
255+
msg.append(" (works only if connected to oracle as sysdba)" + lSep);
256+
msg.append(" -c, --config, path to scheme2ddl config file (xml)" + lSep);
257+
msg.append(" -f, --filter, filter for specific DDL objects" + lSep);
258+
msg.append(" every LIKE wildcard can be used" + lSep);
259+
msg.append(" -tf, --type-filter, filter for specific DDL object types" + lSep);
260+
msg.append(" -tfm, --type-filtermode, mode for type filter: include(default) or exclude" + lSep);
261+
msg.append(" --stop-on-warning, stop on getting DDL error (skip by default)" + lSep);
262+
msg.append(" -rsv, replace actual filter values with 1 " +
263+
" --replace-sequence-values, " + lSep);
264+
msg.append(" -tc,--test-connection, test db connection available" + lSep);
265+
msg.append(" -version, print version info and exit" + lSep);
265266
System.out.println(msg.toString());
266267
}
267268

@@ -305,7 +306,7 @@ private static void collectArgs(String[] args) throws Exception {
305306
} else if (arg.equals("--stop-on-warning")) {
306307
stopOnWarning = true;
307308
} else if ((arg.equals("-fsv") || arg.equals("--filter-sequence-values"))) {
308-
filterSequenceValues = true;
309+
replaceSequenceValues = true;
309310
} else if (arg.equals("-c") || arg.equals("--config")) {
310311
customConfigLocation = args[i + 1];
311312
i++;

src/main/java/com/googlecode/scheme2ddl/UserObjectProcessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class UserObjectProcessor implements ItemProcessor<UserObject, UserObject
2626
private Map<String, Set<String>> excludes;
2727
private Map<String, Set<String>> dependencies;
2828
private boolean stopOnWarning;
29-
private boolean filterSequenceValues;
29+
private boolean replaceSequenceValues;
3030

3131
public UserObject process(UserObject userObject) throws Exception {
3232

@@ -76,7 +76,7 @@ private String map2Ddl(UserObject userObject) throws CannotGetDDLException, NonS
7676
return userObjectDao.findRefGroupDDL(userObject.getType(), userObject.getName());
7777
}
7878
String res = userObjectDao.findPrimaryDDL(map2TypeForDBMS(userObject.getType()), userObject.getName());
79-
if (userObject.getType().equals("SEQUENCE") && filterSequenceValues) {
79+
if (userObject.getType().equals("SEQUENCE") && replaceSequenceValues) {
8080
res = ddlFormatter.replaceActualSequenceValueWithOne(res);
8181
}
8282
Set<String> dependedTypes = dependencies.get(userObject.getType());
@@ -116,8 +116,8 @@ public void setFileNameConstructor(FileNameConstructor fileNameConstructor) {
116116
this.fileNameConstructor = fileNameConstructor;
117117
}
118118

119-
public void setFilterSequenceValues(boolean filterSequenceValues) {
120-
this.filterSequenceValues = filterSequenceValues;
119+
public void setReplaceSequenceValues(boolean replaceSequenceValues) {
120+
this.replaceSequenceValues = replaceSequenceValues;
121121
}
122122

123123
public void setStopOnWarning(boolean stopOnWarning) {

src/main/resources/applicationContext.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<property name="excludes" ref="excludes"/>
5252
<property name="dependencies" ref="dependencies"/>
5353
<property name="stopOnWarning" value="false"/>
54-
<property name="filterSequenceValues" value="false"/>
54+
<property name="replaceSequenceValues" value="false"/>
5555
</bean>
5656

5757

0 commit comments

Comments
 (0)