01: package net.sourceforge.squirrel_sql.plugins.dbcopy.commands;
02:
03: /*
04: * Copyright (C) 2005 Rob Manning
05: * manningr@users.sourceforge.net
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: import net.sourceforge.squirrel_sql.fw.util.ICommand;
23: import net.sourceforge.squirrel_sql.plugins.dbcopy.CopyExecutor;
24: import net.sourceforge.squirrel_sql.plugins.dbcopy.CopyProgressMonitor;
25: import net.sourceforge.squirrel_sql.plugins.dbcopy.CopyScripter;
26: import net.sourceforge.squirrel_sql.plugins.dbcopy.I18NBaseObject;
27: import net.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProvider;
28:
29: /**
30: * This class represents the command that gets executed when the user clicks
31: * paste table in a schema after copying one or more tables.
32: */
33: public class PasteTableCommand extends I18NBaseObject implements
34: ICommand {
35:
36: /** the provider of information about what to copy and where */
37: @SuppressWarnings("unused")
38: private SessionInfoProvider prov = null;
39:
40: /** the class that does the work of copying */
41: private CopyExecutor executor = null;
42:
43: /** the class that provides feedback to the user throught the copy operation */
44: private CopyProgressMonitor monitor = null;
45:
46: /** the class that writes a script that represents the copy operation */
47: private CopyScripter copyScripter = null;
48:
49: /**
50: * Constructor specifying the current session.
51: */
52: public PasteTableCommand(SessionInfoProvider provider) {
53: super ();
54: prov = provider;
55: executor = new CopyExecutor(provider);
56: monitor = new CopyProgressMonitor(provider);
57: copyScripter = new CopyScripter();
58: executor.addListener(monitor);
59: executor.addListener(copyScripter);
60: executor.setPref(monitor);
61: monitor.setExecutor(executor);
62:
63: }
64:
65: // ICommand Interface implementation
66:
67: /**
68: * Kicks off the copy operation. All pieces of information are provided
69: * by the SessionInfoProvider and have been verified in the action prior
70: * to this point. Nothing left to do except start the copy operation.
71: */
72: public void execute() {
73: executor.execute();
74: }
75: }
|