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


001:        /*
002:         * $Id: GenUtil.java,v 1.4 2002/02/25 19:50:55 valis Exp $
003:         *
004:         * ==========================================================================
005:         *
006:         * The JGenerator Software License, Version 1.0
007:         *
008:         * Copyright (c) 2000 Dmitry Skavish (skavish@usa.net). All rights reserved.
009:         *
010:         * Redistribution and use in source and binary forms, with or without
011:         * modification, are permitted provided that the following conditions are met:
012:         *
013:         * 1. Redistributions of source code must retain the above copyright
014:         *    notice, this list of conditions and the following disclaimer.
015:         *
016:         * 2. Redistributions in binary form must reproduce the above copyright
017:         *    notice, this list of conditions and the following disclaimer in
018:         *    the documentation and/or other materials provided with the
019:         *    distribution.
020:         *
021:         * 3. The end-user documentation included with the redistribution, if
022:         *    any, must include the following acknowlegement:
023:         *    "This product includes software developed by Dmitry Skavish
024:         *     (skavish@usa.net, http://www.flashgap.com/)."
025:         *    Alternately, this acknowlegement may appear in the software itself,
026:         *    if and wherever such third-party acknowlegements normally appear.
027:         *
028:         * 4. The name "The JGenerator" must not be used to endorse or promote
029:         *    products derived from this software without prior written permission.
030:         *    For written permission, please contact skavish@usa.net.
031:         *
032:         * 5. Products derived from this software may not be called "The JGenerator"
033:         *    nor may "The JGenerator" appear in their names without prior written
034:         *    permission of Dmitry Skavish.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL DMITRY SKAVISH OR THE OTHER
040:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         *
049:         */
050:
051:        package org.openlaszlo.iv.flash;
052:
053:        import java.io.*;
054:        import java.util.*;
055:
056:        import org.openlaszlo.iv.flash.api.*;
057:        import org.openlaszlo.iv.flash.parser.*;
058:        import org.openlaszlo.iv.flash.util.*;
059:        import org.openlaszlo.iv.flash.context.*;
060:
061:        /**
062:         * @deprecated It is now prefered to use the API directly since it has gotten
063:         *             easier to use, and supports more advanced features. This class
064:         *             only provides an interface to the most basic capabilities of
065:         *             JGenerator.
066:         *
067:         * The class provides high-level API to the JGenerator<br>
068:         * <br>
069:         * Usage:<br>
070:         * <pre>
071:         *   // install directory "c:\\jgenerator-v1.1.3" and log to console
072:         *   GenUtil.init( "c:\\jgenerator-v1.1.3", false );
073:         *   ...
074:         *   try {
075:         *     // parse file
076:         *     Object flashFile = GenUtil.parse( "d:\\templates\\cooltemplate.swt" );<br>
077:         *
078:         *     // define parameters. if your parameters are case unsensitive, you have to set
079:         *     // property iv.flash.varCaseSensitive in iv.properties file to false and add the
080:         *     // parameters' names in uppercase
081:         *     Hashtable parms = new Hashtable();
082:         *     parms.put( "DATASRC", "fgjdbc:///?driver=oracle.jdbc.driver.OracleDriver&url=jdbc:oracle:thin:username/password@lifu:1521:rs8i&query=select+*+from+flashtest+where+id>1" );<br>
083:         *
084:         *     // process file with given parameters
085:         *     GenUtil.process( flashFile, parms );<br>
086:         *
087:         *     // generate file
088:         *     InputStream is = GenUtil.generate( flashFile );<br>
089:         *
090:         *     // write to disk
091:         *     OutputStream out = new FileOutputStream( "d:\\movies\\coolmovie.swf" );
092:         *     int size;
093:         *     byte[] buffer = new byte[4096];
094:         *     while( (size=is.read(buffer, 0, buffer.length))>0 ) out.write(buffer, 0, size);
095:         *     out.close();
096:         *  } catch( IVException e ) {
097:         *    Log.logRB( e );
098:         *  }
099:         *
100:         * </pre>
101:         */
102:        public final class GenUtil {
103:
104:            /**
105:             * Parse specified .swt file and return instance of FlashFile object
106:             *
107:             * @param name name of .swt file to parse. name may be absolute or relative. in last case it's
108:             *             relative from the current directory.
109:             * @return instance of FlashFile.
110:             * @exception IVException thrown if some generator problems occured
111:             * @exception FileNotFoundException thrown if the given file cannot be found
112:             * @author Dmitry Skavish
113:             * @version 1.0
114:             */
115:            public static Object parse(String name) throws IVException,
116:                    FileNotFoundException {
117:                return FlashFile.parse(name);
118:            }
119:
120:            /**
121:             * Process given FlashFile object using given user parameters
122:             *
123:             * @param file FlashFile object obtained from parse method.
124:             * @param parms Hashtable of parameters. If property iv.flash.varCaseSensitive in iv.properties file
125:             *              set to false then parameter names <b>have</b> to be in uppercase.
126:             * @exception IVException thrown if some generator problems occured
127:             * @author Dmitry Skavish
128:             * @version 1.0
129:             */
130:            public static void process(Object file, Hashtable parms)
131:                    throws IVException {
132:                Context context = new StandardContext(parms);
133:                ((FlashFile) file).processFile(context);
134:            }
135:
136:            /**
137:             * Generate .swf file from given FlashFile
138:             *
139:             * @param file FlashFile object ibtained from process method
140:             * @return InputStream (ByteArrayInputStream)
141:             * @author Dmitry Skavish
142:             * @version 1.0
143:             */
144:            public static InputStream generate(Object file) throws IVException {
145:                FlashOutput fout = ((FlashFile) file).generate();
146:                return new ByteArrayInputStream(fout.getBuf(), 0, fout
147:                        .getSize());
148:            }
149:
150:            /**
151:             * Initialization. Has to be called once before all the others methods.
152:             *
153:             * @param installDir specifies absolute path to the directory where JGenerator is installed
154:             * @param logToFile  if true logging will be to log file (the one listed in the iv.properties file)
155:             *                   otherwise to console
156:             * @author Dmitry Skavish
157:             * @version 1.0
158:             */
159:            public static void init(String installDir, boolean logToFile) {
160:                Util.init(installDir);
161:                if (!logToFile) {
162:                    Log.setLogToConsole();
163:                }
164:            }
165:
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.