tutorial building custom tools

39
Developing Custom Tools

Upload: dekhoslides

Post on 13-Dec-2014

1.110 views

Category:

Technology


0 download

DESCRIPTION

Slides to accompany this post: http://www.dekho.com.au/how-to-build-custom-tools-for-dekho/

TRANSCRIPT

Page 1: Tutorial   building custom tools

Developing Custom Tools

Page 2: Tutorial   building 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

Page 3: Tutorial   building custom tools

Dekho Architecture Overview

Page 4: Tutorial   building custom tools

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

Page 5: Tutorial   building custom tools
Page 6: Tutorial   building custom tools

Custom Tools Overview

Page 7: Tutorial   building custom tools

The Basics

• A way of customising Dekho

• Built as a .swf file which runs alongside Dekho

Parent Application

Dekho Custom Tool

Flash Runtime

Page 8: Tutorial   building custom tools

The process

• Write (SWF)

• Deploy (Application Server i.e. Tomcat)

• Add a button (Dekho Studio)

Page 9: Tutorial   building custom tools

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

Page 10: Tutorial   building custom tools

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

Page 11: Tutorial   building custom tools

Second click – unload…

Application Server Client Browser

Dekho UI

Tool A

Tool B

Tool C

Dekho Page

Dekho UI

Tool A

Page 12: Tutorial   building custom tools

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

Page 13: Tutorial   building custom tools

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

Page 14: Tutorial   building custom tools

Add…..

December 10 // www.esriaustralia.com.au

• Add tool to Dekho via Dekho Studio

• Complete Tool Wizard

Page 15: Tutorial   building custom tools

Use….

December 10 // www.esriaustralia.com.au

• Custom tool available on main Dekho Interface

Page 16: Tutorial   building custom tools

Building your first “Hello world” custom tool

Page 17: Tutorial   building custom tools

Communication & Working with the Esri Flex API

Page 18: Tutorial   building custom tools

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

Page 19: Tutorial   building custom tools

Broadcast out to the parent application

• Parent application can control Dekho

• Parent application can receive messages from Dekho

JavaScript or C# client

stubs provided

Page 20: Tutorial   building custom tools

Working with the Dekho application

• Listening to messages

• API methods made public by Dekho SWF

Page 21: Tutorial   building custom tools

Intercepting messages from Dekho

• messageFromDekho Function.

Dekho broadcasts the event as

<eventtype>,<sessionid>

E.g:

Session, 125482993879

Page 22: Tutorial   building custom tools

parentApplication

• The Dekho SWF element that loads your custom tool

Page 23: Tutorial   building custom tools

Working with the Esri Flex API

December 10 // www.esriaustralia.com.au

1

2

Page 24: Tutorial   building custom tools

Working with Dekho selection and the Esri Flex API

Page 25: Tutorial   building custom tools

Working with the Dekho Web Services API

Page 26: Tutorial   building custom tools

Using Dekho Services API

Parent Application

Dekho Custom Tool

Flash Runtime

Dekho Services API

Page 27: Tutorial   building custom tools

The Process

• Create channel and remote object

• Get Session Information from parentApplication

• Use session information to call Dekho Web Services API

Page 28: Tutorial   building custom tools

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

Page 29: Tutorial   building custom tools

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

Page 30: Tutorial   building custom tools

Working with Dekho Web Service API

Page 31: Tutorial   building custom tools

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

Page 32: Tutorial   building custom tools

Considerations and Best Practices

Page 33: Tutorial   building custom tools

Code…

• messageFromDekho Function.

Mandatory method!!

Page 34: Tutorial   building custom tools

Clean-up practice

Page 35: Tutorial   building custom tools

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

Page 36: Tutorial   building custom tools

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

Page 37: Tutorial   building custom tools

Security

• Security

– Cross Domain – understanding if your tool needs to pull data from another source

Page 38: Tutorial   building custom tools

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

Page 39: Tutorial   building custom tools

Product Information:

www.esriaustralia.com.au/dekho

www.esriaustralia.com.au/dekhohelp

www.esriaustralia.com.au/dekhoblog