Sushantnayak's Techincal Weblog

Technology that matters…

Auto-Start Apache ActiveMQ 5.4.2 with Apache Tomcat 6.0.30

Posted by sushantnayak on January 29, 2011

I could not get any helpful information, how to auto-start ActiveMQ broker from Tomcat. And thus, I finally, after 4 fruitful hours, configured.

This is my valuable contribution to open-source community.

Step 1

Install ActiveMQ and Tomcat from following places,

http://activemq.apache.org/activemq-542-release.html and

http://apache.ziply.com/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip

Also download activemq web console for autostarting activemq instance from tomcat.

http://repo1.maven.org/maven2/org/apache/activemq/activemq-web-console/5.4.2/

Step 2

Copy “activemq-all-5.4.2.jar” from activemq\lib to tomcat\lib

Copy “activemq-web-console-5.4.2.war” inside tomcat webapps

Step 3

Configure %CATALINA_HOME%\bin\catalina.bat or .sh by adding the following line

set JAVA_OPTS=”-Dwebconsole.jms.url=tcp://localhost:61616 -Dwebconsole.type=properties”

Step 4

If you have already set the java, catalina and activemq path variable then you can start the tomcat service from the console as,

C:\>startup

Step 5

Enter the following on the browser address bar,

Tomcat

http://localhost:8080/

ActiveMQ Web Console

http://localhost:8080/activemq-web-console-5.4.2/

If someone needs further information, I’m happy to help.

Open-Source community rocks !!!

Posted in Uncategorized | Tagged: , | 4 Comments »

Connect MS-Access using jdbc-odbc in Windows 7 64-bit

Posted by sushantnayak on October 25, 2010

Connect MS-Access using jdbc-odbc in Windows 7 64-bit

I faced this problem while connecting to MS-Access using JDBC-ODBC driver, on my laptop and found out this solution.

Bye-the-way I received the following error initially(in my output console).

Exception: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application

My solution as follows…

Step 1

Run the 32-bit odbc driver using

WinKey+R, then copy-paste the below command

C:\Windows\SysWOW64\odbcad32.exe
Step 2

Make a dsn named “AccessDB” or whatever name you want to.

Step 3

Create a new project in eclipse.

Step 4

Change the jre to the java installed inside

C:\Program Files (x86)\java

Use this as “JRE System Library”

Step 5

Use the below code to connect to connect mdb file named “library.mdb”(choose ur mdb file), having the path as

“D:\Study\library.mdb”

import java.sql.Connection;
import java.sql.DatabaseMetaData;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Connection con = null;
	    try {

	// Setting up the DataSource object
	      sun.jdbc.odbc.ee.DataSource ds
	        = new sun.jdbc.odbc.ee.DataSource();
	      ds.setDatabaseName("AccessDB");
	      ds.setDataSourceName("D:\\Study\\library.mdb");
	// Getting a connection object
	      con = ds.getConnection();

	// Getting database info
	      DatabaseMetaData meta = con.getMetaData();
	      System.out.println("Server name: "
	        + meta.getDatabaseProductName());
	      System.out.println("Server version: "
	        + meta.getDatabaseProductVersion());

	// Closing the connection
	      con.close();
	    } catch (Exception e) {
	      System.err.println("Exception: "+e.getMessage());
	    }
	  }
}

Viola…
Output
Server name: ACCESS
Server version: 04.00.0000

(for any clarification, do ask in my blog, I’ll be happy to explain)…

peace out…

Posted in Uncategorized | Tagged: , , , , | 10 Comments »

Web Service using MyEclipse using JAX-API and Web Client

