Sunday, August 21, 2005

Websphere Business Integration Modeler notes

Notes from reading an article on WBI Modeler

Article is at: http://www-128.ibm.com/developerworks/websphere/library/techarticles/0502_mitra1/0502_mitra1.html

 

High level steps for creating a business models are as below:

 

  Creating a business modeling project.

  Creating the business items.

  Creating the process model (that involves identifying the individual tasks and defining their inputs and outputs).

  Creating the process flow by connecting the tasks together (as sequential or parallel steps).

 

 

Notes from reading documentation on WBI 5.1.1 on infocenter

 

Models are organized into folders which are referred to as catalogs.

 

In the same project multiple data catalogs/resources/organization/report/process can be created and they can also be nested.

 

Both processes and tasks represent activities that are performed in a business. Processes are more complex than tasks, however, and can be represented as a sequence of activities that are linked by flows of control and data. This sequence as a whole is known as a process flow. By contrast, tasks are atomic activities that cannot be divided into smaller actions. For example, Payment Handling is a process made up of three tasks: Input Customer Information, Input Customer Order, and Obtain Product Availability

 

The difference between a merge and a join is that in merge as soon as an input is received it is sent as an output where as in join it waits till all the inputs are received.

 

A single process can have multiple start nodes.

 

A stop node marks the end of a process. Every process, subprocess, and loop must have at least one stop node. When a flow reaches a stop node while the process is running, the process immediately terminates, even if there are other currently executing flows within the process.

 

Tasks are the basic building blocks representing activities in a process model. Each task performs some function. Visually, a task represents the lowest level of work you can portray in a process.

 

There are two types of tasks: local (specific to the process) and global (reusable within a project). A local task is owned by a process and can only be used by elements within that process. The task exists only while the process exists. A global task is a top-level task that you create in the Project Tree within a process catalog. It can be used by multiple processes within the project.

Sunday, July 17, 2005

How to handle logging in portlets?

There are several ways to go about this and one can choose the approach according to ones taste and organizational standards.

At high level below are some of the logging options.

1. Good old System.out but use this only during initial development phase. Plan on converting this to some logging framework as soon as possible. You can either do global replace all or use a free eclipse plugin, log4e, to convert to log4j statements.

2. Jakarta Log4j which seems to be the industry standard.

3. JDK 1.4 logging apis.

4. Simple Log from java.net

5. Websphere logging apis which is my preference.

There must be several more open source, vendor propritery, and in-house developed logging framework.

I will continue with this article with my experience on using log4j, system.out and websphere apis as soon as i collect my thoughts on this.

Wednesday, July 06, 2005

top 10 architecture books

I had initially added this list based on an article in software development journal for my note. Since than based on a feedback I have extended the list. Clicking the link takes to amazon's web site.

  1. Agile Software Development with SCRUM (Paperback)by Ken Schwaber, Mike Beedle

  2. Software Requirements, Second Edition (Paperback) by Karl E. Wiegers

  3. The Mythical Man-Month: Essays on Software Engineering, 20th Anniversary Edition (Paperback) by Frederick P. Brooks

  4. Software Factories: Assembling Applications with Patterns, Models, Frameworks, and Tools (Paperback) by Jack Greenfield, Keith Short, Steve Cook, Stuart Kent, John Crupi
  5. Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans (Hardcover)

  6. Beyond Software Architecture: Creating and Sustaining Winning Solutions (Paperback) by Luke Hohmann
  7. Agile Software Development, Principles, Patterns, and Practices (Hardcover) by Robert C. Martin

  8. Software Architecture Design Patterns in Java (Hardcover) by Partha Kuchana

  9. Documenting Software Architectures: Views and Beyond (Hardcover) by Paul Clements, Felix Bachmann, Len Bass, David Garlan, James Ivers, Reed Little, Robert Nord, Judith Stafford
  10. Pattern-Oriented Software Architecture, Volume 1: A System of Patterns (Hardcover) by Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, Michael Stal, Peter Sommerlad, Michael Stal

  11. Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

  12. Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts
  13. Patterns of Enterprise Application Architecture by Martin Fowler

Saturday, May 28, 2005

jsse tips

1. To add public key to keystore from certificat file (*.pem, *.der, *.cer) is as below:
keytool -import -alias myalias -file certfile -keypass passwd -keystore storename -storepass passwd

2. To start a java client with debug info is:
java -Djavax.net.debug=ssl -Djavax.net.ssl.KeyStore=storename -Djavax.net.ssl.trustStore=storename javaclient


3. Use the below java code that works with point #2 above.

SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
SSLSocket socket = (SSLSocket) factory.createSocket("localhost", 443).

