Thursday, December 22, 2005

Web Services Frameworks Notes

These are notes from chapter on web services framework.
 
Web service framework comprises of standards, design patterns, other frameworks.
 
Service itself: This is divided into 2 categories, role and model. Role is basically the temporary role that  the service assumes during the runtime. These are requestor, provider, passive and active intermediaries, ultimate requestor, ultimate provider, and member role in composite scenario. Model is how the service fits into overall enterprise architecture. In this respect a service can fall into these categories, business service, utility service, and controller service.
 
Service description: This is basically describing to the outside word what the service is or in other words service contract. There are several articats that provides this contract like, wsdl, schema, policy, and legal docuemtns. Providing just the wsdl is most popular. wsdl has two parts abstract and concrete. Abstract describes portTypes, operations, and messages. Concrete describes port, bindings, and service. wsdl however does not provide semantic information about the service. UDDI is based on similar concepts of abstract and concrete. Service entity is abstract and tModels are concrete entities.
 
Messages: These are autonomous and intelligent messages that can carry with them information like how to process, route, etc. Messages adhere to SOAP protocol and a message is a envelope which has a header and body. Header is extensible and various WS* specifications leverages this feature to provide their own specific entries.
 

Sunday, December 11, 2005

cloudscape and derby

Just found out that cloudscape was donated by IBM to Apache and there it
is being worked on as database project Derby. IBM continues to work on
Derby as well as release Cloudscape versions. Looks like Cloudscape has
more features that Derby. The latest Cloudscape release is 10.x and it
is written in Java. Probably a good idea to try in next J2EE project.

Monday, November 14, 2005

Notes on visitor design pattern

The operations or the behavior of classes are implemented by concrete implementation of visitors.
Concrete visitors are implementation of visitor interface where overloaded "visit" methods are defined, one for each class that needs a visitor.
A class that supports visitor defined a method called "allowVisitor" with argument of visitor interface. The method calls the "visit" method passing "this" as argument.
The advantage of visitor pattern is that new functionality can be added without touching the existing classes but the disadvantage is that the concrete visitor probably needs to know each supportable classes in detail.

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.