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


001:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation;
009:         *    version 2.1 of the License.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         */
017:        package net.refractions.udig.catalog.internal;
018:
019:        import java.io.Serializable;
020:        import java.net.URL;
021:        import java.util.Iterator;
022:        import java.util.LinkedList;
023:        import java.util.List;
024:        import java.util.Map;
025:        import java.util.concurrent.locks.Lock;
026:        import java.util.concurrent.locks.ReentrantLock;
027:
028:        import net.refractions.udig.catalog.CatalogPlugin;
029:        import net.refractions.udig.catalog.IService;
030:        import net.refractions.udig.catalog.IServiceFactory;
031:        import net.refractions.udig.catalog.ServiceExtension;
032:        import net.refractions.udig.core.internal.ExtensionPointProcessor;
033:        import net.refractions.udig.core.internal.ExtensionPointUtil;
034:
035:        import org.eclipse.core.runtime.IConfigurationElement;
036:        import org.eclipse.core.runtime.IExtension;
037:
038:        /**
039:         * Provides ...TODO summary sentence
040:         * <p>
041:         * TODO Description
042:         * </p>
043:         * 
044:         * @author David Zwiers, Refractions Research
045:         * @since 0.6
046:         */
047:        public class ServiceFactoryImpl implements  IServiceFactory {
048:            /**
049:             * @deprecated use acquire(URL, Map)
050:             */
051:            public List<IService> aquire(final URL id,
052:                    final Map<String, Serializable> params) {
053:                return acquire(id, params);
054:            }
055:
056:            /**
057:             * Aquire an IService for the provided connection.
058:             * <p>
059:             * Please note: often connection parameters can be handled by more then one service
060:             * (especially when they describe an Open Web Service that speaks several service protocols).
061:             * 
062:             * @see net.refractions.udig.catalog.IServiceFactory#acquire(java.net.URI, java.util.Map)
063:             * @param id identifier
064:             * @param params Connection parameters
065:             * @return List of services able to handle provided params
066:             */
067:            public List<IService> acquire(final URL id,
068:                    final Map<String, Serializable> params) {
069:                final List<IService> services = new LinkedList<IService>();
070:
071:                // load services
072:                ExtensionPointUtil.process(CatalogPlugin.getDefault(),
073:                        ServiceExtension.EXTENSION_ID,
074:                        new ExtensionPointProcessor() {
075:                            /**
076:                             * Attempt to construct a service, and add to the list if available.
077:                             * <p>
078:                             * Note: ExtentionPointUtil will log exceptions against provided plugin.
079:                             * </p>
080:                             * 
081:                             * @see net.refractions.udig.core.internal.ExtensionPointProcessor#process(org.eclipse.core.runtime.IExtension,
082:                             *      org.eclipse.core.runtime.IConfigurationElement)
083:                             * @param extension
084:                             * @param element
085:                             */
086:                            public void process(IExtension extension,
087:                                    IConfigurationElement element)
088:                                    throws Exception {
089:                                ServiceExtension se = (ServiceExtension) element
090:                                        .createExecutableExtension("class"); //$NON-NLS-1$                   
091:                                IService service = se.createService(id, params);
092:                                if (service != null) {
093:                                    services.add(service);
094:                                }
095:                            }
096:                        });
097:
098:                return services;
099:            }
100:
101:            /**
102:             * @deprecated use acquire(Map)
103:             */
104:            public List<IService> aquire(Map<String, Serializable> params) {
105:                return acquire(params);
106:            }
107:
108:            /**
109:             * TODO summary sentence for acquire ...
110:             * 
111:             * @see net.refractions.udig.catalog.IServiceFactory#acquire(java.util.Map)
112:             * @param params
113:             * @return
114:             */
115:            public List<IService> acquire(Map<String, Serializable> params) {
116:                return acquire(null, params);
117:            }
118:
119:            List<Map<String, Serializable>> maps;
120:            private Lock lock = new ReentrantLock();
121:
122:            /**
123:             * @deprecated use acquire(URL)
124:             */
125:            public List<IService> aquire(final URL target) {
126:                return acquire(target);
127:            }
128:
129:            /**
130:             * Acquire IService handles generated by all ServiceExtentions that think they can handle the
131:             * provided target url.
132:             * <p>
133:             * Note: Just because a target is created does *NOT* mean it will actually work. You can check
134:             * the handles in the usual manner (ask for their info) after you get back this list.
135:             * </p>
136:             * 
137:             * @see net.refractions.udig.catalog.IServiceFactory#acquire(java.net.URL)
138:             * @param target
139:             * @return
140:             */
141:            public List<IService> acquire(final URL target) {
142:                lock.lock();
143:                try {
144:                    maps = new LinkedList<Map<String, Serializable>>();
145:                    // load maps
146:                    ExtensionPointUtil
147:                            .process(
148:                                    CatalogPlugin.getDefault(),
149:                                    "net.refractions.udig.catalog.ServiceExtension", new ExtensionPointProcessor() { //$NON-NLS-1$
150:                                        public void process(
151:                                                IExtension extension,
152:                                                IConfigurationElement element)
153:                                                throws Exception {
154:                                            ServiceExtension se = (ServiceExtension) element
155:                                                    .createExecutableExtension("class"); //$NON-NLS-1$
156:                                            Map<String, Serializable> m = se
157:                                                    .createParams(target);
158:                                            if (m != null)
159:                                                maps.add(m);
160:                                        }
161:                                    });
162:                } finally {
163:                    lock.unlock();
164:                }
165:
166:                List<IService> r = new LinkedList<IService>();
167:                Iterator<Map<String, Serializable>> i = maps.iterator();
168:                while (i.hasNext()) {
169:                    List<IService> o = acquire(i.next());
170:                    if (o != null && !o.isEmpty())
171:                        r.addAll(o);
172:                }
173:                return r;
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.