Source Code Cross Referenced for XSSLComponent.java in  » XML » activexml » org » xdev » base » xssl » 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 » XML » activexml » org.xdev.base.xssl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.xdev.base.xssl;
002:
003:        import org.xdev.base.core.Threaded;
004:        import org.xdev.base.core.object.*;
005:        import org.xdev.base.xssl.manage.ITransactionFinalizable;
006:
007:        import java.util.*;
008:
009:        /***
010:         * 
011:         * @author AYegorov
012:         * 
013:         * Company: xDev Group.org
014:         * 
015:         * URL: <a>http://activexml.dev.java.net</a>
016:         * 
017:         * File name: XSSLComponent.java
018:         * 
019:         * <p>Is bound: false</p>
020:         * 
021:         * <table>
022:         * 		<tr>
023:         * 			<td>Description:</td>
024:         * 			<td>An abstract factory that defines all of the logic for component instantiation and cloning </td>
025:         * 	    </tr>
026:         * </table>
027:         * <table>
028:         * 		<tr>
029:         * 			<td colspan="3">
030:         * 				Properties
031:         * 			</td>
032:         * 		</tr>
033:         * 		<tr>
034:         * 			<td>Name</td>
035:         * 			<td>Value</td>
036:         * 			<td>Description</td>
037:         * 		</tr>
038:         * </table>
039:         */
040:
041:        public abstract class XSSLComponent extends Configuration implements 
042:                Cloneable {
043:            public static final String LOOKUP_NAME = "lookup-name";
044:
045:            private HashMap indexedComponents = new HashMap();
046:
047:            private HashMap lookupComponents = new HashMap();
048:
049:            private HashMap boundComponents = new HashMap();
050:
051:            private ArrayList threads = new ArrayList();
052:
053:            private ArrayList finalizable = new ArrayList();
054:
055:            private String tagName = "";
056:
057:            public XSSLComponent(String id) {
058:                super (id);
059:            }
060:
061:            public XSSLComponent(String id, HashMap properties) {
062:                super (id, properties);
063:            }
064:
065:            public XSSLComponent getParentComponent() {
066:                return (XSSLComponent) this .getPropertyAsObject("$parent");
067:            }
068:
069:            public boolean hasParent() {
070:                return this .hasProperty("$parent");
071:            }
072:
073:            public XSSLComponent getRoot() {
074:                Object obj = this .getPropertyAsObject("$template");
075:
076:                return (XSSLComponent) obj;
077:            }
078:
079:            public ArrayList getElements(XSSLComponent parent, HashMap parents) {
080:                int size = this .getCount();
081:                ArrayList list = new ArrayList();
082:                parent.setParents(parents);
083:                XSSLComponent globalParent = null;
084:                for (int i = 0; i < size; i++) {
085:                    XSSLComponent c = (XSSLComponent) this .getElement(i);
086:                    XSSLComponent cloned = (XSSLComponent) c.newInstance(parent
087:                            .getRoot(), parent);
088:                    list.add(cloned);
089:                }
090:
091:                return list;
092:            }
093:
094:            public void setParents(HashMap cloneParents) {
095:                this .setProperty("$template", cloneParents.get("$template"));
096:                this .setProperty("$parent", cloneParents.get("$parent"));
097:            }
098:
099:            public synchronized Object newInstance(Object template,
100:                    Object parent) {
101:                HashMap parents = new HashMap();
102:                XSSLComponent c = (XSSLComponent) this .clone();
103:
104:                if (template == null) {
105:                    template = c;
106:                }
107:                if (parent == null) {
108:                    parent = c;
109:                }
110:
111:                c.setParent((XSSLAction) parent);
112:                c.setRoot((XSSLAction) template);
113:
114:                if (!(c instanceof  Threaded) && c instanceof  Runnable) {
115:                    if (this .getRoot() != null) {
116:                        this .getRoot().registerThread(c);
117:                    } else {
118:                        this .registerThread(c);
119:                    }
120:                }
121:
122:                if (c instanceof  ITransactionFinalizable) {
123:                    c.getRoot().addFinalizable(c);
124:                }
125:
126:                parents.put("$template", template);
127:                parents.put("$parent", parent);
128:
129:                c.setElements(this .getElements(c, parents));
130:
131:                if (this .getId() != null && !"".equals(this .getId())) {
132:                    if (template != null) {
133:                        ((XSSLComponent) template).addIndexedComponent(this 
134:                                .getId(), c);
135:                    }
136:                    if (parent != null) {
137:                        ((XSSLComponent) parent).addIndexedComponent(this 
138:                                .getId(), c);
139:                    }
140:                }
141:
142:                ArrayList lookup = new ArrayList(this .lookupComponents.values());
143:
144:                int size = lookup.size();
145:
146:                XSSLComponent component = null;
147:
148:                for (int i = 0; i < size; i++) {
149:                    component = (XSSLComponent) lookup.get(i);
150:                    c.addLookupComponent(component
151:                            .getProperty(XSSLComponent.LOOKUP_NAME),
152:                            (XSSLComponent) component.newInstance(template, c));
153:                    component = null;
154:                }
155:
156:                List elms = this .getActiveProperties();
157:
158:                int actSize = elms.size();
159:
160:                XSSLComponent actProp = null;
161:
162:                for (int i = 0; i < actSize; i++) {
163:
164:                    actProp = (XSSLComponent) elms.get(i);
165:
166:                    c.addElement((XSSLComponent) actProp.newInstance(template,
167:                            c));
168:
169:                    actProp = null;
170:                }
171:
172:                c.setCompiledName(this .getCompiledName());
173:
174:                parents = null;
175:                lookup = null;
176:                elms = null;
177:
178:                return c;
179:            }
180:
181:            public void addFinalizable(XSSLComponent c) {
182:                synchronized (this .finalizable) {
183:                    this .finalizable.add(c);
184:                }
185:            }
186:
187:            public List getFinalizableList() {
188:                return this .finalizable;
189:            }
190:
191:            public Object clone() {
192:                Object obj = null;
193:                try {
194:                    obj = this .createObject(this , new Object[] { this .getId(),
195:                            this .getProperties() },
196:                            "org.xdev.base.transaction.TransactionContainer");
197:                } catch (Exception ex) {
198:                }
199:
200:                return obj;
201:            }
202:
203:            public void addIndexedComponent(String id, XSSLComponent c) {
204:                this .indexedComponents.put(id, c);
205:            }
206:
207:            public XSSLComponent getIndexedComponent(String id) {
208:                return (XSSLComponent) this .indexedComponents.get(id);
209:            }
210:
211:            public void addLookupComponent(String id, XSSLComponent c) {
212:                this .lookupComponents.put(id, c);
213:            }
214:
215:            public XSSLComponent getLookupComponent(String id) {
216:                return (XSSLComponent) this .lookupComponents.get(id);
217:            }
218:
219:            public XSSLComponent lookup(String id) {
220:                return (XSSLComponent) this .lookupComponents.get(id);
221:            }
222:
223:            public void setRoot(XSSLComponent root) {
224:                this .setProperty("$template", root);
225:            }
226:
227:            public void setParent(XSSLComponent root) {
228:                this .setProperty("$parent", root);
229:            }
230:
231:            /**
232:             * @return Returns the tagName.
233:             */
234:            public String getTagName() {
235:                return tagName;
236:            }
237:
238:            /**
239:             * @param tagName The tagName to set.
240:             */
241:            public void setTagName(String tagName) {
242:                this .tagName = tagName;
243:            }
244:
245:            public void registerThread(XSSLComponent thread) {
246:                this .threads.add(thread);
247:            }
248:
249:            /**
250:             * @return Returns the indexedComponents.
251:             */
252:            public HashMap getIndexedComponents() {
253:                return indexedComponents;
254:            }
255:
256:            /**
257:             * @param indexedComponents The indexedComponents to set.
258:             */
259:            public void setIndexedComponents(HashMap indexedComponents) {
260:                this .indexedComponents = indexedComponents;
261:            }
262:
263:            /**
264:             * @return Returns the lookupComponents.
265:             */
266:            public HashMap getLookupComponents() {
267:                return lookupComponents;
268:            }
269:
270:            /**
271:             * @param lookupComponents The lookupComponents to set.
272:             */
273:            public void setLookupComponents(HashMap lookupComponents) {
274:                this .lookupComponents = lookupComponents;
275:            }
276:
277:            /**
278:             * @return Returns the threads.
279:             */
280:            public ArrayList getThreads() {
281:                return threads;
282:            }
283:
284:            /**
285:             * @param threads The threads to set.
286:             */
287:            public void setThreads(ArrayList threads) {
288:                this .threads = threads;
289:            }
290:
291:            /**
292:             * @param referenceId
293:             * @param children
294:             */
295:            public void addTemporaryBind(String name, List children) {
296:
297:                this .boundComponents.put(name, children);
298:            }
299:
300:            public List getTemporaryBind(String name) {
301:                List children = (List) this .boundComponents.get(name);
302:
303:                if (children == null) {
304:                    return null;
305:                }
306:
307:                ArrayList newChildren = new ArrayList();
308:
309:                int size = children.size();
310:
311:                for (int i = 0; i < size; i++) {
312:                    newChildren.add(((XSSLComponent) children.get(i))
313:                            .newInstance(this.getParentComponent(), this
314:                                    .getRoot()));
315:                }
316:
317:                return newChildren;
318:            }
319:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.