Posted by sushantnayak on January 21, 2010

  1. Create a “Web Service Project” in the “New” window.
  2. Click on NEXT button, the “New Web Service Project” appears.
  3. Fill the “Project Name” textbox and click on FINISH button.
  4. You will see the below screen:-

  5. Create a Java class which has will be exposed as webservice.
  6. For our example we will be making a Calculator Service.

    We will create a class <Calculator> and keep it inside the package named “com.calculator.ws”.

    Click on the FINISH button after filling the details as above.

  7. The Calculator class will have the following:-
  8. package com.calculator.ws;

    public class Calculator {

    public int add(int a, int b) { return (a + b); }

    public int subtract(int a, int b) { return (a – b); }

    public int multiply(int a, int b) { return (a * b); }

    public int divide(int a, int b) { return (a / b); }
    }

  9. Now click on the Web Service icon, it will show a drop-down. Then select “New Web Service”.
  10. “New Web Service” window pops up as below. Select the “Project” as your current project. Select Framework as “JAX-WS” and Strategy as “Create web service from Java class (Bottom-up scenario). Click on NEXT button.
  11. “New Soap Web Service – Bottom-up Scenario” window pops up.
  12. Locate the java class from the project by using BROWSE button. Click on “Generate WDSL in project” check-box and click on FINISH button.

  13. You will see the following directory structure. Also the wsdl and xsd files are created.
  14. Now we create the client component to consume the webservice.
  15. Select the “New Web Service Client”

  16. “New Web Service Client” window pops up.
  17. Check that the project name is the same as before and select “JAX-WS” as framework. Press NEXT.

  18. You will see the following window.
  19. Click on the BROWSE button to locate the WSDL file (follow step 9).

    We will create a new package named “com.calculator.client” which will contain the client classes.
    Press NEXT after completing the steps.

  20. You should see the following window, without any error displayed.
  21. Press NEXT button.

  22. Press FINISH after you see the below window.
  23. You will see the following files been created inside the client package, see below.
  24. Now write the code to consume the web service.
  25. We will be using a JSP file as client. You can also use a java file to access the web service.

    <%@page import=“com.calculator.client.CalculatorService” %>
    <%@page import=“com.calculator.client.CalculatorDelegate” %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>

    <html>
    <head>
    <title>Calculator Test</title>
    </head>

    <body>
    <h1>Calculator Page</h1>
    <form action=“” method=“post”>
    <table border=“0″>
    <tr><td>First Value</td><td><input type=“text” name=“firstvalue” /></td></tr>

    <tr><td>Second Value</td><td><input type=“text” name=“secondvalue”/></td></tr>

    <tr><td><input type=“submit”></td></tr>
    </table>
    </form>

    <%
    if(request.getParameter(“firstvalue”)!=null && request.getParameter(“secondvalue”)!=null){
    int first=Integer.parseInt(request.getParameter(“firstvalue”));
    int second=Integer.parseInt(request.getParameter(“secondvalue”));
    CalculatorService service = new CalculatorService();
    CalculatorDelegate delegate = service.getCalculatorPort();
    try{

    /* Using the web service, perform the 4 calculations */
    out.println(“1. “+first+”+”+second+”=” + delegate.add(first, second)+”<br>”);
    out.println(“2. “+first+”-”+second+”=” + delegate.subtract(first, second)+”<br>”);
    out.println(“3. “+first+”*”+second+”=” + delegate.multiply(first, second)+”<br>”);
    out.println(“4. “+first+”/”+second+”=” + delegate.divide(first, second)+”<br>”);
    }catch(Exception e){
    out.print(“ERROR: Cannot divide by ZERO!”);
    }
    }else{
    out.print(“Please supply values”);
    }
    %>

    </body>
    </html>

  26. Run the project using a web server, in this case we will use Apache Tomcat.
  27. Now we can have a cup of hot coffee, because we deserve it, now that our Web Service is up and running successfully.

    Remember:-

    Web Service is the foundation of Service Oriented Architecture.

Posted in Uncategorized | Tagged: , , , | 3 Comments »

Drupal

Posted by sushantnayak on November 4, 2009

Drupal is a free and open source Content Management System (CMS) written in PHP and distributed under the GNU General Public License. It is used as a back-end system for many different types of websites, ranging from small personal blogs to Enterprise 2.0 collaboration and knowledge management uses to large corporate and political sites. In October 2009, the administration of U.S. president Barack Obama adopted Drupal for the official Whitehouse.gov website.

The standard release of Drupal, known as Drupal core, contains basic features common to most CMSs. These include the ability to register and maintain individual user accounts within a flexible and rich permission / privilege system, create and manage menus, RSS-feeds, customize page layout, perform logging, and administer the system. As installed, Drupal provides options to create a classic brochureware website, a single- or multi-user blog, an Internet forum, or a community website providing for User-generated content.