rest of the code is standard to get output stream and use buffered reader.

4. an alternate approach is at javaworld article

Sunday, May 15, 2005

IBM portlet programming interview questions

What is the difference between a servlet and a portlet?
Portlet is basically an extension of servlet but with some fundamental differences like a web page can consist of mulitple portlets but can have only single servlet, portlets cannot do browser redirect but servlet can.

What are the similarities between a servlet and a portlet?
Portlet is a an extension of servlet, can write html output, can forward but within the same portlet context, access to HTTP objects like session, request, response, along with similar Portlet objects like session, request, response.

What is WSRP?
Web Services Remote Portlet.

What are the different approaches for logging in portlet?
Websphere log apis, log4j, custom logging, jdk1.4 log apis and any logging framework should work just as well.

What are the different approaches for managing environment specific configuration?
Properties file, portlet attributes (configured via the config-param in portlet.xml).

Difference between abstract portlet and concrete portlet?

Explain struts portlet. How to create one?
Create a struts standalone web app and convert to portlet. There are 8-10 steps to do so.

Explain JSR168 portlet. How to create one?
Use WSAD wizard.

What is the difference between HTTPRequest and PortletRequest?
HTTPRequest is for the entire portal page and portlet request is abstracted out of HTTPRequest and is unique per portlet. As best practises portlet code should use PortletRequest object.

Should you use class scoped variables in portlet?
No, single instance of portlet in the JVM and so can cause data corruption if variable values are changed. However, no harm in using "final static" singleton kind of variables.

Can you do browser redirects from the portlet?
No, only forward.

What does the tag <portletApi:init /> do?
Initializes portletRequest, portletResponse, etc on the page.

What are the different portlet states?
Maximize, Normak, Minimize.

What are the different portlet modes?
View, Edit, Configure, Help.

Portlets execute in two steps, what are those?
Action and render in portal 5.0. There is a new phase IStrutsPrepareRendor introduced in portal 5.1 to address browser refresh, back, etc issue.

How to access external systems from portlet code like database, credential vault, and ftp server?

What is portal service?

patterns

There is pattern everywhere or should we say everything is a pattern. It is patterned that mango seed will grow into a mango plant, baby into a grown up, and so on. These patterns exist in nature. We also tend to do things in pattern, cars are mass produced in patterns, we invented patterns to build buildings and bridges. There are also patterns in the software world like Facade and DAO (Data Access Object).

But it looks like that sometimes there could be anamolies in the patterns. The patterns may not be perfect, there may be disadvantages, or they may not be just right. In the software world there is something called anti-patterns. Sometimes in nature we see malformed plants and animals which does not seem to conform to intended behavior of pattern.

Wednesday, November 10, 2004

Kapow Robots

I am using Kapow to create 'web clipping robots'. It is kind of neat as Kapow lets you clip any page and then out of the box you can create IBM Portal 5 portlets. You can also create portlets for BEA portal 8.1. I was able to successfully create 3 IBM portlets. These were created as .war files and I was able to install them seamlessly in our test environment. We had RoboServer also running in the background and it looked like it was all set. However the portlet contents were empty. Troubleshooting revealed that Kapow also creates a .robot file for every web clipped content and they needed to be installed under the "{KAPOW_HOME}|projects" folder.

By the way linux version of Kapow provide "RoboServer" and "RoboServerService" as runtime component. Use RoboServer, I am not sure what RoboServerService is as it was not doing anything.

Friday, November 05, 2004

notes on ibm portal 5.02

I am currently working on IBM portal v5.02. At first glance this looks like way behind BEA portal 8.1 but looks to be very stable and deploying a new portlet is much easier (just export as a war file). Below are some of the notes that I found useful while reading on IBM portal.

Usually, many portlets are invoked in the course of handling a single request, each one appending its content to the overall page. Some portlets can be rendered in parallel, so that WebSphere Portal assembles all the markup fragments when all the portlets finish or time out. Portlets that are not considered thread-safe are rendered sequentially

WebSphere Portal provides discoverable services for its credential vault, for managing persistent TCP/IP connections, and for managing the WebSphere Portal content repository.

WebSphere Portal includes the Document Manager portlet application for contributing and sharing documents between users. Document Manager provides a simple method for storing, navigating, viewing, and searching documents and other content.

By defining the transcoding PortletFilter on a portlet, the portlet HTML output can be converted to WML or cHTML, depending on the device that is making the request

The WebSphere Portal page aggregation subsystem supports several markup languages and recognizes certain browsers and mobile device user agent signatures, all out of the box. The framework is easy to extend to support additional markups or new devices.

The default set of user profile attributes is based on the inetOrgPerson schema, which is supported by most LDAP directories. The user repository might consist of multiple data sources.

