01: /*
02: * CmdExport.java
03: *
04: * Created on November 14, 2001, 1:27 PM
05: */
06:
07: package com.sun.portal.desktop.deployment;
08:
09: import java.util.Vector;
10:
11: import java.io.PrintStream;
12: import java.io.IOException;
13:
14: /**
15: *
16: * @author yabob
17: * @version
18: */
19: public class CmdImport {
20:
21: public static void doImport(boolean verbose, boolean overwrite,
22: boolean autoextract, String parfile, DPRootSpecifier droot,
23: String ss, Vector ops, PrintStream out)
24: throws ParFileException {
25: ParFile par = ParFile.makeParFile(parfile);
26: ParExtractionContext pex = new DPBasedExCtx(droot, overwrite,
27: verbose, out, ss);
28:
29: if (autoextract) {
30: if (ops.size() > 0) {
31: throw new ParFileException("errorOpWithAuto");
32: }
33: par.performAutoExtraction(pex, droot.getDN());
34: return;
35: }
36:
37: if (ops.size() == 0) {
38: throw new ParFileException("errorNoOperations");
39: }
40:
41: for (int i = 0; i < ops.size(); ++i) {
42: String opstr = (String) ops.elementAt(i);
43: ExtractOp op = ExtractOp.makeOpFromArgument(droot.getDN(),
44: opstr);
45: par.performExtraction(pex, op);
46: }
47: try {
48: par.close();
49: } catch (IOException ie) {
50: //the command is basically done
51: }
52:
53: }
54:
55: /**
56: * @param args the command line arguments
57: */
58: public static void main(String args[]) {
59:
60: CmdOpts opts = CmdOpts.parseOpts(args, CmdOpts.STD_DPOPT,
61: CmdOpts.REM_OPTIONAL, Par
62: .getLocalizedString("usageImport"), "rpdvsoa");
63: if (opts != null) {
64: try {
65: doImport(opts.verbose(), opts.overwrite(), opts
66: .autoextract(), opts.parfile(), opts.dproot(),
67: opts.staticsub(), opts.remaining(), System.out);
68: } catch (Exception ex) {
69: opts.produceErrorMessage(ex);
70: }
71: }
72: System.exit(0);
73: }
74: }
|