Monday, August 21, 2006

Eclipse Test and Performance Tools Platform

Eclipse Test and Performance Tools Platform (TPTP) provides a comprehensive suite of open source performance-testing and profiling tools, including integrated application monitoring, testing, tracing and profiling log analyzing and static-code analysis tools. The Eclipse Callisto 3.2 release includes version 4.2 of the Eclipse Test & Performance Tools Platform (TPTP). OnJava.com recently featured an introduction to using the tool. TPTP lets you test several aspects of your application's behavior, including memory usage, execution statistics, and test coverage.

Installing TPTP

Open the Remote Update window (Help -> Software Updates -> Find and Install), and select the Callisto Discovery Site. If Callisto Discovery Site is not listed, add a "New Remote Site", and add http://download.eclipse.org/callisto/releases/, to the list and select it. You will have to select the "Charting and Reporting", "Enabling features" and "Testing and Performance" options to install.

Profiling with Eclipse TPTP

Follow these steps to profile an application
  1. Create a JUnit test profile using "Run -> Profile" option from the main menu. If you have a test package, it will be automatically selected in the "Test" tab of the profile dialog box.
    Eclipse TPTP profiling -1
  2. Select the "Monitor" tab and choose the required options.
    Eclipse TPTP profiling - 2
  3. Click on profile.
Once eclipse finishes profiling, you can go to the "Profiling and Logging" perspective and analyze the results of the profiler.
References:
  1. Profiling Your Applications with Eclipse Callisto
  2. Eclipse Test and Performance Tools Platform
  3. Introduction: Eclipse Test and Performance Tools Platform (Tutorial)
  4. Eclipse Test and Performance Tools Platform, Part 1: Test, profile, and monitor applications (Tutorial)
  5. Eclipse Test and Performance Tools Platform, Part 2: Monitor applications (Tutorial)

Tuesday, August 15, 2006

Opensourcing Java

Sun has provided some further details of its plans to open-source its JDK, including the unveiling of a new Open Sourcing the JDK java.net page for updates and discussion.

Thursday, August 10, 2006

Spring 2 and JPA tutorials

A new tutorial on Developerworks,"Introduction to Spring 2 and JPA" discusses the use of Spring 2 framework and Java Persistence API (JPA). You will build a Web application from scratch, step by step, assisted by the Spring 2 framework.
This tutorial does not attempt to cover all of Spring 2's features and options. Instead, it focuses narrowly on one proven approach to server application development using Spring. You will proceed through a complete "from concept to application" cycle, including:
  • Performing domain analysis
  • Coding business objects and services
  • Unit testing of business objects
  • Adding data access code painlessly to business objects using Spring JPA
  • Implementing your services using Spring DAO (data access object)
  • Coding integration tests for your services against DB2 Express-C
  • Creating controllers for a Spring Model-View-Controller (MVC) based user interface
  • Designing views for the user interface
  • Creating a deployable WAR file of your application
  • Configuring and deploying your application on the Apache Tomcat server
The following is a list of other related articles for different application server environments

Tuesday, August 08, 2006

SOA for Dummies Book IBM Edition

Bobby woolf writes:

There is (will be) an SOA for Dummies book. And IBM will send you a copy for free.

Go to SOA for Dummies Book IBM Edition and log into your IBM account (such as your developerWorks login) (or create one). As usual, it prompts you to verify and update your personal information; make sure your mailing address is correct! Because when you press Submit, the next screen says, "You [sic] book will be shipped right away."

What you'll get (according to Sandy) is a copy of Service-Oriented Architecture For Dummies (Amazon) ("The fun and easy way to find out about SOA." SOA, fun and easy?!) which is scheduled to be available 4Q06. I haven't seen the book, so I don't know if it's any good or not. But the price is right, at least when you get the hookup from IBM.

Monday, August 07, 2006

JDBC 4.0 in Mustang

