34
Alfresco iOS Mobile Application Details and Design Mike Hatfield - Senior Engineer, Mobile Team Marc Dubresson - Director of Mobile Products

Dev Con 2011

Embed Size (px)

Citation preview

Page 1: Dev Con 2011

Alfresco iOS Mobile Application Details and Design

Mike Hatfield - Senior Engineer, Mobile TeamMarc Dubresson - Director of Mobile Products

Page 2: Dev Con 2011

Who are we?

Marc Dubresson • Mobile Product Management

Gavin Cornwell Mike Hatfield • Alfresco Mobile Development Core Team

Zia • Outsourced Mobile Development Partner• Platinum Alfresco Professional Services & OEM Partner

Page 3: Dev Con 2011

Agenda

• Today’s News • Architecture Overview • CMIS Refresher • Demo • Technical Walkthrough • Open Source Project • Roadmap • Questions?

Page 4: Dev Con 2011

Alfresco Mobile 1.1

Page 5: Dev Con 2011

Architecture Overview

Mostly a CMIS application talking to Alfresco Several features specific to Alfresco

Alfresco

CMIS

REST

Page 6: Dev Con 2011

CMIS Refresher

CMIS Technical Committee Goals & Scope • Content Management Interoperability Services• Enable applications to target different ECM repositories uniformly• Provide a set of basic services enabling richer ECM applications

and use cases• All for loose coupling of an ECM application on the underlying

repository• Use popular protocol bindings•REST / AtomPub•Web Services / SOAP• v1.1 - JSON (Browser Binding)

Page 7: Dev Con 2011

Demo

Alfresco Mobile in Action – A Few Features • CMIS: • Login to Alfresco over HTTP or HTTPS• Browse, Search, Display Content and Edit Metadata, Upload Files•Create Folders

• Alfresco• Activities• Like & Unlike•Comment on Documents

• iOS• Local Downloads• “Open In...” support to/from other apps

Page 8: Dev Con 2011

Design

• Universal binary• Hierarchy of Table Views• Navigation based app for browsing CMIS repositories• Layered on Alfresco specific functionality

Page 9: Dev Con 2011

Designed for the iPad

• Navigation based app but with iPad-specific view controllers • Split View Controller• Still a universal binary

Page 10: Dev Con 2011

CMIS AtomPub Binding (XML)

Page 11: Dev Con 2011

Alfresco REST API (JSON)

Page 12: Dev Con 2011

App Launch / Sites / Browse

• iOS: Read user settings• CMIS: Retrieve AtomPub Service Document• Alfresco: Request Sites List• CMIS: Request folder children for the Root Collection• CMIS: Navigate into a folder or site

Page 13: Dev Con 2011

Activities

• Alfresco: Retrieve user’s activity feed

• User taps a document table cell• CMIS: Retrieve Document via

getObjectByID service

• User taps the “info icon” • CMIS: Retrieve Document Metadata

using getTypeDefinition service

Page 14: Dev Con 2011

Search

Execute a CMIS Query • Full-text search:•SELECT * FROM cmis:document WHERE

CONTAINS(‘keywords’)

• Search by cmis:name:•SELECT * FROM cmis:document WHERE

CONTAINS(‘~cmis:name:’*keywords*’)

Page 15: Dev Con 2011

Tools for iOS Development

Mac with OS X Snow Leopard or Lion

XCode 4.2 • Integrated Development Environment• Integrated Build System• Debugger• Interface Builder• iOS Simulator

Instruments •Performance and behaviour analysis

Page 16: Dev Con 2011

Getting Started

Create an iOS developer account (free)

Install the latest version of XCode 4.2 (free) Clone the repository • git clone https://[email protected]/ziadev/alfresco-mobile.git

Open the Project

Page 17: Dev Con 2011

Multiple Targets in the Project

Two Targets: Alfresco & Fresh Docs

Page 18: Dev Con 2011

Build and Run

Select a target and the iOS Simulator to Use