Drupal was also designed to allow new features and custom behavior to be added to extend Drupal’s core capabilities. This is done via installation of plug-in modules (known as contrib modules) created and contributed to the project by open source community members. For this reason, Drupal is sometimes described as a content management framework.

Although Drupal offers a sophisticated programming interface for developers, no programming skills are required for basic website installation and administration.

Drupal can run on any computing platform that supports both a web server capable of running PHP version 4.3.5+ (including Apache, IIS, Lighttpd, and nginx) and a database (such as MySQL or PostgreSQL) to store content and settings.
//

History

Originally written by Dries Buytaert as a message board, Drupal became an open source project in 2001. Drupal is an English rendering of the Dutch word “druppel”, which means “drop” (as in “a water droplet”). The name was taken from the now-defunct Drop.org website, whose code slowly evolved into Drupal. Buytaert wanted to call the site “dorp” (Dutch for “village”) for its community aspects, but made a typo when checking the domain name and thought it sounded better.

From May 2007 to April 2008, Drupal was downloaded from the Drupal.org website more than 1.4 million times, an increase of approximately 125% from the previous year. A large community now helps develop Drupal.

Drupal’s popularity is growing rapidly. Over 70 well-known brand names and not-for-profit organizations now use Drupal.

As of September 2009, Drupal 6.14 is the latest release. Drupal is a winner of several Packt Open Source CMS Awards and three times (in a row) a winner in the Webware 100.

On March 5th 2009, Dries Buytaert announced a code freeze for Drupal 7 for September 1st 2009. There is no date announced yet for the release of Drupal 7 after this code freeze; the latest test release, DRUPAL-7-0-UNSTABLE-9, was on September 15th 2009.

Drupal core

Drupal core is the stock installation of Drupal, which can be optionally extended by third party contributions. In Drupal’s default configuration, website content can be contributed by either registered or anonymous users (at the discretion of the administrator) and made accessible to web visitors by a variety of selectable criteria including by date, category, searches, etc. Drupal core also includes a hierarchical taxonomy system, which allows content to be categorized or tagged with key words for easier access.

Drupal maintains a detailed changelog of core feature updates by version.

Core modules

Drupal core includes core modules which can be enabled by the administrator to extend the functionality of the core website.

The core Drupal distribution provides a number of features, including:

  • Access statistics and logging
  • Advanced search functionalities
  • Blogs, books, comments, forums, and polls
  • Caching and feature throttling for improved performance under load
  • Descriptive URLs (for example, “www.example.com/products” rather than “www.example.com/?q=node/432″)
  • Multi-level menu system
  • Multi-site support
  • Multi-user content creation and editing
  • OpenID support
  • RSS Feed and Feed Aggregator
  • Security/new release update notification
  • User profiles
  • Various access control restrictions (user roles, IP addresses, email)
  • Workflow tools (Triggers and Actions)

Core themes

 

The color editor being used to adjust the “Garland” core theme

Drupal core includes several core themes, which customize the aesthetic look-and-feel of the site. These themes can be chosen by the administrator via a special menu.

The Color Module, introduced in Drupal core 5.0, allows administrators to change the color scheme of certain themes via a Web-browser interface. This feature was added to allow a higher level of customization for the average non-coder.

Translations

As of February 2008, translations for Drupal’s interface were available in 44 languages plus English (the default).Some read right to left, such as Arabic, Farsi, and Hebrew. Drupal 6 provides improved support for content and content administration in multiple languages.

Auto-update notification

Drupal can automatically notify the administrator when a new version of any module, theme, or the Drupal core itself, becomes available. This feature can help keep a Drupal installation up-to-date with the latest features and security fixes.

An auto-update module for the older version 5.x provides identical functionality, but it is not included in the core release.

Posted in Uncategorized | Tagged: | Leave a Comment »

Joomla

Posted by sushantnayak on November 4, 2009

What is Joomla?

Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.

What’s a content management system (CMS)?

A content management system is software that keeps track of every piece of content on your Web site, much like your local public library keeps track of books and stores them. Content can be simple text, photos, music, video, documents, or just about anything you can think of. A major advantage of using a CMS is that it requires almost no technical skill or knowledge to manage. Since the CMS manages all your content, you don’t have to.

What are some real world examples of what Joomla! can do?

