01: /*
02: * ControlFileFormat.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.exporter;
13:
14: import java.util.Collections;
15: import java.util.HashSet;
16: import java.util.List;
17: import java.util.Set;
18: import workbench.util.StringUtil;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public enum ControlFileFormat {
25: none, oracle, sqlserver;
26:
27: public static Set<ControlFileFormat> parseCommandLine(String args) {
28: if (StringUtil.isEmptyString(args))
29: return Collections.emptySet();
30: Set<ControlFileFormat> result = new HashSet<ControlFileFormat>();
31: List<String> formats = StringUtil.stringToList(args);
32: for (String fs : formats) {
33: try {
34: ControlFileFormat f = ControlFileFormat.valueOf(fs);
35: result.add(f);
36: } catch (Exception e) {
37: }
38: }
39: return result;
40: }
41:
42: public static FormatFileWriter createFormatWriter(
43: ControlFileFormat format) {
44: switch (format) {
45: case oracle:
46: return new OracleControlFileWriter();
47: case sqlserver:
48: return new SqlServerFormatFileWriter();
49: }
50: return null;
51: }
52: }
|