Source Code Cross Referenced for IConnectionErrorHandler.java in  » GIS » udig-1.1 » net » refractions » udig » catalog » ui » 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 » GIS » udig 1.1 » net.refractions.udig.catalog.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.refractions.udig.catalog.ui;
002:
003:        import java.io.IOException;
004:
005:        import net.refractions.udig.catalog.IService;
006:
007:        import org.eclipse.core.runtime.IProgressMonitor;
008:        import org.eclipse.swt.widgets.Composite;
009:        import org.eclipse.swt.widgets.Control;
010:
011:        /**
012:         * A class which is used to handle an error which occurs when attempting to connection to a service.
013:         * <p>
014:         * Connection error handlers have the following responsibilites:
015:         * <ul>
016:         * <li>Determining from a throwable object, if they can handle the error.
017:         * <li>Providing a ui which provides feedback about an error, and possibly a way to recover from
018:         * it.
019:         * </ul>
020:         * </p>
021:         * <p>
022:         * Connection error handlers are contributed by extending the
023:         * net.refractions.catalog.ui.connectionErrorHandler extension point.
024:         * </p>
025:         * <p>
026:         * Subclasses may overide the following methods.
027:         * <ul>
028:         * <li>canHandle(Throwable)
029:         * <li>canRecover()
030:         * <li>create(Composite)
031:         * </ul>
032:         * </p>
033:         * 
034:         * @author Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net
035:         */
036:        public abstract class IConnectionErrorHandler {
037:
038:            /** extension point id * */
039:            public static final String XPID = "net.refractions.catalog.ui.connectionErrorHandler"; //$NON-NLS-1$
040:
041:            /** name of handler, used in ui when more then one available * */
042:            private String name;
043:
044:            /** the control used by the handler * */
045:            private Control control;
046:
047:            /** the error * */
048:            private Throwable t;
049:
050:            /** the service handle * */
051:            private IService service;
052:
053:            /**
054:             * Sets the name for the handler. This name will be used to identify the handler in cases where
055:             * multiple handlers may wish to handle a single error.
056:             * 
057:             * @param name The name of the handler.
058:             */
059:            public void setName(String name) {
060:                this .name = name;
061:            }
062:
063:            /**
064:             * Return the name of the handler. This name will be used to identify the handler in cases where
065:             * multiple handlers may wish to handle a single error.
066:             * 
067:             * @return The name of the handler.
068:             */
069:            public String getName() {
070:                return name;
071:            }
072:
073:            /**
074:             * Sets the error being handled.
075:             * 
076:             * @param t The throwable object representing the error.
077:             */
078:            public void setThrowable(Throwable t) {
079:                this .t = t;
080:            }
081:
082:            /**
083:             * @return the error being handled.
084:             */
085:            public Throwable getThrowable() {
086:                return t;
087:            }
088:
089:            /**
090:             * @return the service being connected to.
091:             */
092:            public IService getService() {
093:                return service;
094:            }
095:
096:            /**
097:             * @param service The service being connected to.
098:             */
099:            public void setService(IService service) {
100:                this .service = service;
101:            }
102:
103:            /**
104:             * @return the control used by the handler to provide feedback / recover from the error.
105:             */
106:            public Control getControl() {
107:                return control;
108:            }
109:
110:            /**
111:             * Creates the control used by the handler to provide feedback / recover from the error.
112:             * 
113:             * @param parent The parent widget.
114:             */
115:            public void createControl(Composite parent) {
116:                if (control != null && !control.isDisposed()) {
117:                    control.dispose();
118:                }
119:
120:                control = create(parent);
121:            }
122:
123:            /**
124:             * Determines if the handler is done handling the error, and another connection may be
125:             * attempted. If the handler does not have the ability to recover from a connection error (ie.
126:             * canRecover() return false), this method should return false.
127:             * 
128:             * @return true if the error has been handled, otherwise.
129:             */
130:            public boolean isComplete() {
131:                return false;
132:            }
133:
134:            /**
135:             * Determines if the handler has the ability to recover from the error so that another
136:             * connection may be attempted.
137:             * 
138:             * @return True if the handler will try to recover, otherwise false.
139:             */
140:            public boolean canRecover() {
141:                return false;
142:            }
143:
144:            /**
145:             * This method is called in the event in which a handler can recover from a connection error.
146:             * This method blocks and allows the handler to make remote connections.
147:             * 
148:             * @param monitor A progress monitor.
149:             * @throws IOException
150:             */
151:            public void recover(IProgressMonitor monitor) throws IOException {
152:                // do nothing
153:            }
154:
155:            /**
156:             * Determines if the handler can handle the error in question.
157:             * 
158:             * @param t The error in question.
159:             * @return True if the handler can handle, otherwise false.
160:             */
161:            public abstract boolean canHandle(IService service, Throwable t);
162:
163:            /**
164:             * @param parent
165:             * @return
166:             */
167:            protected abstract Control create(Composite parent);
168:
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.