Joomla is used all over the world to power Web sites of all shapes and sizes. For example:

  • Corporate Web sites or portals
  • Corporate intranets and extranets
  • Online magazines, newspapers, and publications
  • E-commerce and online reservations
  • Government applications
  • Small business Web sites
  • Non-profit and organizational Web sites
  • Community-based portals
  • School and church Web sites
  • Personal or family homepages

Who uses Joomla?

MTV Quizilla

Here are just a few examples of Web sites that use Joomla:

More examples of companies using Joomla can be found in the Joomla Community Site Showcase.

Posted in Uncategorized | Tagged: , , , , | Leave a Comment »

Concept behind Facebook

Posted by sushantnayak on November 4, 2009

Facebook (Facebook) is the second largest social network on the web, behind only MySpace (MySpace) in terms of traffic. Primarily focused on high school to college students, Facebook has been gaining market share, and more significantly a supportive user base. Since their launch in February 2004, they’ve been able to obtain over 8 million users in the U.S. alone and expand worldwide to 7 other English-speaking countries, with more to follow. A growing phenomenon, let’s discover Facebook.

The Facebook Phenomenon

First, let’s start by looking into Facebook in a broad spectrum – as the network, the phenomenon, the company, and its brand.

History

Originally called thefacebook, Facebook was founded by former-Harvard student Mark Zuckerberg (while at Harvard) who ran it as one of his hobby projects with some financial help from Eduardo Saverin. Within months, Facebook and its core idea spread across the dorm rooms of Harvard where it was very well received. Soon enough, it was extended to Stanford and Yale where, like Harvard, it was widely endorsed.

Before he knew it, Mark Zuckerberg was joined by two other fellow Harvard-students – Dustin Moskovitz and Chris Hughes – to help him grow the site to the next level. Only months later when it was officially a national student network phenomenon, Zuckerberg and Moskovitz dropped out of Harvard to pursue their dreams and run Facebook full time. In August 2005, thefacebook was officially called Facebook and the domain facebook.com was purchased for a reported $200,000.

Availability

Unlike its competitors MySpace, Friendster (Friendster), Xanga (Xanga), hi5 (Hi5), Bebo (Bebo), and others, Facebook isn’t available to everyone — which explains its relatively low user count. Currently, users must be members of one of the 30,000+ recognized schools, colleges, universities, organizations, and companies within the U.S, Canada, and other English-speaking nations. This generally involves having a valid e-mail ID with the associated institution.

Surveys & Studies

A large number of surveys and studies have been conducted around Facebook – some with interesting results. For instance, according to an internal September 2005 survey, approximately 85% of the students in the supported colleges had a Facebook account, with 60% of them logging in daily. A survey conducted by Student Monitor revealed Facebook was the most “in” thing after the iPod and tying with beer, and comScore Media Metrix discovered users spend approximately 20 minutes everyday on Facebook. Another 2005 survey said 90% of all undergraduates in the U.S. use either Facebook or MySpace regularly, and a detailed questionnaire analysis by Chris Roberts revealed that 76.2% never click on its ads. Perhaps the most amazing statistic of all may be that Facebook is the 7th most trafficked site in the U.S.

    Hey Facebook Users!Mashable’s shiny new Facebook account is HERE – feel free to add Mashable to your friends if you sign up, or you’re already a member.

Business & Funding

Given the situation other social networks on the web are facing, Facebook is in a good position financially. While it hasn’t managed to get acquired like its rival MySpace (despite some rumors about an $800m deal with Viacom), it’s been quite lucky in most aspects. For its initial funding, it received $500,000 from Peter Theil, co-founder of PayPal. A few months later, it was also able to get $13 million from Accel Partners, who are also investors in 15 other Web 2.0 startups, and $25 million from Greylock Partners, making their overall venture equal to approximately $40 million.

For users, Facebook’s core service is completely free and ad-supported. In fact, in August 2006 Facebook signed a three year deal with Microsoft to provide and sell ads on their site in return for a revenue split. The deal followed an announcement from Facebook’s direct competitor MySpace who signed a similar deal with Google (Google). The youthful demographic that both the services attract is highly prized amongst advertisers and should return a good amount of revenue for both the services to stay alive – and profit. Another deal which made news in July was Facebook’s agreement with Apple to give away 10 million free iTunes samplers to Facebook users. A deal has also been signed to provide Facebook credit cards.

