Source Code Cross Referenced for AbstractService.java in  » GIS » GeoTools-2.4.1 » org » geotools » catalog » 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 » GeoTools 2.4.1 » org.geotools.catalog 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2005-2006, GeoTools Project Managment Committee (PMC)
005:         *    (C) 2005, Refractions Research Inc.
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation;
010:         *    version 2.1 of the License.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.catalog;
018:
019:        import java.util.List;
020:        import java.util.Map;
021:        import java.util.logging.Logger;
022:
023:        import org.geotools.util.ProgressListener;
024:
025:        /**
026:         * Abstract implementation of Service.
027:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/catalog/AbstractService.java $
028:         */
029:        public abstract class AbstractService implements  Service {
030:            /**
031:             * Logger
032:             */
033:            protected static Logger logger = org.geotools.util.logging.Logging
034:                    .getLogger("org.geotools.catalog");
035:
036:            /** 
037:             * parent catalog containing the service 
038:             */
039:            private Catalog parent;
040:            /** 
041:             * connection paramters 
042:             */
043:            private Map params;
044:            /** 
045:             * error message 
046:             */
047:            private Throwable msg;
048:            /**
049:             * cached geo resource members 
050:             */
051:            private List members;
052:
053:            /**
054:             * Creates a new service handle contained within a catalog.
055:             *
056:             * @param parent The catalog containg the service.
057:             */
058:            public AbstractService(Catalog parent) {
059:                this .parent = parent;
060:            }
061:
062:            /**
063:             * Creates a new service handle contained within a catalog, with a 
064:             * set of connection paramters.
065:             * 
066:             * @param parent The catalog containing the service.
067:             * @param params The connection params used to connect to the service.
068:             */
069:            public AbstractService(Catalog parent, Map params) {
070:                this (parent);
071:                this .params = params;
072:            }
073:
074:            /**
075:             * @param monitor Progress monitor for blocking call.
076:             *
077:             * @return he parent Catalog.
078:             */
079:            public Resolve parent(ProgressListener monitor) {
080:                return parent;
081:            }
082:
083:            /**
084:             * @return Connection parameters, possibly null.
085:             */
086:            public Map getConnectionParams() {
087:                return params;
088:            }
089:
090:            /**
091:             * Sets the connection params for the service handle.
092:             * 
093:             * @param params Map of connection paramters.
094:             */
095:            protected void setConnectionParams(Map params) {
096:                this .params = params;
097:            }
098:
099:            /**
100:             * Sets the cached value of the members of the service.
101:             * 
102:             * @param members List of {@link GeoResource}.
103:             */
104:            protected void setMembers(List members) {
105:                this .members = members;
106:            }
107:
108:            /**
109:             * @return The cached members.
110:             */
111:            protected List getMembers() {
112:                return members;
113:            }
114:
115:            /**
116:             * @return The cached error message.
117:             */
118:            public Throwable getMessage() {
119:                return msg;
120:            }
121:
122:            /**
123:             * Sets the cached error message.
124:             * 
125:             * @param msg An exception which occured when connecting to the service.
126:             */
127:            protected void setMessage(Throwable msg) {
128:                this .msg = msg;
129:            }
130:
131:            /**
132:             * Default implementation of getStatus.
133:             * <p>
134:             * The following rules are used to determine the status:
135:             * <ol>
136:             * 	<li>If {@link #msg} is non-null, then the service handle is 
137:             * {@link Status#BROKEN}.
138:             * 	<li>If above is false, then if {@link #members} is non-null then the 
139:             * service handle is {@link Status#CONNECTED} 
140:             *  <li>If non of the above hold, the service handle is {@link Status#NOTCONNECTED}.
141:             * </ol>
142:             * </p>
143:             * 
144:             * <p>
145:             * Subclasses can control this method by setting the members {@link #msg} 
146:             * and {@link #members} with {@link #setMessage(Throwable)} and 
147:             * {@link #setMembers(List)} respectivley. Or subclasses may wish to 
148:             * override this method entirley.
149:             * </p>
150:             *
151:             */
152:            public Status getStatus() {
153:                if (msg != null) {
154:                    return Status.BROKEN;
155:                }
156:
157:                if (members != null) {
158:                    return Status.CONNECTED;
159:                }
160:
161:                return Status.NOTCONNECTED;
162:            }
163:
164:            /**
165:             * This should represent the identifier
166:             *
167:             * @param other
168:             *
169:             *
170:             * @see Object#equals(java.lang.Object)
171:             */
172:            public final boolean equals(Object other) {
173:                if ((other != null) && other instanceof  Service) {
174:                    Service service = (Service) other;
175:
176:                    if ((getIdentifier() != null)
177:                            && (service.getIdentifier() != null)) {
178:                        return getIdentifier().equals(service.getIdentifier());
179:                    }
180:                }
181:
182:                return false;
183:            }
184:
185:            /**
186:             * This method does nothing. Sublcasses should override if events are
187:             * supported.
188:             *
189:             * @param listener DOCUMENT ME!
190:             */
191:            public void addListener(ResolveChangeListener listener) {
192:                // do nothing
193:            }
194:
195:            /**
196:             * This method does nothing. Sublcasses should override if events are
197:             * supported.
198:             *
199:             * @param listener DOCUMENT ME!
200:             */
201:            public void removeListener(ResolveChangeListener listener) {
202:                // do nothing
203:            }
204:
205:            /**
206:             * This method does nothing. Sublcasses should override if events are
207:             * supported.
208:             *
209:             * @param event DOCUMENT ME!
210:             */
211:            public void fire(ResolveChangeEvent event) {
212:                // do nothing
213:            }
214:
215:            /**
216:             * This should represent the identified
217:             *
218:             *
219:             * @see Object#hashCode()
220:             */
221:            public final int hashCode() {
222:                if (getIdentifier() != null) {
223:                    return getIdentifier().hashCode();
224:                }
225:
226:                return super .hashCode();
227:            }
228:
229:            /**
230:             * Indicate class and id.
231:             *
232:             * @return string representing this IResolve
233:             */
234:            public String toString() {
235:                StringBuffer buf = new StringBuffer();
236:                String classname = getClass().getName();
237:                String name = classname
238:                        .substring(classname.lastIndexOf('.') + 1);
239:                buf.append(name);
240:                buf.append("("); //$NON-NLS-1$
241:                buf.append(getIdentifier());
242:                buf.append(")"); //$NON-NLS-1$
243:
244:                return buf.toString();
245:            }
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.