Source Code Cross Referenced for WebDAVResourceRepository.java in  » Workflow-Engines » obe-1.0 » org » obe » server » j2ee » repository » 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 » obe 1.0 » org.obe.server.j2ee.repository 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.obe.server.j2ee.repository;
002:
003:        import org.apache.commons.logging.Log;
004:        import org.apache.commons.logging.LogFactory;
005:        import org.apache.slide.event.ContentEvent;
006:        import org.apache.slide.event.ContentListener;
007:        import org.apache.slide.event.EventDispatcher;
008:        import org.apache.slide.event.VetoException;
009:        import org.obe.client.api.repository.RepositoryException;
010:        import org.obe.engine.repository.BasicResourceRepository;
011:        import org.obe.spi.event.ApplicationEvent;
012:        import org.obe.spi.service.ApplicationEventBroker;
013:        import org.obe.spi.service.ServiceManager;
014:
015:        import javax.servlet.*;
016:        import javax.servlet.http.HttpServletRequest;
017:        import java.io.IOException;
018:        import java.util.EventListener;
019:        import java.util.HashMap;
020:        import java.util.Map;
021:
022:        /**
023:         * A resource repository that is implemented upon a Jakarta Slide WebDAV
024:         * document store. At least, that's the longer term intention. For now, we'll
025:         * just register a listener for WebDAV events and forward them to the
026:         * application event broker so that we can trigger workflows from WebDAV
027:         * actions.
028:         * <br/>
029:         * N.B. When we finally do implement all operations by delegating to the WebDAV
030:         * repository, we must make sure that the calls enlist the repository in the
031:         * transaction.
032:         *
033:         * @author Adrian Price
034:         */
035:        public class WebDAVResourceRepository extends BasicResourceRepository {
036:            private static final Log _logger = LogFactory
037:                    .getLog(EventForwarder.class);
038:            private static final ThreadLocal _requestURL = new ThreadLocal();
039:            private final EventListener _listener = new EventForwarder();
040:            private final ApplicationEventBroker _eventBroker;
041:
042:            public static class WebDAVServletContextListener implements 
043:                    ServletContextListener {
044:                public WebDAVServletContextListener() {
045:                }
046:
047:                public void contextInitialized(ServletContextEvent event) {
048:                    _logger.debug(event);
049:                }
050:
051:                public void contextDestroyed(ServletContextEvent event) {
052:                    _logger.debug(event);
053:                }
054:            }
055:
056:            public static class EventFilter implements  Filter {
057:                public void init(FilterConfig filterConfig)
058:                        throws ServletException {
059:                }
060:
061:                public void doFilter(ServletRequest request,
062:                        ServletResponse response, FilterChain chain)
063:                        throws IOException, ServletException {
064:
065:                    HttpServletRequest httpRequest = (HttpServletRequest) request;
066:                    StringBuffer requestURL = httpRequest.getRequestURL();
067:                    _requestURL.set(requestURL == null ? null : requestURL
068:                            .toString());
069:
070:                    chain.doFilter(request, response);
071:                }
072:
073:                public void destroy() {
074:                }
075:            }
076:
077:            public class EventForwarder implements  ContentListener {
078:                public void create(ContentEvent event) throws VetoException {
079:                    _logger.info("WebDAV.create: " + event);
080:                    fireApplicationEvent(event, "create");
081:                }
082:
083:                public void fork(ContentEvent event) throws VetoException {
084:                    _logger.info("WebDAV.fork: " + event);
085:                    fireApplicationEvent(event, "fork");
086:                }
087:
088:                public void merge(ContentEvent event) throws VetoException {
089:                    _logger.info("WebDAV.merge: " + event);
090:                    fireApplicationEvent(event, "merge");
091:                }
092:
093:                public void remove(ContentEvent event) throws VetoException {
094:                    _logger.info("WebDAV.remove: " + event);
095:                    fireApplicationEvent(event, "remove");
096:                }
097:
098:                public void retrieve(ContentEvent event) throws VetoException {
099:                    _logger.info("WebDAV.retrieve: " + event);
100:                    fireApplicationEvent(event, "retrieve");
101:                }
102:
103:                public void store(ContentEvent event) throws VetoException {
104:                    _logger.info("WebDAV.store: " + event);
105:                    fireApplicationEvent(event, "store");
106:                }
107:
108:            }
109:
110:            private static String requestURL() {
111:                return (String) _requestURL.get();
112:            }
113:
114:            public WebDAVResourceRepository(ServiceManager svcMgr) {
115:                super (svcMgr);
116:                _eventBroker = getServiceManager().getApplicationEventBroker();
117:            }
118:
119:            public synchronized void init() throws IOException,
120:                    RepositoryException {
121:                super .init();
122:                EventDispatcher.getInstance().addEventListener(_listener);
123:            }
124:
125:            public synchronized void exit() {
126:                super .exit();
127:            }
128:
129:            public String getServiceName() {
130:                return "ResourceRepository";
131:            }
132:
133:            private void fireApplicationEvent(ContentEvent event, String action) {
134:                try {
135:                    Map props = new HashMap();
136:                    props.put(ApplicationEvent.ACTION, action);
137:                    props.put("requestURL", requestURL());
138:                    _eventBroker.publish(event, props);
139:                } catch (Exception e) {
140:                    _logger.error(e);
141:                }
142:            }
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.