Lawsuits & Concerns

In its early days, Facebook faced an extremely threatening lawsuit from ConnectU, a very similar social network which – like Facebook – shares its roots back to Harvard, and as a result almost got shutdown. The founders of ConnectU alleged that Facebook’s founder Mark Zuckerberg stole source code while he was in their employment. Zuckerberg denied the allegation and the lawsuit was dismissed.

Facebook has also been host to other issues and concerns, especially in the privacy sector where its privacy policy states “Facebook also collects information about you from other sources, such as newspapers and instant messaging services. This information is gathered regardless of your use of the Web Site.” Another theory is that Facebook could also be a data-gathering project or if not, used extensively for these purposes. Facebook’s policy also states that it “may share your information with third parties, including responsible companies with which we have a relationship.”

The Service

Now, let’s look into Facebook – the service itself, and some of its features, highlights, and the things that got Facebook where it is today.

Facebook Profiles

As Facebook has evolved, so have its profile pages – new fields have been added and users can share more information than before.

A typical Facebook profile consists of a number of different sections, including Information, Status, Friends, Friends in Other Networks, Photos, Notes, Groups, and The Wall. Most of the sections are self-explanatory but some are specific to Facebook.

Facebook Photos

With over 1.5 million photos uploaded daily, one of Facebook’s most popular features has been the ability to upload photos. Users can upload unlimited photos from their cell phone or through its Java-based web interface. Facebook is one of the few services to offer an unlimited quota with their only restriction being a 60-photos-per-album limit – this is much appreciated by Facebook’s college demographic.

The process of uploading photos is very simple. Users create albums which they can assign limitations to (e.g. visible to my friends only) and upload photos within them. The album is then put into their profile, and other users with right credentials have the ability to see and comment on them. Facebook also gives the feature to share the photos with a simple web link or send them via AIM (aim) or by e-mail. What’s more, users can also order prints online through a simple integrated interface.

Facebook Groups

Just like every other social network, Facebook has something called ‘groups.’ Users can create new ones or join and participate in existing ones. This is also displayed in their profile and is a good indication of hobbies and interests a person might have.

There are two kind of groups, a normal group and a secret group, which isn’t shown on the profile. A normal group is just like any other, but users can also create and invite others into secret groups. These can be used for collaborating on university projects, and provide a way to have closed discussions. About 80% of the groups are ‘fun-related’ and companies can even sponsor groups – as is the case with, for example, the Apple users group.

Facebook Events

Another Facebook success is their ‘events’ feature, which provides the ability to organize, be part of, and plan for events. This feature has been extremely successful when it comes to organizing parties.

Along with organizing and joining events, users can also invite and recommend others to an event. This feature, however, has raised some controversy as it is generally the start of underage drinking and dry campus violations. Colleges and universities use the feature to catch planning of such events before hand and investigate those that are over. In any case, it’s one of the most popular features of the service and even beats some of the competing products made specifically for this purpose.

Facebook Developers

As of August 2006, Facebook has offered a free Developers API called Facebook Developers. This essentially gives anyone access to Facebook’s internals and lets programmers create widgets, mashups, tools and projects based around Facebook.

This is an important feature for Facebook since it makes it the first major social network to give access to its API. Although it is limited to 100,000 requests a day, it’s more than enough for a decent web app to come through. What’s more, a selection of applications have already been created. FaceBank is a promising tool which lets you ‘keep track of depts and shared expenses with friends.’ Another interesting application is lickuacious which lets you ‘rank your friends by wall popularity.’ The Wall, of course, is Facebook’s comments feature.

Facebook Notes

Facebook’s most recent addition launched in late August. The service is called Facebook Notes, and allows users to write a Facebook blog. All notes are displayed in the user’s profile, and other members can add comments.

Notes possesses an important feature, which is the ability to import and syndicate an external blog, although unlike Technorati, doesn’t allow you to claim one only to yourself (e.g. it’s possible to claim the New York Times syndication feed easily in one’s Notes). The service allows HTML to be included in the posts, although JavaScript and Flash are disabled. You can attach photos and also post via cell phone by sending your notes to notes@facebook.com. Another interesting feature is tagging – tagging a post with a username will automatically send it to that specific user. The Notes feature has been well received.

