1 / 34

HP Anywhere

HP Anywhere . Hackathon Tech O verview Adi Ofry System Architect October 2013. Architecture Overview. Architectural Overview. HPA Container. Dev Zone. Enterprise App Store. Apps. IDE. HPA Platform. Developer Platform. On Premise and Cloud Sources. HP Anywhere Client.

yama
Download Presentation

HP Anywhere

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HP Anywhere Hackathon Tech Overview Adi Ofry System Architect October 2013

  2. Architecture Overview

  3. Architectural Overview HPA Container Dev Zone Enterprise App Store Apps IDE HPA Platform Developer Platform On Premise and Cloud Sources

  4. HP Anywhere Client

  5. Client Side Perspective • Bring your own Javascript framework: • Angular • Jquery Mobile • Sencha • Enyo.js • Other … • Map your dependencies and resources in descriptor file and you're good to go. • You can write responsive application or separate between different form-factors: SmartPhone, Tablet, Desktop.

  6. Client Side API • Besides the app resources, a set of APIs are automatically injected. • These APIs are ‘namespace’d with HPA, and are mainly about: • Localization • User Profile • Device Capabilities • User Messages • Collaboration

  7. Mandatory API Implementation • Each app must implement minimal set of API in order to communicate with the framework. • function openEntryPoint(ep, params, cb, scope) – The framework direct commands to the app through this call. • HPA.framework.setReady(true) - The app notifies the framework that it finished its loading and is ready to accept commands. • Note, that only after you call setReadyopenEntryPoint will be called by the container.

  8. Starting Development

  9. How Do I Get User Information? • HPA.Profile.getInfo() – this method returns the current user data: • ID • Display Name • E-mail • Job-Title • Origin (internal/external) • URLs of user avatar in different sizes • For example getting the user display name: • HPA.Profile.getInfo().displayName

  10. Adapting To Different Locals • Under I10n • Place a <APP_ID>_<locale code>.properties • events.listTitle=My Events • And to get it: • Client: HPA.I18n.localize('events.listTitle') • Server: this.getString(userLocale, “events.listTitle”);

  11. Define User Settings • <App ID>-user-settings.xml

  12. Getting the Settings • varsortOrderSettingValue = • params.settings['events.sortSettings']['events.sortSettings.sortBy'][0];

  13. Using Device Capabilities • We can get Device Info by calling PhoneGapapi or calling HPA wrapping of the api. • You have two options: • console.info("name= " + HPA.Device.deviceInfo.name); • HPA.Message.info(window.parent.device.model); • Connect from mobile or tablet to http://YOUR_IP:8080 go into your app and try to call the device info. • http://docs.phonegap.com/en/2.7.0/index.html • With HPA you can call HPA.Device.deviceInfo even from chrome. But the PhoneGapapi will fail since it supports only mobile/tablet devices.

  14. HP Anywhere Server Side API

  15. Extend and implement the Main App Service • Every app needs to extend AbstractBTOServiceEE @Service("Report") public class MainApp extends AbstractBTOServiceEE{ … }

  16. Server API • To support HPA framework business logic you can (optional) implement special apis for example: • //Will add the support email to recommended users for conversation • public Collection<UserProfile> getRelatedUsers(Collection<BTOContext> btoContexts) throws CustomException { Collection<UserProfile> output = new HashSet<UserProfile>(); • UserProfileprofile = UserProfileFactory.createProfile(Consts.SUPPORT_EMAIL); • output.add(profile); • return output; • }

  17. descriptor.xml

  18. Implement some service that your client can call • Example for Spring REST service with all of the framework items injected: • You can return or get java beans which are serialized automatically to JSON for: the client

  19. Java service (cont.) • You can interact with the client with plain text:

  20. Send Notification to client • Sometimes you want to create a new front page item for the user and send (push) notification to him so he will open the relevant app. • You can do that by POST to a HPA REST service: http://serverIp:serverPort/diamond/rest/api/V2/apps/<app name>/events • You need to send a JSON body • { • “id”: “eventId1”, • “contextObjects”: [ … ], • “message”: “The message to the user”, • “users”: [ { “id”: “adi@hp.com”, “isNotify”: “true” , …. } ] • “visibility”: “PRIVATE”, • “notificationType”: “new.event.notification”, • “subject”: “The relevant subject for the notification” }

  21. Server Key Value Store Service • You can store information in the server side which is good for long term persistency or short term cache by using the KeyValueStorageService in the server side. • Where: • Category is like a schema (each app will use a different category). • Key is the name of the item you want to save • Value is the data you wan$t to save • TTL is the time to keep the data in seconds. It will be removed automatically after the time period unless given a null value.

  22. HP Anywhere Tips

  23. CSRF Defence • HP Anywhere protect itself against CSRF attack. • In order to succeed doing a PUT / DELETE/ POST http requests to the server you must add X-CSRF-HPMEAP header to any of these requests with any value inside it. • For example in angular: • $http.defaults.headers.common['X-CSRF-HPMEAP']='FROM-MINI-APP';

  24. Working with the simulator • Disable Cache in chrome when debugging and don’t forget to enable it back later and check for side effects • When working in simulator the app gets a version for cache. Every time to refresh the browser you get a different version. So its hard to place a breakpoint in chrome. Just add a debugger line in the code, so it will break there. • Default user & pass for the installed server is “admin”. • Changing configuration requires a rebuild of the app.

  25. HP Anywhere Specific Functionality

  26. Concepts • Activity – A new engagement around some app instance. The activity will pop up in your front page. • Entry Point – A place to jump into your app. It could be the top place which is the default or specific deep link into a page or applicative point. • Context Object – A data object to persist and to be share between apps. • Collaboration – A conversation going on at the timeline.

  27. Create Context Object On First Collaboration • Start of by telling the framework that you want hasAutoContext = true • HPA.Framework.setReady({ hasDefaultAction: true, hasAutoContext: true});

  28. Saving Client State • State may be any value / Json you want to save. • State is saved per: • Activity • User • Entry-Point (app – page) • You may save state at any time. • When user returns to the activity the last saved state is loaded

  29. Saving Client State - Example • Saving: • Loading in openEntryPoint:

  30. Create Context Object And Add To Activity • Context Object (the business entity) is added to Activity (a front page item instance)

  31. Getting Started • http://developer.hpanywhere.com/all-you-need-for-hackathon/ • HP Anywhere IDE • Events Cookbook App • HP Anywhere apidocs

  32. Thank you

More Related