Source Code Cross Referenced for DefinitionEditor.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » userinterface » 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 » Report » jmagallanes 1.0 » com.calipso.reportgenerator.userinterface 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.userinterface;
002:
003:        import org.apache.commons.vfs.FileSystemManager;
004:        import org.apache.commons.vfs.FileObject;
005:        import org.apache.commons.vfs.FileSystemException;
006:        import org.exolab.castor.xml.Unmarshaller;
007:        import com.calipso.reportgenerator.services.FileSystemResolver;
008:        import com.calipso.reportgenerator.common.ReportManagerLogger;
009:        import com.calipso.reportgenerator.common.LanguageTraslator;
010:        import com.calipso.reportgenerator.common.InfoException;
011:        import com.calipso.reportgenerator.common.ReportGeneratorConfiguration;
012:        import com.calipso.reportgenerator.reportdefinitions.ReportDefinition;
013:        import com.calipso.reportgenerator.reportdefinitions.ReportSourceDefinition;
014:
015:        import java.io.FileReader;
016:        import java.io.IOException;
017:
018:        /**
019:         * User: alorenzo
020:         * Date: 05-ene-2006
021:         * Time: 15:09:11
022:         *
023:         */
024:        public class DefinitionEditor {
025:
026:            private static String nameFileReportDefinitionSchema = "ReportDefinition.xsd";
027:            private static String nameFileReportSourceDefinitionSchema = "ReportSourceDefinition.xsd";
028:            private static String pathSchema;
029:            private static String reportDefinitionID;
030:            private static String reportSourceDefinitionID;
031:            private static ReportGeneratorConfiguration reportGeneratorConfiguration;
032:
033:            public static void reportDefinitionEditor(String reportDefID,
034:                    ReportGeneratorConfiguration reportGenerator)
035:                    throws InfoException {
036:                try {
037:                    reportDefinitionID = reportDefID;
038:                    reportGeneratorConfiguration = reportGenerator;
039:                    pathSchema = reportGenerator.getSourceReportSchemasPath();
040:                    String pathReportDefinition = pathReportDefinitionResolver();
041:                    String pathReportDefinitionSchema = pathReportDefinitionSchemaResolver();
042:                    if (!(pathReportDefinition.equalsIgnoreCase(""))) {
043:                        runPollo(pathReportDefinition,
044:                                pathReportDefinitionSchema, reportGenerator
045:                                        .getPolloPath());
046:                    }
047:                } catch (Exception e) {
048:                    throw new InfoException(LanguageTraslator.traslate("541"),
049:                            e);
050:                }
051:            }
052:
053:            private static String pathReportDefinitionResolver()
054:                    throws InfoException {
055:                String pathReportDefinition = "";
056:                try {
057:                    FileSystemManager fileSystemManager = FileSystemResolver
058:                            .getFileSystemManager(reportGeneratorConfiguration);
059:                    FileObject fileObject = fileSystemManager
060:                            .resolveFile(reportGeneratorConfiguration
061:                                    .getSourceReportDefinitionsPath());
062:                    String fileName;
063:                    for (int i = 0; i < fileObject.getChildren().length; i++) {
064:                        fileName = fileObject.getChildren()[i].getName()
065:                                .getBaseName();
066:                        if (!fileName.endsWith(".xml")) {
067:                            continue;
068:                        }
069:                        String reportDefinitionIDViewer;
070:                        reportDefinitionIDViewer = ((ReportDefinition) Unmarshaller
071:                                .unmarshal(
072:                                        ReportDefinition.class,
073:                                        new FileReader(
074:                                                reportGeneratorConfiguration
075:                                                        .getSourceReportDefinitionsPath()
076:                                                        + "/" + fileName)))
077:                                .getId();
078:                        if (reportDefinitionID
079:                                .equalsIgnoreCase(reportDefinitionIDViewer)) {
080:                            pathReportDefinition = reportGeneratorConfiguration
081:                                    .getSourceReportDefinitionsPath()
082:                                    + "/" + fileName;
083:                        }
084:                    }
085:                } catch (Exception e) {
086:                    throw new InfoException(LanguageTraslator.traslate("542"),
087:                            e);
088:                }
089:                return pathReportDefinition;
090:            }
091:
092:            private static String pathReportDefinitionSchemaResolver()
093:                    throws InfoException {
094:                String pathReportDefinitionSchema = "";
095:                try {
096:                    pathReportDefinitionSchema = pathSchema + "/"
097:                            + nameFileReportDefinitionSchema;
098:                    new FileReader(pathReportDefinitionSchema);
099:                } catch (Exception e) {
100:                    pathReportDefinitionSchema = "";
101:                }
102:                return pathReportDefinitionSchema;
103:            }
104:
105:            public static void reportSourceDefinitionEditor(String reportDefID,
106:                    ReportGeneratorConfiguration reportGenerator)
107:                    throws InfoException {
108:                try {
109:                    reportDefinitionID = reportDefID;
110:                    reportGeneratorConfiguration = reportGenerator;
111:                    pathSchema = reportGenerator.getSourceReportSchemasPath();
112:                    String pathReportDefinition = pathReportDefinitionResolver();
113:                    if (!(pathReportDefinition.equalsIgnoreCase(""))) {
114:                        reportSourceDefinitionID = ((ReportDefinition) Unmarshaller
115:                                .unmarshal(ReportDefinition.class,
116:                                        new FileReader(pathReportDefinition)))
117:                                .getReportSource();
118:                        String pathReportSourceDefinition = pathReportSourceDefinitionResolver();
119:                        String pathReportSourceDefinitionSchema = pathReportSourceDefinitionSchemaResolver();
120:                        if (!(pathReportSourceDefinition.equalsIgnoreCase(""))) {
121:                            runPollo(pathReportSourceDefinition,
122:                                    pathReportSourceDefinitionSchema,
123:                                    reportGenerator.getPolloPath());
124:                        }
125:                    }
126:                } catch (Exception e) {
127:                    throw new InfoException(LanguageTraslator.traslate("543"),
128:                            e);
129:                }
130:            }
131:
132:            private static void runPollo(String pathReportSourceDefinition,
133:                    String pathReportSourceDefinitionSchema, String polloPath)
134:                    throws IOException {
135:                Runtime.getRuntime().exec(
136:                        "java -jar " + polloPath + " "
137:                                + pathReportSourceDefinition + " "
138:                                + pathReportSourceDefinitionSchema);
139:            }
140:
141:            private static String pathReportSourceDefinitionResolver()
142:                    throws InfoException {
143:                String pathReportSourceDefinition = "";
144:                try {
145:                    FileSystemManager fileSystemManager = FileSystemResolver
146:                            .getFileSystemManager(reportGeneratorConfiguration);
147:                    FileObject fileObject = fileSystemManager
148:                            .resolveFile(reportGeneratorConfiguration
149:                                    .getSourceReportSourceDefinitionsPath());
150:                    String fileName;
151:                    for (int i = 0; i < fileObject.getChildren().length; i++) {
152:                        fileName = fileObject.getChildren()[i].getName()
153:                                .getBaseName();
154:                        if (!fileName.endsWith(".xml")) {
155:                            continue;
156:                        }
157:                        String reportSourceDefinitionIDViewer;
158:                        reportSourceDefinitionIDViewer = ((ReportSourceDefinition) Unmarshaller
159:                                .unmarshal(
160:                                        ReportSourceDefinition.class,
161:                                        new FileReader(
162:                                                reportGeneratorConfiguration
163:                                                        .getSourceReportSourceDefinitionsPath()
164:                                                        + "/" + fileName)))
165:                                .getId();
166:                        if (reportSourceDefinitionID
167:                                .equalsIgnoreCase(reportSourceDefinitionIDViewer)) {
168:                            pathReportSourceDefinition = reportGeneratorConfiguration
169:                                    .getSourceReportSourceDefinitionsPath()
170:                                    + "/" + fileName;
171:                        }
172:                    }
173:                } catch (Exception e) {
174:                    throw new InfoException(LanguageTraslator.traslate("544"),
175:                            e);
176:                }
177:                return pathReportSourceDefinition;
178:            }
179:
180:            private static String pathReportSourceDefinitionSchemaResolver()
181:                    throws InfoException {
182:                String pathReportSourceDefinitionSchema = "";
183:                try {
184:                    pathReportSourceDefinitionSchema = pathSchema + "/"
185:                            + nameFileReportSourceDefinitionSchema;
186:                    new FileReader(pathReportSourceDefinitionSchema);
187:                } catch (Exception e) {
188:                    pathReportSourceDefinitionSchema = "";
189:                }
190:                return pathReportSourceDefinitionSchema;
191:            }
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.