The Future

Facebook is a massively successful social networking service that grew to prominence in virtually no time. It’s not hard to see why: its features and tools are highly appealing, and Facebook users are extremely well networked in real life. Rumors of an acquisition continue to circulate, with some estimates putting the price in the billions of dollars. In the short term, however, Facebook plans to go it alone, continuing to build out one of the world’s most successful social networks.

    Hey Facebook Users!Mashable’s shiny new Facebook account is HERE – feel free to add Mashable to your friends if you sign up, or you’re already a member.
    Facebook Profile

Mark Zuckerberg’s Facebook Profile

    Facebook Photos

Uploading to Facebook Photos

    Facebook Groups

Facebook Groups

    Facebook Events

Facebook Events

    Facebook Notes

Facebook Notes

    Facebook Developers

Facebook Developers

Reference: mashable.com

Posted in Uncategorized | Tagged: , , , , | Leave a Comment »

SaaS – Software as a Service

Posted by sushantnayak on October 1, 2008

Posted in Uncategorized | Tagged: , | Leave a Comment »

Java Pattern Matcher

Posted by sushantnayak on July 25, 2008

Here is a piece of code which can be useful for searching for particular pattern in a string of text. SOA archiect / Java Developer using mail service(JMS).

package com.PatternMatcher;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PatternMatcher_Test {

public static void main(String[] arg){

String strSubject=”Your Airtel Bill for Account 102-102672541, Duration 11/05/2008 to 10/06/2008″;

String[] strPatterns={ “102-102672541″ };

if(bTextContainsPatterns(strSubject,strPatterns)){
System.out.println(“SUCCESS:Pattern matched”);
}else{
System.err.println(“ERROR:Pattern matched”);
}
}

private static boolean bTextContainsPatterns(String strText, String[] strPatterns) {
String strList = “”;

for (int i = 0; i < strPatterns.length; i++) {
strList += (i > 0 ? “,” : “”) + strPatterns[i].toString();
}

for (int i = 0; i < strPatterns.length; i++) {
if (strText.indexOf(strPatterns[i]) >= 0) {
System.out.println(“bTextContainsPatterns… found in element : ” + i + ” at position “+ strText.indexOf(strPatterns[i]));
System.out.println(“strText: “+strText+” | found at index:: +strText.indexOf(strPatterns[i]));
return true;
}else{
System.err.println(“bTextContainsPatterns…not found in element : ” + i + ” at position “+ strText.indexOf(strPatterns[i]));
}
}
return false;
}

}

Posted in Uncategorized | Tagged: , , | Leave a Comment »

Capability Maturity Model® Integration (CMMI)

Posted by sushantnayak on July 18, 2008

Some years ago the Software Engineering Institute at Carnegie Mellon Institute in Pittsburgh established standards and guidance for developing software engineering disciplines and management. This was known as the Capability Maturity Model (CMM), and its use has become widespread among mature software development organizations, especially for those developing large scale software in a competitive procurement environment. Government and corporate software customers have increasingly required that proposals include information about a software development organization’s certified level of maturity. The CMM had recognized five steps towards organizational software maturity:

* Level 1 (Initial) – Processes are ad hoc and occasionally chaotic. Few processes are defined, and success depends on individual effort and heroics. (A street-person with a laptop would be at Level 1.)
* Level 2 (Repeatable) – Basic project management processes are established to track cost, schedule and functionality. A process discipline is in place to repeat earlier successes on projects with similar applications.
* Level 3 (Defined) – Management and engineering processes are documented and integrated into a standard software process. Projects use an approved, tailored version of the organization’s standard software process.
* Level 4 (Managed) – Detailed measures of the software process and product quality are collected. Processes and products are quantitatively understood and controlled.
* Level 5 (Optimizing) – Continuous process improvement is aided by quantitative feedback from the process and from piloting innovative ideas and technologies.

Around year 2000, the SEI introduced the next major evolution along this path – called Capability Maturity Model® Integration (CMMI). This builds on the previous CMM, which is now regarded as “legacy” and no longer supported.

Posted in Software Project Management | Leave a Comment »

Struts 2.x Vs Struts 1.x

Posted by sushantnayak on July 18, 2008