The mapping of user profile attributes to LDAP object classes is defined using in the file wms.xml.

The file attributeMap.xml specifies the details of how each attribute is mapped to the LDAP directory or database.

After determining the identity of the user, the portal server consults locally cached access control lists to determine which pages and portlets a user has permission to access.



Sunday, October 31, 2004

notes on bea workshop 8.1 page flow

--- Basically, a page flow is a directory of Web app files that work together to implement a UI feature.


--- The *.jpf file is also a BEA innovation and is the main focus of this article. It contains annotated Java code that implements the navigation and state management logic.


--- Many classes in Java Page Flow inherit from Struts classes and interoperate with the Struts plumbing that serves as the foundation for the Java Page Flow runtime.


--- All action methods are specially annotated with @jpf:action to indicate to the *.jpf compiler that they should be configured as action methods in the auto-generated Struts configuration files. Also, all action methods may be annotated with @jpf:forward to indicate to the *.jpf compiler and to the IDE tools the possible navigation decisions that the action methods may make such as deciding to forward to a page like address.jsp.


--- Because the page flow runtime makes it possible to cache state in controller instance members, it’s very easy to implement support for a back button in a wizard.


--- WebLogic Workshop makes it easy to expose business logic as controls, and the Java Page Flow feature makes it easy to call controls from action methods. Because the page flow runtime performs automatic instantiation and initialization of controls for all instance members that are annotated with @common:control, action methods in page flow controllers may call Workshop controls without having to include code that performs control instantiation and initialization. For example, the confirmation_next action method can simply and directly call the createUser( ) method of UserManager.jcs:


--- Every page flow must have a begin method. The begin method is the first method executed when your page flow is invoked by a web browser


--- Form Beans are used to separate the data presentation layer from the data processing layer of your web application. Form Beans are used as intermediaries between the data that users input into JPS pages and the Action methods. Instead of submitting the data directly to the Action method, the data is first databound to a Form Bean and this Form Bean is then passed as a parameter to the Action method. This helps to separate the presentation layer (i.e., the user input forms on the JSP pages) and the processing layer (i.e., the Action methods), because the Form Bean can play a flexible, intermediary role.


--- Page flows allow you to separate how your web application processes data from how it presents that data to users. When data processing is separated from data presentation, it's much easier to re-use the data processing aspects of the application in other contexts and to manage any future changes to your web application. Page flows link data processing and data presentation by means of databinding. Databinding is accomplished through the use of a special library of JSP tags that allow you to associate the presentation of data on the JSP pages with the data processing inside the page flow file. The special library of JSP tags begin with the prefix "netui-databinding". Two cases of databinding: (1) databinding when a user submits data, (2) databinding when data is displayed to the user.


--- A page flow is a Java class that controls the behavior of a web application through the use of specially designed annotations and methods. The directory that contains the page flow class also includes the JavaServer Pages (JSPs) used in the page flow. For a JSP to be considered part of a page flow, it must reside within the page flow directory. The JSP files use special tags which help bind to data and business logic actions. The actions in the JSP correspond to action methods that are defined in the page flow. These actions methods implement code that can result in site navigation, passing data, or invoking back-end business logic via controls. Significantly, the business logic in the page flow class is separate from the presentation code defined in the JSP files.

--- Data binding is the process that ties data to presentation tags in JSPs, thereby creating dynamic web applications that are easy to build and maintain.
--- Components of the Page Flow Programming Model
Page flows implement user interface control logic, and contain:

Action methods
Form beans - A form bean class is typically defined as an inner class within a page flow class, and in most cases extend com.bea.wlw.netui.pageflow.FormData
Forward objects

In the page flow class, action methods are methods that are annotated with a @jpf:action tag. Action methods can perform several functions:

Implement navigation decisions
Flow data into and out of pages
Invoke back-end business logic via calls to controls


--- Advantages of Using Page Flows

Ease of use
Nested page flows
State management
Rich Data binding features
Service-oriented design with Java controls
Integration with Portal
Strong data typing
Powerful exception handling
Iterative development experience
Built on the open-source Struts framework



--- When your form bean contains a complex data type, you must add a reset method to your form bean definition to ensure that an instance of the complex class is available to hold the values that the user entered in a form and subsequently submitted (posted).

Note: The reset method is called by the underlying Struts framework used by WebLogic Workshop. You do not need to call this method directly anywhere in the code.

public void reset(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request)
{
this.customer = new Customer(); //initialize complex class.
}


--- The NetUI Data Binding tags fall into one of the following categories:

Method invocation tags
Repeater tags
The CellRepeater tag
Grid tags


---