In a recent article, Srini Penchikala offers a thorough overview of the database changes in Mustang in JDBC 4.0 Enhancements in Java SE 6. This article provides an overview of the JDBC 4.0 enhancements and what benefits they offer to enterprise Java developers." Here is a summary: The major features added in JDBC 4.0 include:
  1. Auto-loading of JDBC driver class: No need to explicitly load JDBC drivers using Class.forName(). When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from among the JDBC drivers that were loaded at initialization and those loaded explicitly using the same class loader as the current application.
  2. Connection management enhancements: We can get a connection to any data source by simply supplying a set of parameters (such as host name and port number) to a standard connection factory mechanism. New methods were added to Connection and Statement interfaces to permit improved connection state tracking and greater flexibility when managing Statement objects in pool environments.
  3. Support for RowId SQL type: The RowID interface was added to JDBC 4.0 to support the ROWID data type which is supported by databases such as Oracle and DB2. RowId is useful in cases where there are multiple records that don't have a unique identifier column and you need to store the query output in a Collection (such Hashtable) that doesn't allow duplicates. We can use ResultSet's getRowId() method to get a RowId and PreparedStatement's setRowId() method to use the RowId in a query.
  4. DataSet implementation of SQL using Annotations: The JDBC 4.0 specification leverages annotations (added in Java SE 5) to allow developers to associate a SQL query with a Java class without writing a lot of code to achieve this association. Also, by using the Generics (JSR 014) and metadata (JSR 175) APIs, we can associate the SQL queries with Java objects specifying query input and output parameters.
  5. SQL exception handling enhancements:
    1. New SQLException sub-classes
    2. Support for causal relationships
    3. Support for enhanced for-each loop
  6. SQL XML support: Introduces the notion of how to express XML data in a SQL datastore. Additional APIs have been added to allow applications access to thisdata.

Thursday, August 03, 2006

Using jCIFS for Authentication

JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java. CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive ...). This client is used extensively in production on large Intranets. The JCIFS SMB client library enables Java applications to remotely access shared files and directories on SMB file servers(i.e. a Microsoft Windows "share") in addition to domain, workgroup, and server enumeration of NetBIOS over TCP/IP networks. It is an advanced implementation of the CIFS protocol supporting Unicode, batching, multiplexing of threaded callers, encrypted authentication, transactions, the Remote Access Protocol (RAP), and much more. It is licensed under LGPL which means commercial organizations can legitimately use it with their proprietary code(you just can't sell or give away a modified binary only version of the library itself without reciprocation). While the core library is for implementing File Sharing, we can also use it for authentication using LDAP. The following are a sequence of steps to setup jCIFS for authentication:
  1. Download jCIFS from the site.
  2. The following three lines of code are enough to check authentication
    UniAddress uniaddress = UniAddress.getByName(LDAP_Host_Name);
    NtlmPasswordAuthentication ntlmpasswordauthentication = new NtlmPasswordAuthentication(domain, username, password);
    SmbSession.logon(uniaddress, ntlmpasswordauthentication);
  3. If the authentication fails, then the logon method throws an exception.
This type of authentication can also be achieved by using JNDI, jCIFS adds more to this, i.e. jCIFS supports NTLM authentication, i.e. users within the domain are not challenged for username and password (if using Internet Explorer, Firefox always prompts for password). This feature is similar to the SPNEGO TAI provided with WebSphere Application server. To know how to setup NTLM authentication with jCIFS, visit the JCIFS NTLM HTTP Authentication page.

Wednesday, August 02, 2006

Jad Decompiler Plug-in for Eclipse

JAD Eclipse is an eclipse plug-in for the JAD Decompiler. The following is a quick description of how to setup JAD Eclipse (assuming you already have eclipse setup).
  1. Download the latest version of JAD decompiler and set modify your path to add JAD_HOME directory.
  2. Download the latest version of JAD Eclipse from the link shown above and extract it to your eclipse plugins directory.
  3. Restart eclipse and configure JAD as follows
    1. In eclipse, go to - Window->Preferences->Java->JadClipse
    2. Set Path to decompiler to "jad" (jad is already in your path).Click Apply.
This is the basic setup for running JAD Eclipse. You will be able to look in to you library classes by simply clicking on the class file, or the class in the type hierarchy. If you are in the J2EE perspective, you can open up you jar files and look into those class files too. It is up to you to decide how you want to go. By the way, JAD eclipse also has a lot of additional customizations available, which can be seen under JAD Eclipse preferences in Eclipse.

MDD with Design Pattern Toolkit

The Design Pattern Toolkit is an Eclipse-enabled template engine for generating applications based on customizable, model-driven architecture transformations. The following is a list of the features available in the DPTK
  • Pattern Templates: Pattern authors in DPTK build pattern templates out of tags. These tags have special behaviors that access the model, execute logic, and perform various other tasks. The rich set of tags offers much functionality and, in fact, represents the basic building blocks needed to build arbitrarily complex MDD transformations. The main goal of a pattern template is to generate artifacts
  • Model View Controller for code generation: Model View Controller (MVC) is a popular design pattern for building many different types of applications. For example, in Java EE, frameworks like Java Server Faces and Struts specialize just in providing MVC design.
For more information refer to :

Tuesday, August 01, 2006

WebSphere Portal V6

The latest WebSphere Portal (V6) improves efficiency and productivity through a significantly improved user experience and with additional personalization capabilities. You can accelerate your application and content deployment using the new composite application capabilities. You can dramatically simplify portlet development using IBM WebSphere Portlet Factory, which is now part of the WebSphere Portal family. WebSphere Portal V6 enables responsiveness and reliability at a lower cost and it provides new options for high availability and continuous operations.

WebSphere Portal V6 comes in three editions. WebSphere Portal Server, the entry offering, provides core portal function. WebSphere Portal Enable and WebSphere Portal Extend add additional functionality to the base edition, such as Web content and document management, workflow, instant messaging, and electronic forms. The following are the new features in this version:
  • Enhanced support for SOA: WebSphere Portal V6 simplifies working with composite applications. It includes a new application framework for business users to easily assemble and customize linked applications and process components into composite applications.
  • Simplified portlet creation: The portal-based interface provides a personalized experience, which considers the user's identity, role, and personal preferences.
  • Workflow support: Portals bring together vital information, application and content; they also bring together processes and enable people to interact with them in interesting ways. For example, people interact with processes and with each other. People are important elements in any process to keep things running smoothly (that is, to manage issues that pop up or to resolve problems). People-centric collaboration is about enabling human and process interaction with consistent levels of service. WebSphere Portal V6 includes a workflow builder as a technical preview which enables business users to create and modify departmental workflows which, in a non-portal environment, would typically be implemented as email flows.
  • Interactive forms in portal interfaces:
    • Include electronic forms in a standard portal interface
    • Enable users to easily access information from other applications
    • Enable users to collaborate to create, edit, or view electronic forms
  • User interface enhancements: WebSphere Portal V6 has significantly enhanced its user experience. The look-and-feel has been completely re-worked to implement a modern, state-of-the-art UI design.
    It includes a drop-down menu, which provides access to the main functional areas of WebSphere Portal such as administration, content management, templating, and so on. Menus offer the choices which are available within the context, and they make using WebSphere Portal very intuitive.
  • Composite applications and templates: Business analysts and application designers can easily assemble composite applications which implements complex business logic from individual components, such as portlets, processes, or other code artifacts.
  • Personalizing the portal: WebSphere Portal lets you can personalize your portal for different groups of users, and you can enable administration based on attributes.
  • Content and Web content management: The Web Content Manager has been re-based on the Java Content Repository (JCR) included with WebSphere Portal. This repository is based on the JSR 170 standard.
For more information visit the article "What's new in WebSphere Portal Version 6?"

Java XPath API

Java 5 introduces the javax.xml.xpath package, an XML object-model independent library for querying documents with XPath. Java 5 introduced the javax.xml.xpath package to provide an engine and object-model independent XPath library. This package is also available in Java 1.3 and later if you install Java API for XML Processing (JAXP) 1.3 separately. Among other products, Xalan 2.7 and Saxon 8 include an implementation of this library.
A following code snippet shows how easy it is to use the new API.

//Parse document.
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse("books.xml");

//Build XPath expression.
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr
= xpath.compile("//book[author='Neal Stephenson']/title/text()");

// Make the query
Object result = expr.evaluate(doc, XPathConstants.NODESET);

//Print results
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
System.out.println(nodes.item(i).getNodeValue());
}
This example is taken from Elliotte Rusty Harold's article on developerworks titled "The Java XPath API" (I added a few comments).The following is a list of resources for learning XPath and the Java XPath API:

Popular Posts