In the following section, we are going to compare the various features between the two frameworks. Struts 2.x is very simple as compared to struts 1.x, few of its excelent features are:

1. Servlet Dependency:

Actions in Struts1 have dependencies on the servlet API since the HttpServletRequest and HttpServletResponse objects are passed to the execute method when an Action is invoked but in case of Struts 2, Actions are not container dependent because they are made simple POJOs. In struts 2, the servlet contexts are represented as simple Maps which allows actions to be tested in isolation. Struts 2 Actions can access the original request and response, if required. However, other architectural elements reduce or eliminate the need to access the HttpServetRequest or HttpServletResponse directly.

2. Action classes

Programming the abstract classes instead of interfaces is one of design issues of struts1 framework that has been resolved in the struts 2 framework.
Struts1 Action classes needs to extend framework dependent abstract base class. But in case of Struts 2 Action class may or may not implement interfaces to enable optional and custom services. In case of Struts 2 , Actions are not container dependent because they are made simple POJOs. Struts 2 provides a base ActionSupport class to implement commonly used interfaces. Albeit, the Action interface is not required. Any POJO object with an execute signature can be used as an Struts 2 Action object.

3. Validation

Struts1 and Struts 2 both supports the manual validation via a validate method.
Struts1 uses validate method on the ActionForm, or validates through an extension to the Commons Validator. However, Struts 2 supports manual validation via the validate method and the XWork Validation framework. The Xwork Validation Framework supports chaining validation into sub-properties using the validations defined for the properties class type and the validation context.

4. Threading Model

In Struts1, Action resources must be thread-safe or synchronized. So Actions are singletons and thread-safe, there should only be one instance of a class to handle all requests for that Action. The singleton strategy places restrictions on what can be done with Struts1 Actions and requires extra care to develop. However in case of Struts 2, Action objects are instantiated for each request, so there are no thread-safety issues. (In practice, servlet containers generate many throw-away objects per request, and one more object does not impose a performance penalty or impact garbage collection.)

5. Testability

Testing Struts1 applications are a bit complex. A major hurdle to test Struts1 Actions is that the execute method because it exposes the Servlet API. A third-party extension, Struts TestCase, offers a set of mock object for Struts1. But the Struts 2 Actions can be tested by instantiating the Action, setting properties and invoking methods. Dependency Injection support also makes testing simpler. Actions in struts2 are simple POJOs and are framework independent, hence testability is quite easy in struts2.

6. Harvesting Input

Struts1 uses an ActionForm object to capture input. And all ActionForms needs to extend a framework dependent base class. JavaBeans cannot be used as ActionForms, so the developers have to create redundant classes to capture input.
However Struts 2 uses Action properties (as input properties independent of underlying framework) that eliminates the need for a second input object, hence reduces redundancy. Additionally in struts2, Action properties can be accessed from the web page via the taglibs. Struts 2 also supports the ActionForm pattern, as well as POJO form objects and POJO Actions. Even rich object types, including business or domain objects, can be used as input/output objects.

7. Expression Language

Struts1 integrates with JSTL, so it uses the JSTL-EL. The struts1 EL has basic object graph traversal, but relatively weak collection and indexed property support. Struts 2 can also use JSTL, however it supports a more powerful and flexible expression language called “Object Graph Notation Language” (OGNL).

8. Binding values into views

In the view section, Struts1 uses the standard JSP mechanism to bind objects (processed from the model section) into the page context to access. However Struts 2 uses a “ValueStack” technology so that the taglibs can access values without coupling your view to the object type it is rendering. The ValueStack strategy allows the reuse of views across a range of types which may have the same property name but different property types.

9. Type Conversion

Usually, Struts1 ActionForm properties are all Strings. Struts1 uses Commons-Beanutils for type conversion. These type converters are per-class and not configurable per instance. However Struts 2 uses OGNL for type conversion. The framework includes converters for basic and common object types and primitives.

10. Control Of Action Execution

Struts1 supports separate Request Processor (lifecycles) for each module, but all the Actions in a module must share the same lifecycle. However Struts 2 supports creating different lifecycles on a per Action basis via Interceptor Stacks. Custom stacks can be created and used with different Actions as needed.

Posted in Uncategorized | Tagged: , , | 3 Comments »

 
Follow

Get every new post delivered to your Inbox.