Source Code Cross Referenced for RuntimeRepository.java in  » Report » pentaho-report » org » pentaho » repository » runtime » 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 » pentaho report » org.pentaho.repository.runtime 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created Jun 15, 2005 
014:         * @author Marc Batchelor
015:         * 
016:         */
017:        package org.pentaho.repository.runtime;
018:
019:        import java.util.Collection;
020:        import java.util.List;
021:        import org.apache.commons.logging.Log;
022:        import org.apache.commons.logging.LogFactory;
023:        import org.hibernate.HibernateException;
024:        import org.hibernate.Session;
025:        import org.pentaho.core.repository.IRuntimeRepository;
026:        import org.pentaho.core.repository.IRuntimeElement;
027:        import org.pentaho.repository.runtime.RuntimeElement;
028:        import org.pentaho.core.session.IPentahoSession;
029:        import org.pentaho.core.system.IPentahoInitializer;
030:        import org.pentaho.core.system.PentahoBase;
031:        import org.pentaho.core.system.PentahoSystem;
032:        import org.pentaho.messages.Messages;
033:        import org.pentaho.repository.HibernateUtil;
034:        import org.pentaho.core.repository.RepositoryException;
035:        import org.pentaho.util.UUIDUtil;
036:
037:        public class RuntimeRepository extends PentahoBase implements 
038:                IRuntimeRepository, IPentahoInitializer {
039:
040:            /**
041:             * 
042:             */
043:            private static final long serialVersionUID = -6093228119094501691L;
044:
045:            private static final boolean debug = PentahoSystem.debug;
046:
047:            private static Log log = LogFactory.getLog(RuntimeRepository.class);
048:
049:            private static final ThreadLocal threadSession = new ThreadLocal();
050:
051:            /**
052:             * @return Returns the userSession.
053:             */
054:            public static IPentahoSession getUserSession() {
055:                IPentahoSession userSession = (IPentahoSession) threadSession
056:                        .get();
057:                return userSession;
058:            }
059:
060:            public RuntimeRepository() {
061:
062:            }
063:
064:            public List getMessages() {
065:                return null;
066:            }
067:
068:            public static IRuntimeRepository getInstance(IPentahoSession sess) {
069:                IRuntimeRepository repo = new RuntimeRepository();
070:                repo.setSession(sess);
071:                return repo;
072:            }
073:
074:            public void setSession(IPentahoSession sess) {
075:                threadSession.set(sess);
076:                genLogIdFromSession(getUserSession());
077:                HibernateUtil.beginTransaction();
078:            }
079:
080:            public void init(IPentahoSession sess) {
081:                this .setSession(sess);
082:            }
083:
084:            /**
085:             * Loads an existing RuntimeElement
086:             * 
087:             * @param instId
088:             *            The instance Id
089:             * @return the RuntimeElement
090:             * @throws RepositoryException
091:             */
092:            public IRuntimeElement loadElementById(String instId,
093:                    Collection allowableReadAttributeNames)
094:                    throws RepositoryException {
095:                if (debug)
096:                    debug(Messages.getString(
097:                            "RTREPO.DEBUG_LOAD_ELEMENT_BY_ID", instId)); //$NON-NLS-1$
098:                Session session = HibernateUtil.getSession();
099:                try {
100:                    RuntimeElement runtimeElement = (RuntimeElement) session
101:                            .load(RuntimeElement.class, instId);
102:                    runtimeElement
103:                            .setAllowableAttributeNames(allowableReadAttributeNames);
104:                    return runtimeElement;
105:                } catch (HibernateException ex) {
106:                    error(Messages.getErrorString(
107:                            "RTREPO.ERROR_0001_LOAD_ELEMENT", instId), ex); //$NON-NLS-1$
108:                    throw new RepositoryException(Messages.getErrorString(
109:                            "RTREPO.ERROR_0001_LOAD_ELEMENT", instId), ex); //$NON-NLS-1$
110:                }
111:            }
112:
113:            /**
114:             * 
115:             * Creates a new RuntimeElement
116:             * 
117:             * @param parId
118:             *            Parent ID of this instance
119:             * @param parType
120:             *            Parent type of the instance
121:             * @return the created runtime element
122:             */
123:            public IRuntimeElement newRuntimeElement(String parId,
124:                    String parType, boolean transientOnly) {
125:                if (debug)
126:                    debug(Messages.getString(
127:                            "RTREPO.DEBUG_NEW_ELEMENT_PARENT", parId, parType)); //$NON-NLS-1$
128:                Session session = HibernateUtil.getSession();
129:                String instanceId = UUIDUtil.getUUIDAsString();
130:                if (debug)
131:                    debug(Messages.getString(
132:                            "RTREPO.DEBUG_CREATE_INSTANCE", instanceId)); //$NON-NLS-1$
133:                RuntimeElement re = new RuntimeElement(instanceId, parId,
134:                        parType);
135:                if (!transientOnly) {
136:                    try {
137:                        session.save(re);
138:                    } catch (HibernateException ex) {
139:                        error(
140:                                Messages
141:                                        .getErrorString("RTREPO.ERROR_0002_SAVING_ELEMENT"), ex); //$NON-NLS-1$
142:                        throw new RepositoryException(
143:                                Messages
144:                                        .getErrorString("RTREPO.ERROR_0002_SAVING_ELEMENT"), ex);//$NON-NLS-1$
145:                    }
146:                }
147:                return re;
148:            }
149:
150:            /**
151:             * 
152:             * Creates a new RuntimeElement
153:             * 
154:             * @param parId
155:             *            Parent Id of the runtime element
156:             * @param parType
157:             *            Parent type of the runtime element
158:             * @param solnId
159:             *            Solution Id of the element
160:             * @return The created runtime element
161:             */
162:            public IRuntimeElement newRuntimeElement(String parId,
163:                    String parType, String solnId, boolean transientOnly) {
164:                if (debug)
165:                    debug(Messages
166:                            .getString(
167:                                    "RTREPO.DEBUG_NEW_ELEMENT_PARENT_SOLN", parId, parType, solnId)); //$NON-NLS-1$
168:                Session session = HibernateUtil.getSession();
169:                String instanceId = UUIDUtil.getUUIDAsString();
170:                if (debug)
171:                    debug(Messages.getString(
172:                            "RTREPO.DEBUG_CREATE_INSTANCE", instanceId)); //$NON-NLS-1$
173:                RuntimeElement re = new RuntimeElement(instanceId, parId,
174:                        parType, solnId);
175:                if (!transientOnly) {
176:                    try {
177:                        session.save(re);
178:                    } catch (HibernateException ex) {
179:                        error(
180:                                Messages
181:                                        .getErrorString("RTREPO.ERROR_0003_SAVING_ELEMENT"), ex); //$NON-NLS-1$
182:                        throw new RepositoryException(
183:                                Messages
184:                                        .getErrorString("RTREPO.ERROR_0003_SAVING_ELEMENT"), ex); //$NON-NLS-1$
185:                    }
186:                }
187:                return re;
188:            }
189:
190:            /* ILogger Needs */
191:            public Log getLogger() {
192:                return log;
193:            }
194:
195:            public boolean usesHibernate() {
196:                return true;
197:            }
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.