IBM Mashup Center is an end-to-end enterprise mashup platform, supporting rapid assembly of dynamic web applications with the management, security, and governance capabilities IT requires. IBM Mashup Center is an end-to-end mashup platform enabling the rapid creation, sharing, and discovery of reusable application building blocks (widgets, feeds, mashups) that can be easily assembled into new applications or leveraged within existing applications - delivering lower development costs, rapid return on investment (ROI), quick delivery of dynamic applications, and greater productivity. Lotus Widget Factory is a development environment for creating custom widgets that run in IBM Mashup Center.
In this chapter, we show how Lotus Widget factory and IBM Mashup Center can leverage IBM Connections REST API to build dynamic web application based on IBM Connections. Lotus Widget Factory can be used to create iWidget which utilizes IBM Connections API to display or manipulate data from IBM Connections. IBM Mashup Center can use created iWidget to host and display. IBM Mashup Center can transform and remix IBM Connections REST API to visualize data from IBM Connections.
Using Lotus Widget Factory
Lotus Widget Factory is an easy-to-use integrated development environment that provides ability to develop dynamic iWidgets without any coding. All level of skilled developers can use Lotus Widget Factory for rapid development of widgets. Lotus Widget Factory also allows seamless deployment of widgets to IBM Mashup Center. Lotus Widget Factory provides wizards to ease widget creation process. There is built-in support for widget customization, widget event handling, and reuse of existing application and data sources. Lotus Widget Factory can use existing data sources which exposes data through REST service, Web Service, or in some other forms for creating dynamic widget.
The following figure shows the Lotus Widget Factory layout.
Terminology of Lotus Widget Factory
The following terms are commonly used while talking about Lotus Widget Factory.
A builder is a reusable component that generates web application artifacts including, but not limited to Java and JSP code based on the context in which it is called. A builder might add something as simple as a button to a JSP page, link up all of the fields in a form to an XML variable, or help you to create or consume a web service. A more complicated builder may add multiple pages with forms and controls to the web application. Think of a builder as a virtual programmer that can dynamically write code. The builder can write different code in different situations or based on different profiles. Deploy
In Lotus Widget Factory, deploy refers to creating a WAR file for an application and installing the WAR on the target server for execution by end users.Designer
Lotus Widget Factory development which is used to assemble builders into applications and widgets. Lotus Widget Factory designer plugs into Eclipse and IBM Rational Development Environment IDEs.Feed
A feed is a data format that allows web sites to distribute frequently updated content to web-based consumers such as mashups and portal-based composite applications. In Lotus Widget Factory, you can create widgets that display content from feeds. Feeds can be of various formats, including Atom Syndication Format and Really Simple Syndication (RSS). For more information about feeds, see http://en.wikipedia.org/wiki/Web_feed
A mashup is a lightweight web application that blends (or mashes) together information from two or more data sources into an integrated and new experience. Mashups typically mash data either to create a new data source or a new application that presents data in a single graphical interface. In a business environment, a mashup typically combines enterprise and Web-based data from an assembly of widgets into a single, dynamic application to address a specific situation or problem. Widgets do not need to be aware of each other before the mashing occurs. Model
A model is a container that holds a set of calls to builders, which in turn generate the application components representing the behavior, the structure, data, and presentation of the application. A model is simply an XML file containing a series of calls to builders.Project
A project is the top level of organization of your resources in your Lotus Widget factory Designer - an Eclipse based IDE. A project contains files and folders. Projects are used for building, version management, sharing, and organizing resources. A project can contain session and persistent properties, settings for environment variables, and references to other projectsPublish
In Lotus Widget Factory, the publish action is used to make widgets known to the Lotus Mashups Toolbox so that they are available for use in constructing mashup pages.WAR file
A web archive (WAR) file is a packaged web application that can be exported to test, deploy, and publish the resources developed within a web project.Widget
A widget is a small, portable application or piece of dynamic content that can easily be placed into a web page or an embedded browser within a rich client. Widgets can be written in any language (Java, .NET, PHP, and more) or can be a simple HTML fragment. Widgets that pass events can be wired together to create mashups. Widgets are called different names by different vendors, for example gadgets, blocks, and flakes.
You can create widgets with a variety of tools, including Lotus Widget Factory, Eclipse, IBM WebSphere sMash, or even Notepad. To ease the widget creation and deployment process, Lotus Widget Factory is included with IBM Mashups. Lotus Widget Factory is an Eclipse-based rapid widget creation environment.
Creating a project in Lotus Widget Factory
In the following example, we demonstrate how we can use Lotus Widget Factory to build widget based on IBM Connections API.
A single Lotus Widget Factory can contain several widgets. Project contains model that implements widget that you want to create. Follow these steps to create new a project HelloWorld:
- Open Lotus Widget Factory designer, the graphical, browser-based tool for editing models and developing widgets. To open the tool, go to Start -> Programs -> IBM Lotus Widget Factory. The Lotus Widget Factory user interface appears.
- Select File -> New -> Lotus Widget Factory Project from the File menu. The new project wizard opens.
- Enter the project name: HelloWorld
- Click Finish. In this scenario, you accept the defaults for project creation. You now have created a Lotus Widget Factory project.
- The new project wizard prompts you for permission to automatically deploy the project. If you have the Lotus Mashups server installed and running, click Yes.
Deploying the project at this point means that any changes you make to the current project, including creating new widgets, are automatically saved. You see the project appear in the Project Explorer pane of the user interface.
The following figure shows the HelloWorld project created in Lotus Widget Factory.
The structure of a Lotus Widget Factory
project consists of the following components:
- Deployment Descriptor: This is an XML file that contains deployment information, MIME types, session configuration details, and other settings for a web application. The web deployment descriptor file (web.xml) provides information about the WAR file is shared with the developers, assemblers, and deployers in a J2EE environment.
- Java Resources Soruce: Contains all the libraries of your Java runtime environment. Normally, you do not need to change anything in this folder.
- Model: Contains all of the models in your project. The model directory is a link to the model directory contained in the WebContent folder. You can use either directory.
- Profile: Stores all your profile sets which contain your profiles and profile entries. As with the models directory, the profiles directory is a link to the profiles directory contained under the WebContent folder. You can use either directory.
- Widget Model: Contains all the models, both sample and created, that are widget-enabled in this widget project.
- WebContent: Contains all of the artifacts directly servable to the client excluding the contents of the WEB_INF folder.
Creating model in project
Lotus Widget Factory model is the fundamental object that developers use to build a widget. Other component of Lotus Widget Factory are created automatically after the project is created. A model is all of the following:
- An XML file that contains a list of builder calls with specified inputs.
- A blueprint for a Web application.
- A sequence of instructions showing how to generate the widget application.
The Lotus Widget Factory provides multiple wizards to help you create a variety of models. The REST widget wizard populates the models with all the builders required to get a basic REST-based consumer application running. The wizard is designed to be self-documenting and easy to use.
The choices that you see in the wizard depend on the feature sets that you add to your project. The progression of wizard steps that you see depends on the type of model you choose to create. When you develop your model, the result is a set of builders calls that are displayed in the Outline
pane of Widget Factory. You can modify the builders or add to them at any time. When you save the model, it saves the XML representation of the builder calls to a file within the models folder in your project.
In following steps you see how to create a model which uses REST API of IBM Connections to display public bookmarks:
- Right-click the active project and go to New -> Lotus Widget Factory Model. The model wizard appears.
- Select the project that will contain the new model, in this case HelloWorld.
- Select the type of model you want to create. In this case, select REST based view & Form and check deploy this model as widget.
- Give the widget title and choose one of the widget category. The widget category is related to Mashup Center, It decides where a widget will appear in the Mashup Center.
- On the REST Call Information panel, provide a REST API URL , User name and password, if required. Click Extract parameters from the URL.
- Leave the Sample Data panel blank - you will need to enter a sample data URL to generate a results schema if the URL entered above was parameterized and therefore, not suitable for calling at design-time to get sample data from which to create the schema.
- Select which element of REST API you want to display, for this example choose entries. Click Next.
- Select Page data display if you want to display your result with paging.
- On the Manage column panel , you are able to manage column generated by REST API, such as shorting, order of column, and heading of column.
- Do not select "Create Link to Details", this is required if you want to give same detail page when user clicks on element name displayed in widget.
- Provide a name for the model and choose its location in the project. Click Finish.
- You will have something similar to the following figure.
- Publish the model by right clicking Project then Publish. If your local server is not running then choose to run it.
- Select Run -> Run As -> Run Active Model. You see the following output at browser, displaying information about "bookmarks".
For more Information about Lotus Widget Factory, visit Lotus Widget Factory Wiki
Transforming IBM Connections API using IBM Mashup Catalogue
The IBM Mashup Center Catalog can transform and remix IBM Connections API to provide new modified feeds. These feeds can be used by widgets which can be deployed in the IBM Mashup Center. This transformed feed can also be used to visualize data from IBM Connections using out-of-box widget of IBM Mashup Center. For example, the IBM Connections profile search API can be mixed with any search engine feed to generate new feeds which will contain search results from IBM Connections and the search engine. In another example, REST API for Profiles search in IBM Connections can be changed to contain only email element and other elements such as Title and Status, that can be discarded by the IBM Mashup Center catalog.
In the following example, we demonstrate how IBM Connections profile search API can be modified to discard all elements except email and then newly transformed feeds can be displayed by "feed reader" widget which come out-of-box with IBM Mashup Center.
- Open the catalogue from the IBM Mashup Center in a new page.
- Click Create and then New Data Mashup.
- On the Data Mashup page, drag and drop the Source operator and double-click on it to open its properties. Note that there are multiple operators which can be used as per use case for manipulating one or multiple IBM Connections REST API.
- Enter http:///profiles/atom/search.do?name=ted in the URL field.
- Under the Preview tab, you can see the feed data structure which has been loaded.
- Drag and drop the Extract operator and link the Source operator wire to the Extract operator.
- Double click the Extract operator on the Properties tab. Click Extract element and choose email element under contributor element.
- Link the wire from the Extract operator to the Publish operator.
- Double-click the Publish operator to change its properties. Here you can choose type of feed you want to publish; for example, RSS, XML , ATOM , and JASON.
- In the Preview tab, you can see only the "email" element that has been filtered and rest of elements has been discarded.
- Click Save to save the newly created feed, Provide a title and version for the feed.
- After refreshing the Catalog home page, you will notice the newly created feed in the Catalog. This feed can be used by other widgets such as feed reader to get and display modified information.