Source Code Cross Referenced for ExternalContainer.java in  » Web-Server » Jigsaw » org » w3c » tools » resources » 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 » Web Server » Jigsaw » org.w3c.tools.resources 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ExternalContainer.java
002:        // $Id: ExternalContainer.java,v 1.6 2002/06/26 17:27:43 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.tools.resources;
007:
008:        import java.util.Enumeration;
009:        import java.util.Hashtable;
010:        import java.io.File;
011:
012:        /**
013:         * A Container which manage an external store, outside the space.
014:         */
015:        public abstract class ExternalContainer extends ContainerResource {
016:
017:            /**
018:             * Our transientFlag, is true that container must not be saved.
019:             */
020:            protected boolean transientFlag = false;
021:
022:            /**
023:             * Our external repository.
024:             */
025:            protected File repository = null;
026:
027:            public ResourceReference createDefaultResource(String name) {
028:                throw new RuntimeException("not extensible");
029:            }
030:
031:            /**
032:             * Mark this resource as having been modified.
033:             */
034:            public void markModified() {
035:                if (transientFlag) {
036:                    setValue(ATTR_LAST_MODIFIED, new Long(System
037:                            .currentTimeMillis()));
038:                } else {
039:                    super .markModified();
040:                }
041:            }
042:
043:            /**
044:             * acquire children and notify space if we will be saved.
045:             */
046:            protected synchronized void acquireChildren() {
047:                if (!acquired) {
048:                    ResourceSpace space = getSpace();
049:                    if (repository != null) {
050:                        space.acquireChildren(getChildrenSpaceEntry(),
051:                                repository, transientFlag);
052:                    } else {
053:                        // if we have been saved one time yet.
054:                        space.acquireChildren(getChildrenSpaceEntry());
055:                    }
056:                    acquired = true;
057:                }
058:            }
059:
060:            /**
061:             * Delete this Resource instance , and remove it from its store.
062:             * This method will erase definitely this resource, for ever, by removing
063:             * it from its resource store (when doable).
064:             * @exception MultipleLockException if someone has locked this resource.
065:             */
066:
067:            public synchronized void delete() throws MultipleLockException {
068:                if (transientFlag) {
069:                    // transient, so don't try to delete myself.
070:                    ResourceSpace space = getSpace();
071:                    if (space != null) {
072:                        acquireChildren();
073:                        // check for lock on children
074:                        Enumeration e = enumerateResourceIdentifiers();
075:                        ResourceReference rr = null;
076:                        Resource resource = null;
077:                        while (e.hasMoreElements()) {
078:                            rr = lookup((String) e.nextElement());
079:                            if (rr != null) {
080:                                try {
081:                                    synchronized (rr) {
082:                                        resource = rr.lock();
083:                                        resource.delete();
084:                                    }
085:                                } catch (InvalidResourceException ex) {
086:                                    // nothing, remove invalid resource.
087:                                } finally {
088:                                    rr.unlock();
089:                                }
090:                            }
091:                        }
092:                        space.deleteChildren(getChildrenSpaceEntry());
093:                    }
094:                } else {
095:                    super .delete();
096:                }
097:            }
098:
099:            /**
100:             * Get The repository for this external container.
101:             * Warning: called in the constructor!
102:             * @param context The container context.
103:             * @return A File instance
104:             */
105:            abstract public File getRepository(ResourceContext context);
106:
107:            public void initialize(Object values[]) {
108:                super .initialize(values);
109:                if (repository == null)
110:                    repository = getRepository(getContext());
111:            }
112:
113:            /**
114:             * @param id The identifier.
115:             * @param context The default context.
116:             * @param transientFlag The transient flag.
117:             */
118:
119:            public ExternalContainer(String identifier,
120:                    ResourceContext context, boolean transientFlag) {
121:                Hashtable h = new Hashtable(3);
122:                h.put(id, identifier);
123:                h.put(co, context);
124:                initialize(h);
125:                this .acquired = false;
126:                this .transientFlag = transientFlag;
127:                if (transientFlag)
128:                    context.setResourceReference(new DummyResourceReference(
129:                            this ));
130:            }
131:
132:            public ExternalContainer() {
133:                super ();
134:                this .acquired = false;
135:                this .transientFlag = false;
136:                this.repository = null;
137:            }
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.