tutorial building custom tools
DESCRIPTION
Slides to accompany this post: http://www.dekho.com.au/how-to-build-custom-tools-for-dekho/TRANSCRIPT
Developing Custom Tools
Agenda...
• Dekho Architecture
• Custom Tools Overview
• Communication & Working with the Esri Flex API
• Working with the Dekho Web Services API
• Consideration and Best Practices
Dekho Architecture Overview
Dekho Geo-App Portal
Dekho Application Manager
Map Services Spatial Information Corporate data Web Services Tools Gallery Report Gallery Search Tasks
Geo-App configuration
Roles and access rights definition
Geo-App publishing
Dekho Application
Manager
Custom Tools Overview
The Basics
• A way of customising Dekho
• Built as a .swf file which runs alongside Dekho
Parent Application
Dekho Custom Tool
Flash Runtime
The process
• Write (SWF)
• Deploy (Application Server i.e. Tomcat)
• Add a button (Dekho Studio)
Start-Up sequence
Application Server Client Browser
Dekho UI
Tool A
Tool B
Tool C
Dekho Server URL
Dekho swf
Tool ‘A’ click (URL to swf on server)
Tool ‘A’ swf
Dekho Page
Dekho UI
Tool A
In memory… now what?
Application Server Client Browser
Dekho UI
Tool A
Tool B
Tool C
Dekho Page
Dekho UI
Tool A
Option 1: Do you thing… clean up and destruct
Option 2: Persist and clean up on - Dialogue close or… - Second click or… - App shut down
Second click – unload…
Application Server Client Browser
Dekho UI
Tool A
Tool B
Tool C
Dekho Page
Dekho UI
Tool A
What can you use a custom tool for?
• Launching another browser application
• Launching another client side desktop application
• Creating a custom workflow
• Change layers, extent, selection…
• Loading WMS layers
Deploy…..
• Deploying your tool means making it available within the application server i.e. tomcat
• Common practice to add your custom too to the root of the same domain as Dekho
December 10 // www.esriaustralia.com.au
Add…..
December 10 // www.esriaustralia.com.au
• Add tool to Dekho via Dekho Studio
• Complete Tool Wizard
Use….
December 10 // www.esriaustralia.com.au
• Custom tool available on main Dekho Interface
Building your first “Hello world” custom tool
Communication & Working with the Esri Flex API
How does my custom tool interact with Dekho?
• Broadcast out to the parent application i.e. browser
• Receive messages from Dekho
• Send messages to Dekho
• Communicate with Dekho via the Services API
• Communicate with any web services
Broadcast out to the parent application
• Parent application can control Dekho
• Parent application can receive messages from Dekho
JavaScript or C# client
stubs provided
Working with the Dekho application
• Listening to messages
• API methods made public by Dekho SWF
Intercepting messages from Dekho
• messageFromDekho Function.
Dekho broadcasts the event as
<eventtype>,<sessionid>
E.g:
Session, 125482993879
parentApplication
• The Dekho SWF element that loads your custom tool
Working with the Esri Flex API
December 10 // www.esriaustralia.com.au
1
2
Working with Dekho selection and the Esri Flex API
Working with the Dekho Web Services API
Using Dekho Services API
Parent Application
Dekho Custom Tool
Flash Runtime
Dekho Services API
The Process
• Create channel and remote object
• Get Session Information from parentApplication
• Use session information to call Dekho Web Services API
Example: Saving selection as a redline
Application Server Client Browser
Establish AMF Channel
DrawRedlines
Dekho Page
Dekho UI
Tool A
ClearSelection
SaveBookmark Ref
resh
Map
Get
Ses
sio
nIn
Using the Dekho Services API You are responsible for creating and opening a channel.
Your responsible for creating a remote object to the correct service i.e.
“SessionService”
Finally make the call to the Dekho Services and specify the response handlers
Working with Dekho Web Service API
Custom Tool Summary
• Dekho’s client extensibility model.
• Ways to communicate with Dekho and the parent application: – Broadcast out to the parent application
– Dekho Flex API + Receive & Send messages
– Communicate with the Dekho Services API
• Your custom tool can use the Esri Flex API
• Your custom tool can use the Dekho Web Services API
Considerations and Best Practices
Code…
• messageFromDekho Function.
Mandatory method!!
Clean-up practice
The Dekho Simulator & Debugging
• Simulator is a test harness for custom tools
• Please refer to documentation
• Don’t forget:
– Server Address URL and Tool URL
– Map Service Address
• Simulator is limited – mock as necessary
Handling web services
• Tell the user when you’re waiting
• Chose the right channel (for performance and environment)
• Assign fault handler functions for service calls
Security
• Security
– Cross Domain – understanding if your tool needs to pull data from another source
Maintenance & Deployment
• Maintenance
– Make your tool portable, configure external Web Services URL address
– Flex SDK version
– Esri Flex API version
• Deploying into a scaled environment
Product Information:
www.esriaustralia.com.au/dekho
www.esriaustralia.com.au/dekhohelp
www.esriaustralia.com.au/dekhoblog