Upload
duongthuan
View
245
Download
0
Embed Size (px)
Citation preview
CJMTK UC 2007CJMTK UC 2007 11
Frank XiaFrank XiaGary SheppardGary Sheppard
ESRI Washington DCESRI Washington DC
Developing Developing ArcGISArcGIS Server Application With JavaServer Application With Java
CJMTK UC 2007CJMTK UC 2007 22
AgendaAgenda
•• Overview of Overview of ArcGISArcGIS 9.2 Server Architecture9.2 Server Architecture•• ArcGISArcGIS 9.2 Java Web ADF9.2 Java Web ADF•• Task FrameworkTask Framework•• AJAX AJAX LiefcycleLiefcycle•• Enterprise ADFEnterprise ADF•• Server API choicesServer API choices•• Concluding RemarksConcluding Remarks
CJMTK UC 2007CJMTK UC 2007 33
ArcGISArcGIS 9.2 Server9.2 Server
•• Complete & Integrated serverComplete & Integrated server--based GISbased GIS•• OutOut--ofof--thethe--box applications and services box applications and services •• Rich developer opportunitiesRich developer opportunities
ArcGIS ServerArcGIS Server
Spatial DataSpatial DataManagementManagement
VisualizationVisualization(Mapping)(Mapping)
SpatialSpatialAnalysisAnalysis
Web MapWeb Map
ArcGISArcGISMobileMobile
ArcGISArcGISExplorerExplorer
ArcGISArcGISDesktopDesktop
JavaJava
.NET.NET
CJMTK UC 2007CJMTK UC 2007 44
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture ArcGIS Server
Web Browser
ArcGIS Explorer
ArcMap, ArcGlobe
InternetInternetInternet
Manager
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
Application Development Framework (ADF)
CJMTK UC 2007CJMTK UC 2007 55
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture
InternetInternetInternet
Manager
ArcGIS Server
J2EE Container
Web Browser
ArcGIS Explorer
ArcMap, ArcGlobe
Java Web ServerJava Web Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
Application Development Framework (ADF)
CJMTK UC 2007CJMTK UC 2007 66
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture
InternetInternetInternet
Manager
ArcGIS Server
Web Browser
ArcGIS Explorer
ArcMap, ArcGlobe
IISIIS Web ServerWeb Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
Application Development Framework (ADF)
CJMTK UC 2007CJMTK UC 2007 77
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture
InternetInternetInternet
Manager
ArcGIS Server
J2EE Container
Web Browser
ArcGIS Explorer
ArcMap, ArcGlobe
Java Web ServerJava Web Server
IISIIS Web ServerWeb Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
And/Or
Application Development Framework (ADF)
CJMTK UC 2007CJMTK UC 2007 88
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture
InternetInternetInternet
GIS ServerGIS Server (SOM/SOC)(SOM/SOC)
Manager
ArcGIS Server
J2EE Container
Web Browser
ArcGIS Explorer
ArcMap, ArcGlobe
Java Web ServerJava Web Server
CJMTK UC 2007CJMTK UC 2007 99
ArcGISArcGIS 9.2 Server 9.2 Server ArchitectureArchitecture
InternetInternetInternet
GIS ServerGIS Server (SOM/SOC)(SOM/SOC)
Manager
ArcGIS Server
J2EE ContainerWeb Browser
ArcGIS Explorer
ArcMap, ArcGlobe
Java Web ServerJava Web Server
CJMTK UC 2007CJMTK UC 2007 1010
What is What is ArcGISArcGIS Server 9.2 for JavaServer 9.2 for Java•• A A complete,complete, out of the box Web based GISout of the box Web based GIS
–– Publish rich GIS ServicesPublish rich GIS Services•• 2D and 3D Mapping services2D and 3D Mapping services•• GeocodingGeocoding•• GeodataGeodata•• Network AnalysisNetwork Analysis•• GeoprocessingGeoprocessing servicesservices•• SOAP, WMS, and KML based servicesSOAP, WMS, and KML based services
–– Publish Java Web Mapping ApplicationsPublish Java Web Mapping Applications–– Publish Java Enterprise (EJB) Mapping ApplicationsPublish Java Enterprise (EJB) Mapping Applications–– Out of the box clients Out of the box clients -- ArcGISArcGIS Explorer, Explorer, ArcGISArcGIS DesktopDesktop
•• A development platform for JavaA development platform for Java–– Java Web Application Development FrameworkJava Web Application Development Framework–– Java Enterprise Application Development FrameworkJava Enterprise Application Development Framework
•• IDE IntegrationIDE Integration–– Sun Java Studio CreatorSun Java Studio Creator–– EclipseEclipse
CJMTK UC 2007CJMTK UC 2007 1111
DemoDemo
•• Create aCreate a web web application using managerapplication using manager
CJMTK UC 2007CJMTK UC 2007 1212
ArcGISArcGIS Server 9.2Server 9.2 Java ADFJava ADF
•• Java Application Development Framework (ADF)Java Application Development Framework (ADF)–– Web ADFWeb ADF–– Enterprise ADFEnterprise ADF
CJMTK UC 2007CJMTK UC 2007 1313
Web Application DevelopmentWeb Application Development
•• What is the Web ADFWhat is the Web ADF•• Important ADF Classes and InterfacesImportant ADF Classes and Interfaces•• Task FrameworkTask Framework•• Resources and FunctionalitiesResources and Functionalities
CJMTK UC 2007CJMTK UC 2007 1414
What is the Web ADFWhat is the Web ADF
•• Set of web controls, tasks, and objects to create GIS Set of web controls, tasks, and objects to create GIS applicationsapplications
•• HighlightsHighlights–– Multiple data sourcesMultiple data sources
•• ArcGISArcGIS Server, Server, ArcIMSArcIMS, , ArcWebArcWeb, WMS, and Custom, WMS, and Custom
–– Task FrameworkTask Framework–– Object oriented, AJAX enabled JavaScript libraryObject oriented, AJAX enabled JavaScript library–– Seamless map navigationSeamless map navigation–– Integrated with Eclipse and Creator Integrated with Eclipse and Creator IDEIDE’’ss–– Standard Java Server Faces (JSF) componentsStandard Java Server Faces (JSF) components
CJMTK UC 2007CJMTK UC 2007 1515
Web ADF ControlsWeb ADF Controls
•• Context controlContext control–– NonNon--visual, manages all other controlsvisual, manages all other controls
•• Map controlMap control–– Provides visualization for the layersProvides visualization for the layers
•• Table of Contents ControlTable of Contents Control–– Enables interactivity to the layers of the mapEnables interactivity to the layers of the map
•• Overview controlOverview control–– Provides visual reference to the current map extentProvides visual reference to the current map extent
•• Toolbar controlToolbar control–– Container for applications toolsContainer for applications tools
CJMTK UC 2007CJMTK UC 2007 1616
Important ADF interfaces and classesImportant ADF interfaces and classes
•• WebContextWebContext•• WebMapWebMap•• WebGraphicsWebGraphics
•• GISResourceGISResource•• GISFunctionalityGISFunctionality
CJMTK UC 2007CJMTK UC 2007 1717
Web ADF ArchitectureWeb ADF Architecture
Context ControlContext Control
AttributesAttributes((WebMapWebMap, , WebGraphicsWebGraphics,..),..)
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
ResourceResource(ArcGIS Server, ArcIMS, ..)
FunctionalityFunctionality(Mapping, overview, ..)
CJMTK UC 2007CJMTK UC 2007 1818
WebContextWebContext
•• Container of all attributes and resourcesContainer of all attributes and resources•• Has attributes registered to itHas attributes registered to it
–– Notifies attributes about changes in application stateNotifies attributes about changes in application state–– WebContext.refreshWebContext.refresh()()
•• Stored in session scopeStored in session scope–– Data objects can be retrieved from contextData objects can be retrieved from context
WebMapWebMap
WebContextWebContext
WebGraphicsWebGraphics WebTocWebToc, , ……
CJMTK UC 2007CJMTK UC 2007 1919
WebMapWebMap
•• Represents the multiRepresents the multi--source Mapsource Map–– Business object behind the Map ControlBusiness object behind the Map Control–– Generates an output image (single or multiGenerates an output image (single or multi--source)source)–– Various properties of the output imageVarious properties of the output image–– Methods that work with the extent of the mapMethods that work with the extent of the map
•• webMap.centerAt(getCurrentExtentwebMap.centerAt(getCurrentExtent(). (). getMapScalegetMapScale())())
WebMapWebMap
Map ControlMap Control
CJMTK UC 2007CJMTK UC 2007 2020
WebGraphicsWebGraphics
•• Drawn on top of layers in the mapDrawn on top of layers in the map•• Enables drawing of simple graphicsEnables drawing of simple graphics•• Supported symbolsSupported symbols
–– LineLine–– MarkerMarker–– PolygonPolygon–– True type markerTrue type marker
•• Supported Supported renderersrenderers–– Unique valueUnique value–– Class breakClass break–– SimpleSimple
•• Capability to fuse with server image or draw it as a Capability to fuse with server image or draw it as a separate layer on the browserseparate layer on the browser
WebContextWebContext
WebGraphicsWebGraphics
CJMTK UC 2007CJMTK UC 2007 2121
Task FrameworkTask Framework
•• What is it?What is it?–– A developer framework that allows for the implementation of A developer framework that allows for the implementation of
custom functionality (E.g. Tasks) custom functionality (E.g. Tasks) –– Tasks are objects that encapsulate business logicTasks are objects that encapsulate business logic
•• Why use it?Why use it?–– Tight integration with the ADFTight integration with the ADF
•• Event handling with actions and toolsEvent handling with actions and tools•• No UI concernsNo UI concerns
–– Good way to encapsulate related functionalityGood way to encapsulate related functionality–– Implementation of a task is similar to a standard Implementation of a task is similar to a standard JavaBeanJavaBean
•• What are we going to do?What are we going to do?–– Extend the Task Framework by implementing a custom task Extend the Task Framework by implementing a custom task
(action and tool)(action and tool)
CJMTK UC 2007CJMTK UC 2007 2222
Web ADF TasksWeb ADF Tasks
•• Tasks are objects that encapsulate business logic Tasks are objects that encapsulate business logic •• Configurable from ManagerConfigurable from Manager•• Out of the box tasksOut of the box tasks
–– Map Map NavigationNavigation–– GeoprocessingGeoprocessing–– Search by attributesSearch by attributes–– EditingEditing–– Find directionFind direction–– Predefined queryPredefined query–– Find placeFind place
•• Custom tasksCustom tasks
CJMTK UC 2007CJMTK UC 2007 2323
ComponentsComponents of a taskof a task•• ParametersParameters
–– Inputs needed by the taskInputs needed by the task–– E.g. Layer name, zoom factor, etc E.g. Layer name, zoom factor, etc ……
•• Commands (Actions)Commands (Actions)–– Business logic Is executed without user interaction with the mapBusiness logic Is executed without user interaction with the map–– E.g. Zoom to full extentE.g. Zoom to full extent
•• ToolsTools–– User interaction with the map is requiredUser interaction with the map is required–– ClientClient--side action is requiredside action is required–– E.g. Identify, dynamic navigation (Zoom In, Zoom Out, etc..)E.g. Identify, dynamic navigation (Zoom In, Zoom Out, etc..)
ToolTool
ActionAction
ParameterParameter
CJMTK UC 2007CJMTK UC 2007 2424
Implementing a Custom TaskImplementing a Custom Task
1.1. Create standard Java ClassCreate standard Java Classes (2 or 3)es (2 or 3)–– In the main task class, sIn the main task class, signature of the method will dictate ignature of the method will dictate
command or tool command or tool –– The task info class will dictate what constitute the task UI andThe task info class will dictate what constitute the task UI and
how the UI should be layouthow the UI should be layout–– An optional task results classAn optional task results class
2.2. Register the Register the main task main task Java class as a managed bean Java class as a managed bean in the facesin the faces--config.xmlconfig.xml filefile–– Make it available in the ADFMake it available in the ADF
3.3. Add the task tag to the Add the task tag to the jspjsp, with reference to the , with reference to the managed beanmanaged bean–– To visually display the UI to the userTo visually display the UI to the user
CJMTK UC 2007CJMTK UC 2007 2525
Implementing a custom task Implementing a custom task –– Step 1Step 1
•• Create a standard Java ClassCreate a standard Java Class
public class SelectFeaturesTask {
public void selectFeaturesByRectangle(MapEvent event){… …}
public void selectFeaturesByPolygon(MapEvent event){… …}
}
CJMTK UC 2007CJMTK UC 2007 2626
Implementing a custom task Implementing a custom task –– Step 2Step 2
•• Register the Java class as a managed bean in the facesRegister the Java class as a managed bean in the faces--config.xmlconfig.xml filefile
[faces-config.xml]<managed-bean>
<managed-bean-name>selectFeaturesTask</managed-bean-name>
<managed-bean-class>...selectFeaturesTask</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
CJMTK UC 2007CJMTK UC 2007 2727
Implementing a custom task Implementing a custom task –– Step 3Step 3
•• Add the control to the Add the control to the jspjsp•• Value attribute is the value of the managedValue attribute is the value of the managed--beanbean--name name
in the facesin the faces--configconfig[mapviewer.jsp]<a href="javascript:void(0);“ onclick="toggleWindow('win_EsriTaskCell_selectFeaturesTask');">
<a:task mapId=“map1” value="#{selectFeaturesTask}“/>
[faces-config.xml]<managed-bean>
<managed-bean-name>selectFeaturesTask</managed-bean-name
. . .
Task AttributesbindingrenderedvaluetaskInfomapIdstylestyleClassxslFile
CJMTK UC 2007CJMTK UC 2007 2828
Implementing a custom task Implementing a custom task –– Step 3Step 3
•• Add the control to the Add the control to the jspjsp•• Value attribute is the value of the managedValue attribute is the value of the managed--beanbean--name name
in the facesin the faces--configconfig[mapviewer.jsp]<a href="javascript:void(0);“ onclick="toggleWindow('win_EsriTaskCell_selectFeaturesTask');">
<a:task mapId=“map1” value="#{selectFeaturesTask}“/>
[faces-config.xml]<managed-bean>
<managed-bean-name>selectFeaturesTask</managed-bean-name
. . .
Task AttributesbindingrenderedvaluetaskInfomapIdstylestyleClassxslFile
CJMTK UC 2007CJMTK UC 2007 2929
Implementing a custom task Implementing a custom task –– Step 3Step 3
•• Add the control to the Add the control to the jspjsp•• Value attribute is the value of the managedValue attribute is the value of the managed--beanbean--name name
in the facesin the faces--configconfig[mapviewer.jsp]<a href="javascript:void(0);“ onclick="toggleWindow('win_EsriTaskCell_selectFeaturesTask');">
<a:task mapId=“map1” value="#{selectFeaturesTask}“/>
[faces-config.xml]<managed-bean>
<managed-bean-name>selectFeaturesTask</managed-bean-name
. . .
Task AttributesbindingrenderedvaluetaskInfomapIdstylestyleClassxslFile
CJMTK UC 2007CJMTK UC 2007 3030
DemoDemo
•• Implement a Implement a custom custom task for task for selecting features by selecting features by drawing a rectangle or polygon on mapdrawing a rectangle or polygon on map
CJMTK UC 2007CJMTK UC 2007 3131
Inside the Inside the TaskInfoTaskInfo InterfaceInterface
•• Task class contains business logicTask class contains business logic•• TaskInfoTaskInfo class contains metadataclass contains metadata•• TaskInfoTaskInfo class changes look class changes look
and feel without affecting any and feel without affecting any business logicbusiness logicpackage com.esri.adf.web.data.tasks;
public interface TaskInfo {
getTaskDescriptor();
getParamDescriptors();
getActionDescriptors();
getToolDescriptors();
getTaskLayout();
}
package package com.esri.adf.web.data.taskscom.esri.adf.web.data.tasks;;
public interface public interface TaskInfoTaskInfo {{
getTaskDescriptorgetTaskDescriptor();();
getParamDescriptorsgetParamDescriptors();();
getActionDescriptorsgetActionDescriptors();();
getToolDescriptorsgetToolDescriptors();();
getTaskLayoutgetTaskLayout();();
}}
TaskInfo.java
CJMTK UC 2007CJMTK UC 2007 3232
Implementing a custom task Implementing a custom task –– Tool (Tool (samplesample))
•• ToolsTools–– Executes business logic based on user interaction on a mapExecutes business logic based on user interaction on a map–– Add a method with Add a method with MapEventMapEvent as argumentas argument–– Consist of client and server side actionsConsist of client and server side actions–– ServerServer--side actionside action
•• Business logic performed on the serverBusiness logic performed on the server
ToolTool
ActionAction
ParameterParameter
CJMTK UC 2007CJMTK UC 2007 3333
Implementing a custom task Implementing a custom task –– Tool (Tool (TaskInfoTaskInfo))
•• Provide a Provide a TaskToolDescriptorTaskToolDescriptor–– ClientClient--side actionside action
•• Controlled by JavaScript functions (Controlled by JavaScript functions (jsjs directory)directory)•• Example: Example: EsriMapRectangleEsriMapRectangle, , EsriMapPanEsriMapPan, , EsriMapPointEsriMapPoint, etc., etc.
public class PlaceFinderTaskInfo extends SimpleTaskInfo {
public TaskToolDescriptorModel[ ] getToolDescriptors() {
return new TaskToolDescriptor[ ] {return taskTools;
}}
CJMTK UC 2007CJMTK UC 2007 3434
Implementing a custom task Implementing a custom task –– TaskTask resultsresults
•• Task operations (tools, commands) may generate Task operations (tools, commands) may generate resultsresults
•• Results can be arbitrary Java objectsResults can be arbitrary Java objects–– Query resultsQuery results–– Address candidatesAddress candidates–– GeoProcessingGeoProcessing resultsresults
•• Types of informationTypes of information–– Display textDisplay text–– Result detailsResult details–– Actions that can be performed Actions that can be performed
on the resultson the results
CJMTK UC 2007CJMTK UC 2007 3535
Implementing a custom task Implementing a custom task –– TaskTask resultsresults
WebResultsWebResults•• com.esri.adf.web.data.resultscom.esri.adf.web.data.results•• Container object for resultsContainer object for results•• Results are displayed as a tree Results are displayed as a tree
by defaultby default–– TOC control is reTOC control is re--usedused
CJMTK UC 2007CJMTK UC 2007 3636
Back to EclipseBack to Eclipse
•• Show the details of the 3 main classesShow the details of the 3 main classes
CJMTK UC 2007CJMTK UC 2007 3737
Web ADF ArchitectureWeb ADF Architecture
Context ControlContext Control
AttributesAttributes((WebMapWebMap, , WebGraphicsWebGraphics,..),..)
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
ResourceResource(ArcGIS Server, ArcIMS, ..)
FunctionalityFunctionality(Mapping, overview, ..)
CJMTK UC 2007CJMTK UC 2007 3838
Resource and FunctionalitiesResource and Functionalities
•• FunctionalityFunctionality–– Functionalities are capabilities supported by a resourceFunctionalities are capabilities supported by a resource
•• ResourceResource–– GIS service that support predefined functionalitiesGIS service that support predefined functionalities
11 nn 11 nn
facesfaces--config.xmlconfig.xml
**--functionalities.xmlfunctionalities.xml
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
AGSResourceAGSResource WMSResourceWMSResource ……ResourceResource
……FunctionalityFunctionalityTOCFunctionalityTOCFunctionalityMapFunctionalityMapFunctionality
CJMTK UC 2007CJMTK UC 2007 3939
Resource Resource and and FunctionalitiesFunctionalities
•• Resources support functionalitiesResources support functionalities•• Functionalities supported by outFunctionalities supported by out--ofof--thethe--box box resource(sresource(s))
–– Map functionalityMap functionality–– TOC functionalityTOC functionality–– Overview functionalityOverview functionality–– Tile functionalityTile functionality–– GeocodeGeocode functionalityfunctionality–– Query functionalityQuery functionality–– NetworkAnalystNetworkAnalyst functionalityfunctionality–– Other custom functionalityOther custom functionality
CJMTK UC 2007CJMTK UC 2007 4040
Adding Functionality to a ResourceAdding Functionality to a Resource
•• The framework provides capability to add The framework provides capability to add functionalities to resources (including existing functionalities to resources (including existing resources)resources)
CustomCustomFunctionalityFunctionality
GISFunctionalityGISFunctionality
MapFunctionalityMapFunctionality ……FunctionalityFunctionality
CJMTK UC 2007CJMTK UC 2007 4141
The MultiThe Multi--Resource ArchitectureResource Architecture
11 nn 11 nnWebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
CJMTK UC 2007CJMTK UC 2007 4242
The MultiThe Multi--Resource ArchitectureResource Architecture
11 nn 11 nn
HashtableHashtable <String, <String, GISResourceGISResource>>
ags1ags1 AGSMapResourceAGSMapResource
aims1aims1 AIMSMapResourceAIMSMapResource
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
CJMTK UC 2007CJMTK UC 2007 4343
The MultiThe Multi--Resource ArchitectureResource Architecture
11 nn 11 nn
HashtableHashtable <String, <String, GISResourceGISResource>>
ags1ags1 AGSMapResourceAGSMapResource
aims1aims1 AIMSMapResourceAIMSMapResourceHashtableHashtable <String, <String, GISFunctionalityGISFunctionality>>
mapmap AGSMapFunctionalityAGSMapFunctionality
toctoc AGSTocFunctionalityAGSTocFunctionality
queryquery AGSQueryFunctionalityAGSQueryFunctionality
mapmap AIMSMapFunctionalityAIMSMapFunctionality
toctoc AIMSTocFunctionalityAIMSTocFunctionality
queryquery AIMSQueryFunctionalityAIMSQueryFunctionality
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
CJMTK UC 2007CJMTK UC 2007 4444
The MultiThe Multi--Resource ArchitectureResource Architecture
11 nn 11 nn
HashtableHashtable <String, <String, GISResourceGISResource>>
ags1ags1 AGSMapResourceAGSMapResource
aims1aims1 AIMSMapResourceAIMSMapResource
myRes1 MyResource
HashtableHashtable <String, <String, GISFunctionalityGISFunctionality>>
mapmap AGSMapFunctionalityAGSMapFunctionality
toctoc AGSTocFunctionalityAGSTocFunctionality
queryquery AGSQueryFunctionalityAGSQueryFunctionality
mapmap AIMSMapFunctionalityAIMSMapFunctionality
toctoc AIMSTocFunctionalityAIMSTocFunctionality
queryquery AIMSQueryFunctionalityAIMSQueryFunctionality
map MyMapFunctionality
toc MyTocFunctionality
query MyQueryFunctionality
WebContextWebContext GISResourceGISResource GISFunctionalityGISFunctionality
CJMTK UC 2007CJMTK UC 2007 4545
Implementing a Custom ResourceImplementing a Custom Resource
•• Custom resource must extend Custom resource must extend GISResourceGISResource•• Implement Implement GISFunctionalityGISFunctionality interfaces such as interfaces such as
MapFunctionalityMapFunctionality, , TOCFunctionalityTOCFunctionality, etc. depending on , etc. depending on which capabilities you want your custom resource to which capabilities you want your custom resource to supportsupport
•• Register functionalities in *Register functionalities in *--functionalities.xmlfunctionalities.xml•• Register the custom resource in facesRegister the custom resource in faces--config.xmlconfig.xml and and
add it to the add it to the WebContextWebContext
CJMTK UC 2007CJMTK UC 2007 4646
Java ADF Java ADF –– JSF Lifecycle JSF Lifecycle
CJMTK UC 2007CJMTK UC 2007 4747
Java ADF Java ADF –– AJAX Lifecycle AJAX Lifecycle
CJMTK UC 2007CJMTK UC 2007 4848
Add AJAX Capability to Your Web App Add AJAX Capability to Your Web App
•• DemoDemo•• Tracking objectsTracking objects
–– Configuration File (Configuration File (fcfc--ajaxdemo.xmlajaxdemo.xml and and web.xmlweb.xml))–– JavaScriptsJavaScripts Functions (Functions (mapviewer.jsmapviewer.js))–– Java classes (Java classes (TrackingPhaseListenerTrackingPhaseListener and Tracking)and Tracking)–– User Interface (JSP) (User Interface (JSP) (mapviewer.jspmapviewer.jsp))
CJMTK UC 2007CJMTK UC 2007 4949
Add AJAX Capability to Your Web App Add AJAX Capability to Your Web App
–– Configuration File Configuration File -- fcfc--ajaxdemo.xmlajaxdemo.xml•• <lifecycle><lifecycle>
<phase<phase--listener> listener> com.esri.arcgis.sample.tracking.TrackingPhaseListenercom.esri.arcgis.sample.tracking.TrackingPhaseListener
</phase</phase--listener>listener></lifecycle></lifecycle>
–– and and web.xmlweb.xml•• <context<context--paramparam> >
<<paramparam--name>name>javax.faces.CONFIG_FILESjavax.faces.CONFIG_FILES</</paramparam--name> name> <<paramparam--value>value>
/WEB/WEB--INF/functionalities/agsINF/functionalities/ags--functionalities.xmlfunctionalities.xml,,/WEB/WEB--INF/ajaxINF/ajax--renderers.xmlrenderers.xml, , /WEB/WEB--INF/contextINF/context--attributes.xmlattributes.xml, , /WEB/WEB--INF/fcINF/fc--ajaxdemo.xmlajaxdemo.xml
</</paramparam--value> value> </context</context--paramparam>>
CJMTK UC 2007CJMTK UC 2007 5050
Add AJAX Capability to Your Web App Add AJAX Capability to Your Web App
•• JavaScriptsJavaScripts Functions (Functions (mapviewer.jsmapviewer.js))
–– function function startTrackingstartTracking() {}() {}
–– function function stopTrackingstopTracking() {}() {}
–– function function trackingRequesttrackingRequest() {}() {}
–– function function trackingResponse(xmlHttptrackingResponse(xmlHttp) {) {}}
CJMTK UC 2007CJMTK UC 2007 5151
Add AJAX Capability to Your Web App Add AJAX Capability to Your Web App
•• Java classes Java classes –– TrackingPhaseListenerTrackingPhaseListener
•• public class public class TrackingPhaseListenerTrackingPhaseListener implements implements PhaseListenerPhaseListener {{public void public void beforePhase(PhaseEventbeforePhase(PhaseEvent phaseEventphaseEvent) {}) {}public void public void afterPhase(PhaseEventafterPhase(PhaseEvent phaseEventphaseEvent) { ) { …… ……}}
}}
–– TrackingTracking•• public class Tracking implements public class Tracking implements WebContextInitializeWebContextInitialize {{
public List public List getPointsgetPoints(){(){……}}}}
CJMTK UC 2007CJMTK UC 2007 5252
Add AJAX Capability to Your Web App Add AJAX Capability to Your Web App
•• User Interface (JSP) (User Interface (JSP) (mapviewer.jspmapviewer.jsp))–– <div id="tracking<div id="tracking--content" class="panelcontent" class="panel--content" style="height:50px;">content" style="height:50px;">
Track :Track :<input type="button" value="Start" <input type="button" value="Start" onclickonclick="="startTrackingstartTracking();" />();" /><input type="button" value="Stop" <input type="button" value="Stop" onclickonclick="="stopTrackingstopTracking();" />();" />
</div></div>
CJMTK UC 2007CJMTK UC 2007 5353
Enterprise Java ADFEnterprise Java ADF
•• WhatWhat’’s in the Enterprise Java ADF?s in the Enterprise Java ADF?•• ArchitectureArchitecture•• Building Geospatial EJB with Manager Building Geospatial EJB with Manager
CJMTK UC 2007CJMTK UC 2007 5454
WhatWhat’’s in the Enterprise ADF?s in the Enterprise ADF?
Framework to build and deploy GISFramework to build and deploy GIS--enabled J2EE enabled J2EE applications using EJB technologyapplications using EJB technology
•• Geospatial Geospatial EJBsEJBs–– Map, Query, Map, Query, GeocodeGeocode, , NetworkAnalystNetworkAnalyst and and GeoprocessingGeoprocessing
•• SDKSDK–– Literature, Samples, Developer Documentation and Scenarios Literature, Samples, Developer Documentation and Scenarios
•• IDE IDE PluginPlugin–– EclipseEclipse
•• Web based Geospatial EJBWeb based Geospatial EJBTMTM AssemblyAssembly–– ArcGISArcGIS Server ManagerServer Manager
•• ArcGISArcGIS Server JCA ConnectorServer JCA Connector
CJMTK UC 2007CJMTK UC 2007 5555
ArcGISArcGIS 92 Geospatial 92 Geospatial EJB FeaturesEJB Features
•• OutOut--ofof--thethe--box box EJBsEJBs that perform GIS tasksthat perform GIS tasks–– EJB 2.1 Compliant, Stateless Session Beans, Remote/Local EJB 2.1 Compliant, Stateless Session Beans, Remote/Local
Interface Support, Integrates with Web Interface Support, Integrates with Web ADFADF’’ss JSF ControlsJSF Controls
•• Deployed across a wide variety of J2EE 1.4 certified Deployed across a wide variety of J2EE 1.4 certified application servers application servers ---- such as BEA, Oracle, IBM, such as BEA, Oracle, IBM, JBossJBoss, , and Sunand Sun
•• Integrated into Manager Application for pointIntegrated into Manager Application for point--clickclick--type type easeease
•• Focus on generated applications and not coded Focus on generated applications and not coded applicationsapplications
•• High PerformanceHigh Performance
CJMTK UC 2007CJMTK UC 2007 5656
Geospatial Geospatial EJBsEJBs : Why & When: Why & When
•• Asynchronous execution of GIS functionsAsynchronous execution of GIS functions•• Presentation Technology AgnosticPresentation Technology Agnostic•• Integrate GIS at the Business TierIntegrate GIS at the Business Tier
CJMTK UC 2007CJMTK UC 2007 5757
Typical J2EE ArchitectureTypical J2EE Architecture
Application ServerApplication Server
EJB EJB ContainerContainer
EJBEJBHom
eH
ome
Rem
ote
Rem
ote
JNDIJNDI
EIS TierEIS TierBusiness Business EJB TierEJB Tier
Client Client TierTier
ClientClient EJBEJB
EJBEJB
Application Application ServerServer
ServletServlet/JSP /JSP ContainerContainer
ServletsServletsJSPsJSPs
Presentation Presentation Web TierWeb Tier
DatabasesDatabases
CJMTK UC 2007CJMTK UC 2007 5858
Typical J2EE Architecture in GIS spaceTypical J2EE Architecture in GIS space
Application ServerApplication Server
EJB EJB ContainerContainer
EJBEJBHom
eH
ome
Rem
ote
Rem
ote
JNDIJNDI
EIS TierEIS TierBusiness Business EJB TierEJB Tier
Client Client TierTier
ClientClient EJBEJB
EJBEJB
Application Application ServerServer
ServletServlet/JSP /JSP ContainerContainer
ServletsServletsJSPsJSPs
Presentation Presentation Web TierWeb Tier
ArcGISArcGISServerServer
DatabasesDatabases
JCA
JCA
EJBEJB
CJMTK UC 2007CJMTK UC 2007 5959
Steps to Creating and Deploying EJBSteps to Creating and Deploying EJB
Create Create Remote InterfaceRemote Interface
Create Create Bean Home InterfaceBean Home Interface
Write Bean Write Bean ImplementationImplementation
Create Create Deployment DescriptorDeployment Descriptor
Package and DeployPackage and Deploy
EJB EJB ContainerContainer
Use Manager Use Manager Point Click EasePoint Click Ease
CJMTK UC 2007CJMTK UC 2007 6060
Server APIsServer APIs
•• LowLow--level customization beyond ADFlevel customization beyond ADF•• Two fineTwo fine--grained APIsgrained APIs
–– ArcObjectsArcObjects APIAPI–– Web Service APIWeb Service API
ArcGIS Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
DCOM
ArcGISArcGIS ServerServerConnectionConnection
LocalLocalCOMCOM
ProxiesProxiesJava/COMJava/COM
BridgeBridge
CJMTK UC 2007CJMTK UC 2007 6161
Server APIsServer APIs
•• LowLow--level customization beyond ADFlevel customization beyond ADF•• Two fineTwo fine--grained APIsgrained APIs
–– ArcObjectsArcObjects APIAPI–– Web Service APIWeb Service API
ArcGIS Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
DCOM
SOAP/DCOM
ArcGISArcGIS ServerServerConnectionConnection
LocalLocalCOMCOM
ProxiesProxies
WSDLWSDLProxiesProxies
Java/COMJava/COMBridgeBridge
Java/COMJava/COMBridgeBridge
CJMTK UC 2007CJMTK UC 2007 6262
Server APIsServer APIs
•• LowLow--level customization beyond ADFlevel customization beyond ADF•• Two fineTwo fine--grained APIsgrained APIs
–– ArcObjectsArcObjects APIAPI–– Web Service APIWeb Service API
ArcGIS Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
DCOM
SOAP/HTTP
SOAP/DCOM
ArcGISArcGIS ServerServerConnectionConnection
LocalLocal
InternetInternet
COMCOMProxiesProxies
WSDLWSDLProxiesProxies
Java/COMJava/COMBridgeBridge
Web ServiceWeb ServiceHandlerHandler
Java/COMJava/COMBridgeBridge
CJMTK UC 2007CJMTK UC 2007 6363
Network Analysis with Network Analysis with ArcObjectsArcObjects APIAPI
ArcGIS Server
Web Browser
Web Application on Web Application on Java Web ServerJava Web Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
Several small DCOM callsset stops
OK
set barriers
OK
solve
route
CJMTK UC 2007CJMTK UC 2007 6464
Network Analysis with Network Analysis with Web Service APIWeb Service API
ArcGIS Server
Web Browser
Web Application on Web Application on Java Web ServerJava Web Server
GIS
Ser
ver
GIS
Ser
ver (
SOM
/SO
C)
(SO
M/S
OC
)
One large SOAP call
solve
route
set stops
set barriers
CJMTK UC 2007CJMTK UC 2007 6565
Concluding RemarksConcluding Remarks
•• ADF is the best starting point for you to develop web ADF is the best starting point for you to develop web and enterprise GIS applicationsand enterprise GIS applications
•• Task Framework within the ADF is the easiest way to Task Framework within the ADF is the easiest way to add new functionality to your web GIS applicationsadd new functionality to your web GIS applications
•• Note that you have two options to use Note that you have two options to use ArcGISArcGIS Server Server API to develop enterprise applicationsAPI to develop enterprise applications–– ArcObjecsArcObjecs APIAPI–– Web Service API Web Service API
CJMTK UC 2007CJMTK UC 2007 6666
Where do you go from here?Where do you go from here?
•• Developing Web Applications with ArcGIS Server using Developing Web Applications with ArcGIS Server using the Java platform the Java platform
•• Java Java WebADFWebADF DocsDocs–– http://http://edn.esri.com/index.cfm?faedn.esri.com/index.cfm?fa==java.gatewayjava.gateway–– http://edndoc.esri.com/arcobjects/9.2/Java/java/server/web_adf/ahttp://edndoc.esri.com/arcobjects/9.2/Java/java/server/web_adf/a
jax/ajax_integration.htmljax/ajax_integration.html–– http://edndoc.esri.com/arcobjects/9.2/Java/java/server/web_adf/jhttp://edndoc.esri.com/arcobjects/9.2/Java/java/server/web_adf/j
avascript/clientside_js.htmlavascript/clientside_js.html–– http://edndoc.esri.com/arcobjects/9.2/Java/server_samples/maphttp://edndoc.esri.com/arcobjects/9.2/Java/server_samples/map--
information/example.htmlinformation/example.html