A Techno Blog, mainly about Java

Borland Together

Free Community download.
The features: UML 1.4 and 2.0 modeling ,Modeling for Logical Entity Relationship diagrams , XMI import , MDL import .

July 27, 2004 Posted by | Patterns & UML | Leave a comment

XML and Java

An XSD refresher:

Definition (XSD)
– industry standard, platform independent XML Schema Language.


Default Schema Namespace: states that all the elements used within the schema belong to that particular namespace
<schema xmlns=””&gt;

However, usually in form with a a default prefix:
<xsd:schema xmlns:xs=””&gt;

More than one namespace may be declared. One may be declared as the default namespace, another as a namespace that will be associated with certain elements :


The targetNamespace attribute defines the namespace for the document instance (the XML document.)

By default only globally declared (top-Level) elements are associated with the targetNamespace attribute. These are elements that are directly descended from the RootElement.

If the targetNamespace attribute is added to the schema element, then the prefix DOES NEED to be added to each and every component of the schema.
To add locally declared attributes to the targetNamespace, add the attributeFormDefault attribute to the schema element and use the value of “qualified.”

Stating form=”unqualified” within an schema’s element declaration will unqualify that element from the namespace.


SAX Project (old URL)
SAX is the Simple API for
XML. SAX has recently switched over to the SourceForge project infrastructure.
It is a standard for XML parsers. It reads the XML document and sends an event
for each element it encounters. Provides “sequential access” into the xml
document. It is fast, requires little memory. Sax works by callbacks. You call
the parser, its calls the methods that you supply.
– SAXParserFactory factory
= SAXParserFactory factory.newInstance();
– SAXParser saxParser =
– XMLReader parser = saxParser.getXMLReader();




standard for XML parsers. It reads the entire XML document into memory and

stores it into a tree data structure. Provides “random access” into the xml

document. It is slow, requires huge amounts of memory.

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();
– Document document

(named after the Xerces Blue butterfly)

Xerces2 – next generation
of high performance, fully compliant XML parsers in the Apache Xerces family.

[slides] [devshed]

JAXB (Java API for XML Binding)

Generate XML Mapping Code
with JAXB
: “It rapidly generates XML mapping code for you, saving time and
effort, and reducing both costs and risks.

ADVISOR: JAXB: A Foundation for Web Services
:Learn all about the Java Architecture for XML Data Binding and implement
lightweight XML-processing applications using the reference implementation


July 27, 2004 Posted by | XML | Leave a comment

Portlet Programming

This entry will document my learning on programming with Portlets. First link is an introduction on Portlets by two IBMers. Also, referenced is an article on Understanding the Portal Specification. The JSR168 spec and JavaPassion slides [1] [2].

Three main components:
portal (server): presentation layer, or an application which aggregates portlet applications together in a presentable format. Portals provide a secure, single point of interaction with diverse information, business processes, and people, personalized to a user’s needs and responsibilities. A portal server provides common services such as application connectivity, integration, administration, and presentation that would be required across all portal environments.

portlets: a portlet is a Java servlet that operates inside a portal. In other words, it is an individual web component that is made accessible to users via the portal.

portal container: sits between a portal and its portlets. The portlet container manages the lifecycle of the portlets. Controls portlet mode (View, Edit, and Help ) and window state (how much content should appear).

1) Users issue requests against portlets from the portal.
2) The portlet container receives requests from the portal server (instead of a web browser) and invokes the portlet’s “doView” and “doEdit” .
3)The portlet returns the generated markup.
4) The portal server aggregates the portlet makup for display.
5)The client displays the markup.

Portlet exposes four lifecycle methods:

– init(PortletConfig config)
– processAction(ActionRequest request, ActionResponse response)
– render(RenderRequest request, RenderResponse response)
– destroy()

* GenericPortlet: implements the render method and defines three empty methods, doView, doEdit, and doHelp. Your subclass of GenericPortlet can implement any of these methods.

* The ActionListener turns user clicks in your pages into action events…the WindowListener notifies your portlet of window events from the portal, such as when your portlet is maximixed, minimized, and restored. The MessageListener lets you handle messages sent from one portlet to another.

*PortletPreferences is an object that can be used to store persistent data for a portlet user.

*PortletSession : storing information within a user’s session.

*PortletRequestDistpacher: works in the same way a RequestDispatcher would in servlets.

*PortalContext: object can be used to query information about a portals supported extensions.

Onto Developing the Portlets:

July 27, 2004 Posted by | Portals | Leave a comment