|
How Applications Are Shared On Dekoh
Table of ContentsOverviewUnderstanding Application SharingIn the Contacts document, you learnt how Dekoh allows you to manage contacts in the Dekoh address book. The primary advantage of adding contacts in Dekoh is that it helps in application sharing. Application Sharing in Dekoh allows you to share applications from your Dekoh Desktop on the Dekoh network, such that multiple users can access and even interactively work on the same application at the same time. Application sharing on the Dekoh network provides users with the access control feature, enabling authentication, authorization, role based permission etc.Example: A and B are trying to access the same application available on Dekoh Network. Dekoh in this case, always authenticates, authorizes and only then provides shared application access to both A and B. Dekoh provides a Share API that is designed to make sharing applications and accessing shared applications as simple as possible. The Share API in Dekoh provides classes and functions to both share applications with your contacts (Share Out) and access applications shared by other Dekoh users for you (Share In). When accessing applications shared for you, you can retrieve both metadata (information about the share) and data (programmatically accessing music from someone’s machine) Sharing OutWhen you share application with your contacts over the Dekoh network, it means you allow them to download, access and maybe even manage your applications over the network. You can share out applications on Dekoh in four different levels:
Typically, you will need to manually code to manage your "share-out" list. Dekoh provides you APIs that will help you manage activities on your share-out list. The main class that allows you to share applications with others is com.pramati.bfly.das.contacts.helper.ShareService. The method, getShareServiceForUser(DesktopUser desktopUser) is a service helper for sharing and unsharing applications for this logged in desktopUser. Use the class, com.pramati.bfly.das.api.DesktopUser to retrieve the Desktop User for an authenticated session. The main participant for authenticating the session is the LoginManager API, which helps validate credentials and sets the authenticated session. For subsequent requests made on this session, you can use com.pramati.bfly.das.helper.SessionUtil. Use the following functions in ShareService.java to manage the different types of sharing capabilities within Dekoh
Sharing In MetadataMetadata consist of information that describes the application shared for you by other Dekoh Desktop Users. Retrieving metadata of the information shared for you is the best and simplest way to read the summarized information without having to read the actual data.The method, getShareServiceForUser(DesktopUser desktopUser) helps you get the share service for the Desktop User. It is basically a service helper for sharing and unsharing applications for this logged in desktopUser. Use the class, com.pramati.bfly.das.api.DesktopUser to retrieve the Desktop User for an authenticated session. The main participant for authenticating the session is the LoginManager API, which helps validate credentials and sets the authenticated session. For subsequent requests made on this session, you can use com.pramati.bfly.das.helper.SessionUtil. The API, getSharesFromContacts() gets the shares for all contacts in your address book, and the getSharesFromNonContacts() method to get it from non-contacts or Desktop Users who do not exist in your address book. Since non-contacts maybe potential spammers, Dekoh displays information for only those non-contacts who have shared at least one application explicitly for you. When you call the getShareService method for non-contacts, the list displays metadata of all the non-contacts’ shares, along with any other share information accessible to the user. Use the com.pramati.bfly.cas.presence.api.ops.ShareInfo data object (retuned by ShareService.getSharesFromContacts()). The data object contains information about the list of shares for you from all your contacts. As only registered Desktop users can share applications with you, all contacts in your address book (even if you have added the contact using his/her E-mail address and never invited to become mutual contacts) will be updated with the contacts’ DekohID. The class returns information of shared applications from both online and offline Dekoh Desktops. Use com.pramati.bfly.cas.presence.api.ops.ShareInfo$BuddyShareInfo to retrieve share information about applications that have been shared by contacts (other Desktop Users who are registered, have a valid Dekoh Id, and an installed Dekoh desktop) from any of their Dekoh Desktops to this Desktop User.
Sample Code
// refers to the accountId and name of the user who would be accessing this link.
// On Dekoh Desktops {@link com.pramati.bfly.das.api.DesktopUser DesktopUser} would give this information.
// Can set these to null, if unknown.
String loggedinUserAccountId;
String loggedInUserName;<br>
for (ShareInfo.BuddyShareInfo buddyShare : shareInfo.getBuddyShares()) {
String buddyName = buddyShare.getBuddyAlias();
if (buddyShare.isOnline()) {
for (ShareInfo.DesktopShareInfo desktopShare : buddyShare.getDesktopShares()) {
if (desktopShare.isOnline()) {
String dasId = desktopShare.getDasIdentifier();
int desktopNo = desktopShare.getDesktopNo();
String desktopName = desktopShare.getDesktopName();
for (ShareInfo.AppShareInfo appShare : desktopShare.getAppShares()) {
String appName = appShare.getAppName();
String appUrl = SessionUtil.getViewLink(DesktopUser, buddyName, dasId, desktopNo, desktopName, appName);
}
}
}
}
}
Use com.pramati.bfly.cas.presence.api.ops.ShareInfo$DesktopShareInfo to retrieve information about the Desktop from where the contacts (other Desktop Users who are registered, have a valid Dekoh Id, and an installed Dekoh desktop) have shared some application for you. Use the method, hasOnlineBuddies() to retrieve online/offline status about contacts (other Desktop Users) who have shared an application to this Desktop user. Sharing In DataTo access data from someone’s web application, you will typically use the URL in the browser and connect to the application. For example, to access Dekoh Photo’s application, you will have to type http://dekoh.com/photos/app on your browser.As you (Desktop User) may not want to authenticate yourself with Dekoh network each time you want to access a remote shared application, you can create URLs that are pre-authenticated. To do this, use the com.pramati.bfly.das.contacts.helper.DekohNetworkRequestHelper. This is basically a helper class that returns remote requests information. You will need to login to Dekoh Desktop to create a Remote URL connection. Once you are logged in, you will need to provide your authenticated DesktopUser for connecting to the remote URL. This will result in an already open connection and you will not require to login again. Simply start viewing and working with the application. |