This task demonstrates how to create from scratch a new Appcelerator project
that uses the SkyVault Appcelerator SDK.
Access to an installation of SkyVault server is required in order to test the
code.
The following procedure takes you through the process of creating a new project from
scratch that uses the SkyVault Appcelerator SDK.
-
In Titanium Studio, from the main menu, select File > New > Mobile App Project.
The New Mobile App Project dialog is displayed.
- From the available templates select Classic and then Default Project.
- Click Next.
- In Project Location dialog sheet, enter HelloWorld as the project name.
- For the App Id enter com.alfresco.appcelerator.tutorials.helloworld.
- For Company/Personal URL enter http://www.alfresco.com
- Select iPad, iPhone and Android Deployment Targets.
-
Click Finish.
The new project will be created.
- In the Project Explorer click on the HelloWorld project. The Configurations sheet will be displayed.
-
In the Modules panel click the + button.
The Mobile Modules dialog is displayed.
- Select com.alfresco.appcelerator.module.sdk and click OK.
- Ensure that the latest version of the Titanium SDK is selected for use, if multiple Titanium SDKs are installed.
-
In the Package Explorer expand the HelloWorld project and double-click the
app.js file.
This will load the main JavaScript code for the application.
-
Replace the existing (template) code with the following:
var SDKModule = require('com.alfresco.appcelerator.module.sdk'); var properties = {serverUrl: "http://localhost:8080/alfresco", serverUsername: "admin", serverPassword: "admin"}; var repoSession = SDKModule.createRepositorySession(properties); repoSession.addEventListener('error', function(e) { alert("ERROR: Cannot connect to server (" + e.errorcode + "): " + e.errorstring); } ); repoSession.connect(); repoSession.addEventListener('success',function(e) { Ti.API.info("Connected to server: " + e.servername); var documentFolderService = SDKModule.createDocumentFolderService(); documentFolderService.addEventListener('error', function(e) { alert(e.errorstring); }); documentFolderService.initialiseWithSession(repoSession); documentFolderService.addEventListener('retrievedfolder', function(e) { documentFolderService.addEventListener('documentnode', function(e) { var doc = e.document; Ti.API.info("---> doc.identifier: " + doc.identifier); Ti.API.info("---> doc.name: " + doc.name); Ti.API.info("---> doc.title: " + doc.title); Ti.API.info("---> doc.summary: " + doc.summary); Ti.API.info("---> doc.type: " + doc.type); Ti.API.info("---> doc.createdBy: " + doc.createdBy); Ti.API.info("---> doc.createdAt: " + doc.createdAt); Ti.API.info("---> doc.modifiedBy: " + doc.modifiedBy); Ti.API.info("---> doc.modifiedAt: " + doc.modifiedAt); Ti.API.info("---> doc.isFolder: " + doc.isFolder); Ti.API.info("---> doc.isDocument: " + doc.isDocument); Ti.API.info("---> doc.contentMimeType: " + doc.contentMimeType); Ti.API.info("---> doc.contentLength: " + doc.contentLength); Ti.API.info("---> doc.versionLabel: " + doc.versionLabel); Ti.API.info("---> doc.versionComment: " + doc.versionComment); Ti.API.info("---> doc.isLatestVersion: " + doc.isLatestVersion); }); documentFolderService.addEventListener('foldernode', function(e) { var folder = e.folder; Ti.API.info("---> folder.identifier: " + folder.identifier); Ti.API.info("---> folder.name: " + folder.name); Ti.API.info("---> folder.title: " + folder.title); Ti.API.info("---> folder.summary: " + folder.summary); Ti.API.info("---> folder.type: " + folder.type); Ti.API.info("---> folder.createdBy: " + folder.createdBy); Ti.API.info("---> folder.createdAt: " + folder.createdAt); Ti.API.info("---> folder.modifiedBy: " + folder.modifiedBy); Ti.API.info("---> folder.modifiedAt: " + folder.modifiedAt); Ti.API.info("---> folder.isFolder: " + folder.isFolder); Ti.API.info("---> folder.isDocument: " + folder.isDocument); }); documentFolderService.retrieveChildrenInFolder(); }); documentFolderService.retrieveRootFolder(); });
Note: Change the connection details in the code to suit the SkyVault installation you want to connect to. -
In the Package Explorer, right-click on the HelloWorld project and select
Debug As, and then a target platform such as iPad.
The application will start to build and then run.
- Carefully check the logging information in the Console to ensure the application is running as expected.
You have now created and tested a new project that uses the SkyVault Appcelerator
SDK.
Parent topic: Introduction