Page 19: Dev Con 2011

How do I install it on my device?

See iOS Provisioning Portal Resources & How-To Guides

Sign up for a (paid) iOS Developer Program Account

Configure profile: Development certificate, App Id Provision Device (UDID)

Configure & build the App for the device

Page 20: Dev Con 2011

I Thought This Was A DevCon?

AlfrescoAppDelegate.h

Page 21: Dev Con 2011

Calling an AtomPub Service

CMISRESTfulRequest

AtomPubXMLAlfresco

Page 22: Dev Con 2011

Creating an HTTP Request

• Using ASIHTTPRequest build the request • The delegate handles events from that request

Page 23: Dev Con 2011

Parsing AtomPub XML

Event-Driven XML Parsing (SAX) • Parser sends messages (parsing events) to it’s delegates

(callbacks)

Use NSXMLParser & NSXMLParserDelegate • Recommended by Apple• Native API• Objective-C based implementation

Why not use the Tree-based API (DOM)? • Apple does not provide the API for iOS

Page 24: Dev Con 2011

NSXMLParser & NSXMLParserDelegate

Setting up NSXMLParser

NSXMLParserDelegate methods

• – parser:didStartElement:namespaceURI:qualifiedName:attributes:

• – parser:didEndElement:namespaceURI:qualifiedName:• – parser:foundCharacters:

Page 25: Dev Con 2011

Calling Alfresco REST APIs

RESTfulHTTPRequest

JSONAlfresco

Page 26: Dev Con 2011

JSON data transport

Simpler to consume than XML

Using SBJson • Other libraries available, e.g. TouchJSON, JSONKit• iOS 5.0 supports JSON natively

Parses into NSDictionary and NSArray objects

CMIS 1.1 will contain a Browser Binding

Page 27: Dev Con 2011

What do I need to know?• Objective-C • cocoadevcentral.com/d/learn_objectivec

• iOS App Programming • developer.apple.com

• Alfresco RESTful API • wiki.alfresco.com

• CMIS AtomPub Binding • wiki.alfresco.com/wiki/CMIS

• Git • gitref.org

Page 28: Dev Con 2011

Common Design Patterns

Model-View-Controller • A pattern to relate the user interface to an underlying data

model.

Delegation • A patten where an object, the delegator, delegates tasks to an

associated helper object, the delegate.• The delegate is responsible for executing the task for the

delegator.

Target-Action • Target-action is a design pattern in which an object holds the

information necessary to send a message to another object when an event occurs.

Page 29: Dev Con 2011

API’s and Libraries UsedCocoa Touch Frameworks • The API’s Apple provides to build an iOS application

ASIHTTPRequest • Wrapper around Apple’s CFNetwork API

SBJson • Fast, simple & clean JSON parser and generator

ISO8601 • XML date parsing

Flurry Analytics • Remote logging for app crashes (uncaught exceptions)

Page 30: Dev Con 2011

Open Source Availability

Hosted on Bitbucket

bit.ly/alf-mobile

Search for “alfresco-mobile” at bitbucket.org

Released under the Mozilla Public License Version 1.1

Page 31: Dev Con 2011

How Do I Contribute?

Step-by-step example for forking and sending a pull request:

http://bit.ly/pbIDRk (atlassian.com wiki)

Page 32: Dev Con 2011

ResourcesApple iOS Developer Portal • Sample Code, API Documentation, Design Guides, Developer Videos, etc.!

Books • Beginning iPhone 4 Development (Apress Publishing)• Programming in Objective-C (Sam’s Publishing)

Many Developer Blogs • http://icepla.net

Also: Twitter, StackOverflow

Page 33: Dev Con 2011

Roadmap

Next version • Alfresco Cloud

• Multiple Repositories

• ...MoreIntegration • Leading productivity apps such as PDF Expert and QuickOffice

AndroidAdditional Alfresco Mobile AppsWhat else? > [email protected]

Page 34: Dev Con 2011

Q & A