Source Code Cross Referenced for GeneratorContext.java in  » Content-Management-System » webman » de » webman » generator » 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 » Content Management System » webman » de.webman.generator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.webman.generator;
002:
003:        import com.teamkonzept.lib.*;
004:        import java.io.*;
005:        import java.util.LinkedList;
006:
007:        import org.apache.log4j.Category;
008:
009:        /**
010:
011:         Diese Klasse haelt alle Status Informationen
012:         eines Previews, damit mehrere Previews threadsicher
013:         ablaufen koennen
014:         * @author  $Author: alex $
015:         * @version $Revision: 1.6 $
016:         */
017:        public class GeneratorContext {
018:
019:            /** Logging Category */
020:            private static Category cat = Category
021:                    .getInstance(GeneratorContext.class);
022:
023:            /**
024:             * cache für bereits geladene content forms
025:             **/
026:            public ContentFormStatics contentForms;
027:
028:            public SiteContentStatics siteContents;
029:            public SiteContentIntegrationStatics integrations;
030:            public ContentCallStatics contentCalls;
031:            public SiteContentNodeStatics contentNodes;
032:            public ReferenceTypeStatics referenceTypes;
033:            public SiteNodeStatics siteNodes;
034:            public GenNodeStatics genNodes;
035:            public GenDocumentStatics genDocuments;
036:            public SiteReferenceStatics siteReferences;
037:
038:            /**
039:             * zum Auffinden von Zyklen bei referenzen.  cycleLookup is used as a
040:             * stack (contains TKHashtable denoting the current scope) 
041:             */
042:            private LinkedList cycleLookup = new LinkedList();
043:
044:            private static TKHashtable lookup = null;
045:
046:            private static boolean share = false;
047:            private static boolean sharingSetup = false;
048:            private static Thread initialThread = Thread.currentThread();
049:
050:            /** aktuell generiertes Dokument */
051:            private static GenDocument currentDocument;
052:
053:            /** wird inkrementell generiert ? */
054:            private static boolean isIncremental = false;
055:
056:            /** wird der Workflow beachtet ? */
057:            private boolean ignoreWorkflow = false;
058:
059:            /**
060:            Indicates, if the site tree generation is used for the generator (default)
061:            or preview. In the latter case, all content is generated, else only 
062:            the content which status is marked 'generate' in the database 
063:            VERSION_STATUS attributes.  From now on only important for the references,
064:             Workflow is managed by ignoreWorkflow
065:             */
066:            private static boolean isPreviewMode;
067:
068:            public GeneratorContext() {
069:                contentForms = new ContentFormStatics(this );
070:                siteContents = new SiteContentStatics(this );
071:                integrations = new SiteContentIntegrationStatics(this );
072:                contentCalls = new ContentCallStatics(this );
073:                contentNodes = new SiteContentNodeStatics(this );
074:                referenceTypes = new ReferenceTypeStatics(this );
075:                siteNodes = new SiteNodeStatics(this );
076:                genNodes = new GenNodeStatics(this );
077:                genDocuments = new GenDocumentStatics(this );
078:                siteReferences = new SiteReferenceStatics(this );
079:            }
080:
081:            /**
082:             * @return ob der der Generator im Preview Modus betrieben wird
083:             */
084:            public static boolean isPreviewMode() {
085:                return isPreviewMode;
086:            }
087:
088:            public static void setPreviewMode(boolean mode) {
089:                isPreviewMode = mode;
090:            }
091:
092:            public boolean isWorkflowIgnored() {
093:                return ignoreWorkflow;
094:            }
095:
096:            public void setWorkflowIgnored(boolean ignore) {
097:                ignoreWorkflow = ignore;
098:            }
099:
100:            public static boolean isShared() {
101:                return share;
102:            }
103:
104:            public static synchronized GeneratorContext setup(Thread myThread) {
105:                if (share)
106:                    myThread = initialThread;
107:
108:                if (myThread == null)
109:                    myThread = Thread.currentThread();
110:                if (lookup == null)
111:                    lookup = new TKHashtable();
112:
113:                GeneratorContext statics = (GeneratorContext) lookup
114:                        .get(myThread);
115:                if (statics != null)
116:                    return statics;
117:
118:                statics = new GeneratorContext();
119:                lookup.put(myThread, statics);
120:
121:                return statics;
122:            }
123:
124:            public static GeneratorContext setup() {
125:                return setup(Thread.currentThread());
126:            }
127:
128:            static {
129:                setupSharing();
130:            }
131:
132:            public synchronized static void setupSharing() {
133:                if (sharingSetup)
134:                    return;
135:                try {
136:                    PropertyManager man = PropertyManager
137:                            .getPropertyManager("GENERATION");
138:                    String preview = man.getValue("PREVIEW_SHARE", "");
139:                    share = preview.equalsIgnoreCase("TRUE");
140:                    sharingSetup = true;
141:                } catch (Exception e) {
142:                    cat.info("No Preview Property Set");
143:                }
144:            }
145:
146:            public static void cleanup() {
147:                cleanup(Thread.currentThread());
148:            }
149:
150:            public static void cleanup(Thread myThread) {
151:                if (share)
152:                    return;
153:                if (myThread == null)
154:                    myThread = Thread.currentThread();
155:                if (lookup != null)
156:                    lookup.remove(myThread);
157:            }
158:
159:            public Object getCycle(Integer instanceID) {
160:                if (cycleLookup.size() != 0) {
161:                    int sm = cycleLookup.size();
162:                    for (int sc = 0; sc < sm; sc++) {
163:                        TKHashtable clt = (TKHashtable) cycleLookup.get(sc);
164:                        Object o = clt.get(instanceID);
165:
166:                        if (o != null)
167:                            return o;
168:                    }
169:                }
170:                return null;
171:            }
172:
173:            public void setCycle(Integer instanceID) {
174:                TKHashtable clt = currentCycleScope();
175:                clt.put(instanceID, "1");
176:            }
177:
178:            public void clearCycle() {
179:                cat.debug("Cycle cleared");
180:                cycleLookup.clear();
181:            }
182:
183:            /**
184:             * Referenz wird weiter verschachtelt
185:             */
186:            public void push() {
187:                pushCycleScope();
188:            }
189:
190:            /**
191:             * Referenz ist beendet
192:             */
193:            public void pop() {
194:                popCycleScope();
195:            }
196:
197:            /* ----------------------------------------------------------------------
198:               functions for the cycle detection stack
199:               ---------------------------------------------------------------------- */
200:            private TKHashtable currentCycleScope() {
201:                TKHashtable clt = null;
202:
203:                if (cycleLookup.size() == 0) {
204:                    // lazy initialization
205:                    clt = new TKHashtable();
206:                    cycleLookup.addFirst(clt);
207:                } else
208:                    clt = (TKHashtable) cycleLookup.getFirst();
209:
210:                return clt;
211:            }
212:
213:            private void pushCycleScope() {
214:                TKHashtable clt = new TKHashtable();
215:                cycleLookup.addFirst(clt);
216:            }
217:
218:            private void popCycleScope() {
219:                if (cycleLookup.size() > 0)
220:                    cycleLookup.removeFirst();
221:            }
222:
223:            /**
224:             *  getter fuer isIncremental
225:             * @return ob inkrementell generiert wird
226:             */
227:            public static boolean isIncremental() {
228:                return isIncremental;
229:            }
230:
231:            /**
232:             * Setzen der inkr. Generierung
233:             * @param incremental boolscher Wert fuer inkr. Generierung
234:             */
235:            public static void setIncremental(boolean incremental) {
236:                isIncremental = incremental;
237:            }
238:
239:            /**
240:             * @return das aktuell generierte Dokument, null falls nicht vorhanden
241:             */
242:            public static GenDocument getCurrentDocument() {
243:                return currentDocument;
244:            }
245:
246:            /**
247:             * @param document das aktuell generierte Dokument
248:             */
249:            public static void setCurrentDocument(GenDocument document) {
250:                currentDocument = document;
251:            }
252:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.