Source Code Cross Referenced for BonitaProjectExecutor.java in  » Workflow-Engines » bonita-v3.1 » mc » formgenerator » bonita » 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 » Workflow Engines » bonita v3.1 » mc.formgenerator.bonita 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 21 avr. 2004
003:         *
004:         * This class creates a Bonita process instance
005:         * thanks to the process parameters given in a XML file
006:         *
007:         */
008:        package mc.formgenerator.bonita;
009:
010:        import java.io.File;
011:        import java.io.IOException;
012:        import java.net.MalformedURLException;
013:        import java.util.HashMap;
014:        import java.util.Hashtable;
015:        import java.util.Iterator;
016:        import java.util.Collection;
017:        import java.util.Set;
018:        import java.util.Vector;
019:
020:        import org.apache.xerces.parsers.DOMParser;
021:        import org.w3c.dom.Document;
022:        import org.xml.sax.SAXException;
023:
024:        import hero.interfaces.*;
025:        import hero.util.HeroException;
026:
027:        /**
028:         * Given instance document with properties, initializes a project
029:         */
030:        public class BonitaProjectExecutor {
031:
032:            /**
033:             * Default class constructor
034:             *
035:             */
036:            public BonitaProjectExecutor() {
037:            }
038:
039:            /**
040:             * Instanciate a process thanks to its data which are in a XML file.
041:             * @param fichier XML file with the process information.
042:             * @throws MalformedURLException
043:             * @throws SAXException
044:             * @throws IOException
045:             * @throws LoginException
046:             */
047:            public void startBonitaProject(File fichier, Vector req_parameters,
048:                    boolean formsExists, String version)
049:                    throws MalformedURLException, SAXException, IOException,
050:                    Exception {
051:
052:                //**********************************************************************
053:                //						FILE --> DOCUMENT
054:                //**********************************************************************
055:
056:                //A parser is needed to read an XML file
057:                DOMParser parser = new DOMParser();
058:
059:                //the parser parse the XML file
060:                parser.parse(fichier.toURL().toString());
061:
062:                //get a Document which represents the File. It's to normalyse the data manipulated
063:                Document document = parser.getDocument();
064:
065:                //'parse' transforms a Document into a DataProcess
066:                DocumentParser parse = new DocumentParser();
067:
068:                DataProject data = parse.parseProject(document, req_parameters,
069:                        formsExists);
070:
071:                //wants the process name
072:                String name = data.getProjectName();
073:
074:                //wants the process properties
075:                HashMap table = data.getProjectProperties();
076:
077:                //start the process
078:                instanciateProject(name, version, table);
079:
080:            }
081:
082:            /**
083:             * Instanciate a process thanks to its data which are in a Document.
084:             * @param document Document with the process information.
085:             * @throws MalformedURLException
086:             * @throws SAXException
087:             * @throws IOException
088:             * @throws LoginException
089:             */
090:            public String startBonitaProject(Document document,
091:                    Vector req_parameters, boolean formsExists, String version)
092:                    throws MalformedURLException, SAXException, IOException,
093:                    Exception {
094:
095:                String instance = null;
096:
097:                //'parse' transforms a Document into a DataProcess
098:                DocumentParser parse = new DocumentParser();
099:
100:                DataProject data = parse.parseProject(document, req_parameters,
101:                        formsExists);
102:
103:                //get the process name & version
104:                String name = data.getProjectName();
105:
106:                //get the process properties
107:                HashMap table = data.getProjectProperties();
108:
109:                //start the process thanks to its name, version and properties
110:                instance = instanciateProject(name, version, table);
111:                return instance;
112:            }
113:
114:            /**
115:             * Instanciate the process thanks to its name and its parameters which are in a XML file
116:             * @param processName Name of the process to instanciate.
117:             * @param table HashMap with 'key value' representing the process properties. 'Key' is the property name and 'Value' is its value.
118:             * @throws LoginException
119:             */
120:            private String instanciateProject(String processName,
121:                    String processVersion, HashMap table) throws Exception {
122:
123:                //The local home
124:                ProjectSessionHome projecth = null;
125:
126:                //The bean
127:                ProjectSession project = null;
128:
129:                //The instance name
130:                String instance = null;
131:
132:                try {
133:
134:                    //**************************************************************************
135:                    //					INSTANCIATE THE PROCESS
136:                    //**************************************************************************
137:
138:                    //Getting local home by using JNDI
139:                    projecth = ProjectSessionUtil.getHome();
140:
141:                    //Creation of the project
142:                    project = projecth.create();
143:
144:                    //Project instanciation
145:                    if (processVersion == null)
146:                        instance = project.instantiateProject(processName,
147:                                new Hashtable(table));
148:                    else
149:                        instance = project.instantiateProject(processName,
150:                                processVersion, new Hashtable(table));
151:                    //project.initProject(processName);
152:
153:                    project.remove();
154:
155:                } catch (Exception e) {
156:                    try {
157:                        if (project != null)
158:                            project.remove();
159:                    } catch (Exception re) {
160:                        System.out.println(re + " " + e.getMessage());
161:                    }
162:                    //System.out.println(e.getMessage());
163:                    throw new Exception(e.getMessage());
164:                }
165:                return instance;
166:            }
167:
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.