Source Code Cross Referenced for CachedInfo.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » cm » 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 » Ajax » Laszlo 4.0.10 » org.openlaszlo.cm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* *****************************************************************************
002:         * CachedInfo.java
003:         * ****************************************************************************/
004:
005:        /* J_LZ_COPYRIGHT_BEGIN *******************************************************
006:         * Copyright 2001-2004 Laszlo Systems, Inc.  All Rights Reserved.              *
007:         * Use is subject to license terms.                                            *
008:         * J_LZ_COPYRIGHT_END *********************************************************/
009:
010:        package org.openlaszlo.cm;
011:
012:        import org.openlaszlo.compiler.*;
013:
014:        import java.io.File;
015:        import java.io.FileInputStream;
016:        import java.io.FileNotFoundException;
017:        import java.io.FileOutputStream;
018:        import java.io.IOException;
019:        import java.io.ObjectInputStream;
020:        import java.io.ObjectOutputStream;
021:        import java.io.Serializable;
022:
023:        import org.apache.log4j.*;
024:
025:        /** A <code>CachedInfo</code> contains all the information
026:         * we cache from a compilation.  This includes dependency information
027:         * and the canvas.
028:         *
029:         * @author  Oliver Steele
030:         */
031:        public class CachedInfo implements  Serializable {
032:
033:            private final static Logger mLogger = Logger
034:                    .getLogger(CachedInfo.class);
035:            private final DependencyTracker mTracker;
036:            private final Canvas mCanvas;
037:            private final String mEncoding;
038:
039:            /**
040:             * Construct a CachedInfo
041:             * @param tracker the DependencyTracker
042:             * @param canvas the Canvas
043:             */
044:            public CachedInfo(DependencyTracker tracker, Canvas canvas,
045:                    String encoding) {
046:                mTracker = tracker;
047:                mCanvas = canvas;
048:                mEncoding = encoding;
049:            }
050:
051:            /**
052:             * Read a CachedInfo from an existing file.
053:             */
054:            public static CachedInfo readFrom(File file)
055:                    throws CompilationError {
056:                CachedInfo info = null;
057:
058:                try {
059:                    FileInputStream istream = new FileInputStream(file);
060:                    try {
061:                        ObjectInputStream p = new ObjectInputStream(istream);
062:                        return (CachedInfo) p.readObject();
063:                    } finally {
064:                        istream.close();
065:                    }
066:                } catch (java.io.InvalidClassException ioe) {
067:                } catch (FileNotFoundException ioe) {
068:                } catch (IOException ioe) {
069:                    CompilationError e = new CompilationError(ioe);
070:                    e.initPathname(file.getPath());
071:                    mLogger.error(e.getMessage());
072:                    throw e;
073:                } catch (ClassNotFoundException cnfe) {
074:                }
075:                return new CachedInfo(null, null, null);
076:            }
077:
078:            /** Write a CachedInfo to an existing file
079:             * @param file a File to save to
080:             * @throws IOException if an error occurs
081:             */
082:            void writeTo(File file) throws IOException {
083:                mLogger.debug(
084:                /* (non-Javadoc)
085:                 * @i18n.test
086:                 * @org-mes="writeTo " + p[0]
087:                 */
088:                org.openlaszlo.i18n.LaszloMessages.getMessage(CachedInfo.class
089:                        .getName(), "051018-86", new Object[] { file
090:                        .getAbsolutePath() }));
091:                File dir = file.getParentFile();
092:                if (dir != null) {
093:                    dir.mkdirs();
094:                }
095:                file.createNewFile();
096:                FileOutputStream ostream = new FileOutputStream(file);
097:                ObjectOutputStream p = new ObjectOutputStream(ostream);
098:                p.writeObject(this );
099:                p.flush();
100:                ostream.close();
101:            }
102:
103:            public Canvas getCanvas() {
104:                mLogger.debug(
105:                /* (non-Javadoc)
106:                 * @i18n.test
107:                 * @org-mes="Getting canvas with size " + p[0] + " by " + p[1]
108:                 */
109:                org.openlaszlo.i18n.LaszloMessages.getMessage(CachedInfo.class
110:                        .getName(), "051018-107", new Object[] {
111:                        new Integer(mCanvas.getWidth()),
112:                        new Integer(mCanvas.getHeight()) }));
113:                return mCanvas;
114:            }
115:
116:            public String getEncoding() {
117:                return mEncoding;
118:            }
119:
120:            public DependencyTracker getDependencyTracker() {
121:                return mTracker;
122:            }
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.