IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > Dashboard > IBM Composite Applications > ... > Home > Understanding the data model
developerWorks
Log In   View a printable version of the current page.
Overview Spaces Forums Blogs Podcasts Wikis Exchange
Understanding the data model
Added by bobbalfe, last edited by Dan Sickles on Mar 14, 2008  (view change)
Labels: 
(None)

Understanding the data model of composite applications

Introduction

The composite application data model is very similar to the model on Websphere Portal for applications.  Understanding the model is key to creating great applications.  You access the model using the Topology Handler Api's in Lotus Expeditor.
You have three basic levels of data:

Application
   |_Pages
        |_Components

A page in the client platform is equivalent to an Eclipse perspective. The page id (which can be accessed from the Page class) is actually the Eclipse perspective Id.  You can use the Eclipse API's to show a page using that same id. The components have a similar mapping. Most components, not all, are equivalent to Eclipse views. The secondary Id of the view is used as the unique Id for the component. You can get a handle to the preferences of a component by using the secondary Id of a view part. Here is some sample code that shows how to get that secondary Id from a view part:

IViewPart view;

//get the view from the workbench, an action, or some other means
String secondaryId = view.getViewSite().getSecondaryId();

Each level has preferences and properties that can be entered in the Composite Application editor and then accessed using the Topology Handler API's. You can start by getting a handle to the Topology service. Creating helper methods in your plugin somewhere to get the service will help out. The service can always be null so you need to check for that when getting the service object.

//Declare a global scoped variable in a utility class or your plugin class
ServiceTracker thTracker = null;

//In your start() method of your plugin or in the constructor of your class initialize the tracker
thTracker = new ServiceTracker(context, TopologyHandler.class.getName(), null);
thTracker.open();

//Create a method for your code to get a handle to the TopologyHandler service
public TopologyHandler getTopologyService(){
        if (thTracker != null)
            return (TopologyHandler )thTracker.getService();
        else
            return null;
}

Getting a list of all applications

You may want to know what applications are installed.  This could be helpful if you are trying to find a specific component or page installed into the system. Each application has a unique identifier called a GUID - Global Unique Identifier.

String[] guids = handler.getApplicationGUIDs();

After you get the list of guid's you can iterate through the Ids and call the TopologyHandler method getApplicationNavigationTree() which returns you a Navigation object. From there you can get references to all of the pages and components for a given application.

Getting the page object from a perspective id

Since the perspective id is the same as a page id you can use the TopologyHandler API getNavigation() to get an object for the current page. For instance, say you are in some code where you have no handle to the current composite application page. You can query the Eclipse workbench API's to get the current perspective, then get its perspective Id and use that same string to retrieve the Page object form the getNavigation() method.

String pageId = workbenchpage.getPerspective().getId()

Page np = (Page)handler.getNavigation(pageId);

Accessing a components data area

One of the great things about this model is you can store preferences at all three levels - then access those preferences to drive things like the user interface (fonts, colors), connection information, or any initialization data.

TopologyHandler th = MyPlugin.getDefault().getTopologyService();
if (th == null) return;

ComponentData data = th.getComponentData(view.getViewSite().getSecondaryId());
if (data == null) return;

//this may return a list if the ";;" was used to separate entries
String[] myPreference = data.getPreference("my preference");

if (myPreference == null || myPreference.length ==0)
      return;

//continue and access the myPreference object



Resources

Need support?
This wiki is designed to provide valuable information to help you, but it does not replace other technical support services. Refer the following resources for more information.

 Don't forget to Sign in to edit or comment on information. Learn how to work with the wiki. Please review the Terms and conditions, which govern your use of this site.


    About IBM Privacy Contact