Source Code Cross Referenced for Intermap.java in  » GIS » geonetwork » org » wfp » vam » intermap » 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 » geonetwork » org.wfp.vam.intermap 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //=============================================================================
002:        //===	Copyright (C) 2001-2005 Food and Agriculture Organization of the
003:        //===	United Nations (FAO-UN), United Nations World Food Programme (WFP)
004:        //===	and United Nations Environment Programme (UNEP)
005:        //===
006:        //===	This program is free software; you can redistribute it and/or modify
007:        //===	it under the terms of the GNU General Public License as published by
008:        //===	the Free Software Foundation; either version 2 of the License, or (at
009:        //===	your option) any later version.
010:        //===
011:        //===	This program is distributed in the hope that it will be useful, but
012:        //===	WITHOUT ANY WARRANTY; without even the implied warranty of
013:        //===	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:        //===	General Public License for more details.
015:        //===
016:        //===	You should have received a copy of the GNU General Public License
017:        //===	along with this program; if not, write to the Free Software
018:        //===	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019:        //===
020:        //===	Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
021:        //===	Rome - Italy. email: GeoNetwork@fao.org
022:        //==============================================================================
023:
024:        package org.wfp.vam.intermap;
025:
026:        import jeeves.interfaces.ApplicationHandler;
027:        import jeeves.interfaces.Logger;
028:        import jeeves.server.ServiceConfig;
029:        import jeeves.server.context.ServiceContext;
030:        import jeeves.utils.Xml;
031:        import org.jdom.Element;
032:        import org.wfp.vam.intermap.http.ConcurrentHTTPTransactionHandler;
033:        import org.wfp.vam.intermap.http.cache.HttpGetFileCache;
034:        import org.wfp.vam.intermap.kernel.GlobalTempFiles;
035:        import org.wfp.vam.intermap.kernel.TempFiles;
036:        import org.wfp.vam.intermap.kernel.map.DefaultMapServers;
037:        import org.wfp.vam.intermap.kernel.map.MapMerger;
038:        import org.wfp.vam.intermap.kernel.map.mapServices.arcims.AxlRequestBuilder;
039:        import org.wfp.vam.intermap.kernel.map.mapServices.wms.CapabilitiesStore;
040:        import org.wfp.vam.intermap.services.map.MapUtil;
041:
042:        //=============================================================================
043:
044:        /** This is the main class. It handles http connections and inits the system
045:         */
046:
047:        public class Intermap implements  ApplicationHandler {
048:            private Logger logger;
049:            private String path;
050:            private String charset;
051:            private String stdName;
052:            private String stdVersion;
053:            private static TempFiles tempFiles;
054:
055:            //---------------------------------------------------------------------------
056:            //---
057:            //--- GetContextName
058:            //---
059:            //---------------------------------------------------------------------------
060:
061:            public String getContextName() {
062:                return "intermap";
063:            }
064:
065:            //---------------------------------------------------------------------------
066:            //---
067:            //--- Start
068:            //---
069:            //---------------------------------------------------------------------------
070:
071:            /** Inits the engine, loading all needed data
072:             */
073:
074:            //	public Object start(String appPath, Logger l, Element config, ResourceManager resMan) throws Exception
075:            public Object start(Element config, ServiceContext context)
076:                    throws Exception {
077:                logger = context.getLogger();
078:                String path = context.getAppPath();
079:                String baseURL = context.getBaseUrl();
080:
081:                logger.info("Initializing intermap...");
082:
083:                ServiceConfig handlerConfig = new ServiceConfig(config
084:                        .getChildren());
085:
086:                //------------------------------------------------------------------------
087:                //--- initialize map servers informations
088:
089:                logger.info("Map servers config...");
090:                String mapServersPath = handlerConfig
091:                        .getMandatoryValue(Constants.MAP_SERVERS_CONFIG);
092:                Element mapServersRoot = Xml.loadFile(path + mapServersPath);
093:                DefaultMapServers.init(mapServersRoot);
094:
095:                //------------------------------------------------------------------------
096:                //--- initialize the AXL Element builder
097:
098:                logger.info("axlElementBuilder config...");
099:                String axlPath = handlerConfig
100:                        .getMandatoryValue(Constants.AXL_CONFIG);
101:                AxlRequestBuilder.init(path + axlPath);
102:
103:                //		//------------------------------------------------------------------------
104:                //		//--- initialize WmsService
105:                //
106:                //		log("WmsService config...");
107:                //		String wmsPath = handlerConfig.getMandatoryValue(Constants.WMS_CONFIG);
108:                //		WmsService.init(path + wmsPath);
109:
110:                //------------------------------------------------------------------------
111:                //--- set the proxy server System properties
112:
113:                logger.info("Proxy server config...");
114:                String useProxy = handlerConfig
115:                        .getMandatoryValue(Constants.USE_PROXY);
116:                logger.info("The useproxy attribute is set to " + useProxy);
117:                if ("true".equals(useProxy)) {
118:                    String proxyHost = handlerConfig
119:                            .getMandatoryValue(Constants.PROXY_HOST);
120:                    String proxyPort = handlerConfig
121:                            .getMandatoryValue(Constants.PROXY_PORT);
122:                    System.setProperty("http.proxyHost", proxyHost);
123:                    System.setProperty("http.proxyPort", proxyPort);
124:
125:                    // new http transaction handler
126:                    ConcurrentHTTPTransactionHandler.setProxy(proxyHost,
127:                            Integer.parseInt(proxyPort));
128:                }
129:
130:                //------------------------------------------------------------------------
131:                //--- Start the temporary files clean up thread
132:
133:                logger.info("Temporary files config...");
134:                String tempDir = handlerConfig
135:                        .getMandatoryValue(Constants.TEMP_DIR);
136:                String tempDelete = handlerConfig
137:                        .getMandatoryValue(Constants.TEMP_DELETE);
138:                int delete = Integer.parseInt(tempDelete);
139:                GlobalTempFiles.init(path, tempDir, delete);
140:                tempFiles = GlobalTempFiles.getInstance();
141:
142:                //------------------------------------------------------------------------
143:                //--- Start the cache files clean up thread
144:
145:                logger.info("HTTP Cache files config...");
146:                String cacheDir = handlerConfig
147:                        .getMandatoryValue(Constants.CACHE_DIR);
148:                String cacheDelete = handlerConfig
149:                        .getMandatoryValue(Constants.CACHE_DELETE);
150:                int deleteCache = Integer.parseInt(cacheDelete);
151:                MapMerger.setCache(new HttpGetFileCache(path, cacheDir,
152:                        deleteCache));
153:                String useCache = handlerConfig
154:                        .getMandatoryValue(Constants.USE_CACHE);
155:                CapabilitiesStore.useCache("true".equals(useCache) ? true
156:                        : false);
157:
158:                //------------------------------------------------------------------------
159:                //--- Set the temporary files URL
160:
161:                logger.info("Temporary URL config...");
162:                String tempUrl = handlerConfig
163:                        .getMandatoryValue(Constants.TEMP_URL);
164:                org.wfp.vam.intermap.services.map.MapUtil.setTempUrl(tempUrl);
165:
166:                logger.info("Screen DPI config...");
167:                String dpi = handlerConfig.getMandatoryValue(Constants.DPI);
168:                try {
169:                    MapMerger.setDefaultDPI(Integer.parseInt(dpi));
170:                } catch (NumberFormatException e) {
171:                    MapMerger.setDefaultDPI(96);
172:                }
173:
174:                //------------------------------------------------------------------------
175:                //--- Set image sizes
176:
177:                String stMinh = handlerConfig
178:                        .getMandatoryValue("smallImageHeight");
179:                String stMinw = handlerConfig
180:                        .getMandatoryValue("smallImageWidth");
181:                String stMaxh = handlerConfig
182:                        .getMandatoryValue("bigImageHeight");
183:                String stMaxw = handlerConfig
184:                        .getMandatoryValue("bigImageWidth");
185:                String d = handlerConfig.getMandatoryValue("defaultImageSize");
186:
187:                int minh = Integer.parseInt(stMinh);
188:                int minw = Integer.parseInt(stMinw);
189:                int maxh = Integer.parseInt(stMaxh);
190:                int maxw = Integer.parseInt(stMaxw);
191:
192:                MapUtil.setImageSizes(minh, minw, maxh, maxw);
193:
194:                logger.info("setting default image size to " + d);
195:                // set default image size
196:                if ("small".equals(d))
197:                    org.wfp.vam.intermap.services.map.MapUtil
198:                            .setDefaultImageSize("small");
199:                else
200:                    org.wfp.vam.intermap.services.map.MapUtil
201:                            .setDefaultImageSize("big");
202:
203:                logger.info("...done");
204:
205:                return new Object(); // DEBUG
206:            }
207:
208:            //---------------------------------------------------------------------------
209:            //---
210:            //--- Stop
211:            //---
212:            //---------------------------------------------------------------------------
213:
214:            public void stop() {
215:                logger.info("Stopping intermap...");
216:
217:                tempFiles.end();
218:            }
219:
220:            //---------------------------------------------------------------------------
221:            //---
222:            //--- Private methods
223:            //---
224:            //---------------------------------------------------------------------------
225:
226:        }
227:
228:        //=============================================================================
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.