dev con 2011
TRANSCRIPT
Alfresco iOS Mobile Application Details and Design
Mike Hatfield - Senior Engineer, Mobile TeamMarc Dubresson - Director of Mobile Products
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
Agenda
• Today’s News • Architecture Overview • CMIS Refresher • Demo • Technical Walkthrough • Open Source Project • Roadmap • Questions?
Alfresco Mobile 1.1
Architecture Overview
Mostly a CMIS application talking to Alfresco Several features specific to Alfresco
Alfresco
CMIS
REST
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)
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
Design
• Universal binary• Hierarchy of Table Views• Navigation based app for browsing CMIS repositories• Layered on Alfresco specific functionality
Designed for the iPad
• Navigation based app but with iPad-specific view controllers • Split View Controller• Still a universal binary
CMIS AtomPub Binding (XML)
Alfresco REST API (JSON)
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
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
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*’)
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
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
Multiple Targets in the Project
Two Targets: Alfresco & Fresh Docs
Build and Run
Select a target and the iOS Simulator to Use
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
I Thought This Was A DevCon?
AlfrescoAppDelegate.h
Calling an AtomPub Service
CMISRESTfulRequest
AtomPubXMLAlfresco
Creating an HTTP Request
• Using ASIHTTPRequest build the request • The delegate handles events from that request
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
NSXMLParser & NSXMLParserDelegate
Setting up NSXMLParser
NSXMLParserDelegate methods
• – parser:didStartElement:namespaceURI:qualifiedName:attributes:
• – parser:didEndElement:namespaceURI:qualifiedName:• – parser:foundCharacters:
Calling Alfresco REST APIs
RESTfulHTTPRequest
JSONAlfresco
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
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
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.
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)
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
How Do I Contribute?
Step-by-step example for forking and sending a pull request:
http://bit.ly/pbIDRk (atlassian.com wiki)
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
Roadmap
Next version • Alfresco Cloud
• Multiple Repositories
• ...MoreIntegration • Leading productivity apps such as PDF Expert and QuickOffice
AndroidAdditional Alfresco Mobile AppsWhat else? > [email protected]
Q & A