Source Code Cross Referenced for ReplicationProfile.java in  » Database-Client » JSqlTool » org » jsqltool » replication » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » JSqlTool » org.jsqltool.replication 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jsqltool.replication;
002:
003:        import java.io.*;
004:        import javax.swing.*;
005:        import java.util.*;
006:        import org.jsqltool.utils.Options;
007:
008:        /**
009:         * <p>Title: JSqlTool Project</p>
010:         * <p>Description: This Value Object contains replication settings used in a Data Replication process.
011:         * </p>
012:         * <p>Copyright: Copyright (C) 2006 Mauro Carniel</p>
013:         *
014:         * <p> This file is part of JSqlTool project.
015:         * This library is free software; you can redistribute it and/or
016:         * modify it under the terms of the (LGPL) Lesser General Public
017:         * License as published by the Free Software Foundation;
018:         *
019:         *                GNU LESSER GENERAL PUBLIC LICENSE
020:         *                 Version 2.1, February 1999
021:         *
022:         * This library is distributed in the hope that it will be useful,
023:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
024:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
025:         * Library General Public License for more details.
026:         *
027:         * You should have received a copy of the GNU Library General Public
028:         * License along with this library; if not, write to the Free
029:         * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
030:         *
031:         *       The author may be contacted at:
032:         *           maurocarniel@tin.it</p>
033:         *
034:         * @author Mauro Carniel
035:         * @version 1.0
036:         */
037:        public class ReplicationProfile {
038:
039:            private String name;
040:            private String sourceDatabase;
041:            private String destDatabase;
042:            private java.util.ArrayList tablesList;
043:            private boolean recreateTablesContent;
044:
045:            public ReplicationProfile() {
046:            }
047:
048:            public String getName() {
049:                return name;
050:            }
051:
052:            public void setName(String name) {
053:                this .name = name;
054:            }
055:
056:            public String getSourceDatabase() {
057:                return sourceDatabase;
058:            }
059:
060:            public void setSourceDatabase(String sourceDatabase) {
061:                this .sourceDatabase = sourceDatabase;
062:            }
063:
064:            public String getDestDatabase() {
065:                return destDatabase;
066:            }
067:
068:            public void setDestDatabase(String destDatabase) {
069:                this .destDatabase = destDatabase;
070:            }
071:
072:            public java.util.ArrayList getTablesList() {
073:                return tablesList;
074:            }
075:
076:            public void setTablesList(java.util.ArrayList tablesList) {
077:                this .tablesList = tablesList;
078:            }
079:
080:            public boolean isRecreateTablesContent() {
081:                return recreateTablesContent;
082:            }
083:
084:            public void setRecreateTablesContent(boolean recreateTablesContent) {
085:                this .recreateTablesContent = recreateTablesContent;
086:            }
087:
088:            /**
089:             * Load replication profile file (profile/filename.rep)
090:             */
091:            public void loadProfile(JInternalFrame parent, File file,
092:                    ArrayList profiles, Vector profileNames) {
093:                try {
094:                    BufferedReader br = new BufferedReader(
095:                            new InputStreamReader(new FileInputStream(file)));
096:                    br.readLine(); // version...
097:                    this .setName(br.readLine());
098:                    this .setSourceDatabase(br.readLine());
099:                    this .setDestDatabase(br.readLine());
100:                    this .setRecreateTablesContent(br.readLine().toLowerCase()
101:                            .equals("true"));
102:
103:                    String line = null;
104:                    ArrayList tables = new ArrayList();
105:                    while ((line = br.readLine()) != null) {
106:                        tables.add(line);
107:                    }
108:                    this .setTablesList(tables);
109:
110:                    br.close();
111:
112:                    profiles.add(this );
113:                    profileNames.add(name);
114:
115:                } catch (Exception ex) {
116:                    ex.printStackTrace();
117:                    JOptionPane
118:                            .showMessageDialog(
119:                                    parent,
120:                                    Options
121:                                            .getInstance()
122:                                            .getResource(
123:                                                    "error on loading replication profile file.")
124:                                            + ":\n" + ex.getMessage(),
125:                                    Options.getInstance().getResource("error"),
126:                                    JOptionPane.ERROR_MESSAGE);
127:                }
128:            }
129:
130:            public void saveProfile(JFrame parent, boolean isEdit) {
131:                try {
132:                    PrintWriter pw = new PrintWriter(new FileOutputStream(
133:                            new File("profile/" + name.replace(' ', '_')
134:                                    + ".rep")));
135:
136:                    // save replicaton properties...
137:                    pw.println("VERSION 1.0.4");
138:                    pw.println(this .getName());
139:                    pw.println(this .getSourceDatabase());
140:                    pw.println(this .getDestDatabase());
141:                    pw.println(this .isRecreateTablesContent() ? "true"
142:                            : "false");
143:                    for (int i = 0; i < this .tablesList.size(); i++)
144:                        pw.println(this .tablesList.get(i).toString());
145:
146:                    pw.close();
147:
148:                } catch (Exception ex) {
149:                    ex.printStackTrace();
150:                    JOptionPane
151:                            .showMessageDialog(
152:                                    parent,
153:                                    Options
154:                                            .getInstance()
155:                                            .getResource(
156:                                                    "error on saving replication profile file.")
157:                                            + ":\n" + ex.getMessage(),
158:                                    Options.getInstance().getResource("error"),
159:                                    JOptionPane.ERROR_MESSAGE);
160:                }
161:            }
162:
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.