Java on net
Collection of references and notes on Java and J2EE
Wednesday, November 30, 2011
Service Wrapper for Java
Monday, June 28, 2010
Service component architecture (SCA)
The SCA specification is divided into a number of documents, each dealing with a different aspect of SCA [4]. Like, the Assembly Model describes wiring components. The Assembly Model is independent of implementation. The Client and Implementation specification deals with the implementation of services and of service clients -- SCA has published specifications for BPEL, C++, Spring and Java component implementation specifications.
List of current SCA specification can be found at OSOA's website at - http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications. Most of the specifications published in 2007. I am still trying to figure out what is the current status of SCA.
References:
[1] Service Component Architecture (SCA) (http://www.oasis-opencsa.org/sca)
[2] What is Service Component Architecture? Is it an alternative to SOA or is it an addition? (http://blog.softwareag.com/index.php/2008/06/10/what-is-service-component-architecture-is-it-an-alternative-to-soa-or-is-it-an-addition/)
[3] Service component architecture - Wikipedia Page (http://en.wikipedia.org/wiki/Service_component_architecture)
[4] Service Component Architecture (http://www.ibm.com/developerworks/library/specification/ws-sca/)
[5] Service Component Architecture Specifications (http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications)
Friday, June 25, 2010
5 thing about Jars - From IBM Developerworks
1. JARs are executable: Manifest file can be modified to specify which class to launch when executing JAR. User then just have to execute JAR, at command line or simply by double clicking it.
2. JARs can include dependency information: Manifest allows declaration of JAR dependencies using "Class-path" attribute. This implicitly creates the CLASSPATH without having to declare it.
3. JARs can be implicitly referenced: Use "extension directory", the lib/ext directory, underneath JRE location.
4. Java 6 allows classpath wildcards
5. JARs hold more than code: For example, configuration files like Hibernate mappings.
Powered by ScribeFire.
Inspiring talk from Kathy Sierra
Thanks to blog - Frank Carver's Punch Barrel
Follow her secret answer. Pretty interesting views and so inspiring.
Powered by ScribeFire.
Sunday, August 30, 2009
Auto Tweet on Twitter Using Java @PCQuest
Author: Rahul Sah
Link: http://pcquest.ciol.com/content/Developer/2009/109070401.asp
Summary:
Twitter4J is a Java library for Twitter API. It is completely implemented in Java and spares you the hassles of creating your own wrapper for Twitter APIs for your Java application to access Twitter. This article shows how you can it be used to access Twitter through a Servlet Web application.

Powered by ScribeFire.
Saturday, August 29, 2009
How to Use Spring Web Service @JavaLobby

Powered by ScribeFire.
Monday, August 10, 2009
Spring source bought by VMware
See link: VMware to Buy SpringSource for $420M at Gigaom.com
Powered by ScribeFire.
Monday, November 10, 2008
Article on REST WebServices
" published at bpminstitute.org. Article covers introduction of REST Web Services and explains development of an example using Restlet framework. Few points from that article -
REST (Represntational State Transfer)
* Simpler than SOAP, has less steps than SOAP development.
* Provides access to resources identified by URI using HTTP.
* Resources are abstraction of information
* Supports HTTP operations - GET, PUT, POST and DELETE (analogous to CRUD)
* Each interacion updates the state (except GET).
* Interactions are idempotent
* Security is provided by authentication, authorization and auditing
Design considerations
* What are the entities (resources)?
* What are the resource representations formats?
* How are entities related to each others (links)?
* What ids resources (ids should be descriptive and scalable)?
* How to use HTTP status code? (Should avoid for lose coupling between provider and consumer)
Important classes of Restlet framework
* Converter
* Router
* Resource
* Guard
Monday, November 03, 2008
Java WebServices Standards
1. Java API for XML Web Services (JAX-WS) [JSR 224]
2. Java Architecture for XML Binding (JAXB) [JSR 222]
3. WSEE [JSR 109]
4. WS-Metadata [JSR 181]
5. Java Business Integration (JBI) [JSR 208]
Reference:
* SOA Using Java(TM) Web Services by Mark D. Hansen (http://soabook.com/)
* The JAVA EE5 Tutorial (http://java.sun.com/javaee/5/docs/tutorial/doc/)
* Java Standards at SearchSOA.com (http://searchsoa.techtarget.com/topics/0,295493,sid26_tax305810,00.html)
Tuesday, April 08, 2008
Portlet Specification V2.0 at IBM developerworks
What's new in the Java Portlet Specification V2.0 (JSR 286)?
Thursday, February 14, 2008
Proxy setting in Eclipse
In Eclipse 3.3 - Windows -> Preferences -> General -> Network Connections
In Eclipse 3.2 - Windows -> Preferences -> Internet -> Proxy Settings
Tuesday, February 05, 2008
Reference for JSF, Spring and JPA
Sample Application using JSF, Spring 2.0, and Java Persistence APIs (http://weblogs.java.net/blog/caroljmcdonald/archive/2007/06/sample_applicat.html) for reference on JSF, Spring and JPA.
Powered by ScribeFire.
Monday, August 20, 2007
Eclipse Basic Shortcuts
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.jdt.doc.user/gettingStarted/qs-BasicTutorial.htm
Outlining few shortcuts for the some features explained there -
* Navigate Outline (Ctrl+O) 2 times for inherited items
* Content Assist (Ctrl+Space)
* Run As (Alt+Shift+X) Java Application +J
* Show line numbers -> Windows->Preferences->General->TextEditors
* Source > Organize Imports (Ctrl+Shift+O)
* Restore from local history
* Refactor (Alt+Shit+T)
* Creation and configuration of generated comments in the Java > Code Style > Code Templates preference page.
* Source (Alt+Shift+S) ->
+v: Override/Implement methods
+r: Generate Getters and Setters
* View declaration (Ctrl+G)
* View Type Hierarchy (Ctrl+T) or Navigate > Quick Type Hierarchy
Ctrl+T to toggle between supertype hierarchy and subtype hierarchy.
* Evaluating snippets: New > Other > Java > Java Run/Debug > Scrapbook Page
Wednesday, August 15, 2007
Integration Pattern
Enterprise Integration Patterns - Table of Contents (http://www.enterpriseintegrationpatterns.com/toc.html)
This is Table of Contents for the book - Enterprise Integration Patterns (http://www.enterpriseintegrationpatterns.com/index.html) which explains each of
patterns in detail. A sample chapter of the book can be downloaded from:
http://www.enterpriseintegrationpatterns.com/docs/EnterpriseIntegrationPatterns_HohpeWoolf_ch03.pdf
Powered by ScribeFire.
Friday, July 06, 2007
Decoupling user and creator in Factory Pattern
Following is diagram from "Manufacturing Java Objects with the Factory Method Design Pattern by Barry Burd and Michael P. Redlich" (http://javaboutique.internet.com/tutorials/factory/) explaining basic factory pattern.
Here, Creator is also user of the Product. This creation and use is tightly coupled.
A "SimpleProductFactory" element can be added to Creator class (composition), which would be responsible of creating Product. Thus, decoupling use and creation of the Product.
Links:-
* Manufacturing Java Objects with the Factory Method Design Pattern by Barry Burd and Michael P. Redlich (http://javaboutique.internet.com/tutorials/factory/)
Friday, June 15, 2007
JUNIT 4 Tutorial on IBM Developerworks
JUnit 4 is complete makeover of JUnit with excellent use of annotations. Working with test cases has been made easier by relaxing stringent requirements of earlier versions.
Tutorial covers fundamental concepts, new features along with examples.
Article do points that "Many argue that JUnit 4's use of annotations was influenced by TestNG as well as .NET's NUnit."
Other resources:
1. Junit offical website (http://www.junit.org/index.htm)
2. Junit 4.3 JavaDoc (http://www.junit.org/junit/javadoc/4.3/index.htm)
3. JUnit Reloaded by Ralf Stuckert on java.net (http://today.java.net/pub/a/today/2006/12/07/junit-reloaded.html)
Powered by ScribeFire.
Friday, March 23, 2007
Java: Static methods are not overriden
-------------------------------------------
/*
* SubClass.java
*
* Created on den 23 juni 2005, 21:13
*/
package sample;
/**
*
* @author Thomas
*/
public class SubClass extends SuperClass{
public static Long getStaticLongId(){
return 2L;
}
public Long getInstanceLongId(){
return 20L;
}
public static final void main(String args[]){
SubClass subClassInstance = new SubClass();
System.out.println("Static overloading:\t" +
SubClass.getStaticLongId() + "\t" +
SubClass.getStaticStringId());
System.out.println("Instance overloading:\t"+
subClassInstance.getInstanceLongId() + "\t" +
subClassInstance.getInstanceStringId());
}
* SuperClass.java
*
* Created on den 23 juni 2005, 21:09
*/
package sample;
/**
*
* @author Thomas
*/
public class SuperClass {
public static Long getStaticLongId(){
return 1L;
}
public static String getStaticStringId(){
return getStaticLongId().toString();
}
public Long getInstanceLongId(){
return 10L;
}
public String getInstanceStringId(){
return getInstanceLongId().toString();
}
------------------------------------------------------
Output will be -
Static overloading: 2 1
Instance overloading: 20 20
For detailed reason about it, look at the reference.
As a side-note, if you put this code in eclipse, you will see little triangle by the side of overridden instance method "getInstanceLongId()". This sign will be missing for static method "getStaticLongId()".
Reference:
* Overriding static methods - why doesn´t it work?
Thursday, March 15, 2007
TSS Article on SOA
It has also a mention about MULE (http://www.mulesource.com/), this open-source ESB solution has recently crossed 500K download mark (http://www.mulesource.com/company/press_releases/500K_011707.php).
Friday, August 11, 2006
Eclipse to test WSDL
Link: http://help.eclipse.org/help32/topic/org.eclipse.jst.ws.consumption.ui.doc.user/tasks/ttestwsdl.html
Annotations in Java 1.5
Example:
@deprecated public void foo(){}
Annotations consist of '@' sign followed by type of annotation and a parenthesized list of name-value pair of elements. Annotations can be used everywhere where other modifiers like public or static can be used. As a convention annotation is preceded by other modifiers.
Declaration of annotation type:
Example: public @interface breaksStandard {
public String reviewer();
public String reviewDate;
public String reason default "";}
Similar to interface declaration, modifier '@' sign prefixed to keyword interface. Return types can only be primitives, String, Class, enums and annotations (and arrays of these).
Usage: @breaksStandard(reviewer="XYZ", reviewDate="Aug 10, 2006") public void FOO(){}
Types:
1. In built annotations -
i. The Override annotation
ii. The Deprecated annotation
iii. The SuppressWarnings annotation
2. User Defined annotations
Categories:
1. Marker annotations
2. Single-value annotations
3. Full annotations
Meta-Annotation:
Annotations of annotations are meta-annotation. e.g. @Target, @Retention, @Documented.
Exercise: Work with @Deprecated or @Override annotation in Eclipse.
References:
[1] http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html Annotations
[2] http://www-128.ibm.com/developerworks/java/library/j-annotate1/ , Annotations in Tiger, Part 1: Add metadata to Java code, Author: Brett McLaughlin
[3] http://www-128.ibm.com/developerworks/java/library/j-annotate2.html, Annotations in Tiger, Part 2: Custom annotations, Author: Brett McLaughlin
[4] http://www.infoq.com/articles/Annotation-Hammer Annotation Hammer, Author: Venkat Subramaniam
[5] http://www.javaworld.com/javaworld/jw-03-2005/jw-0321-toolbox.html An annotation-based persistence framework, Author:Allen Holub
Friday, July 14, 2006
Controversy controversy controversy
* Richard Monson-Haefel: It's too late to save Java EE (http://www.infoq.com/news/Java-EE-Demise-Report)
* Is Java EE's Complexity Its Worst Enemy?(http://www.internetnews.com/dev-news/article.php/3618166)
* The Beginning of the End for Java Starts(Date.Time.NOW()); (http://www.oreillynet.com/windows/blog/2006/07/the_beginning_of_the_end_for_j.html)
* Analysts see Java EE dying in an SOA world (http://searchwebservices.techtarget.com/originalContent/0,289142,sid26_gci1198211,00.html)
* Analysts see Java EE dying in an SOA world (http://www.theserverside.com/news/thread.tss?thread_id=41283)
Controversies are good sometime. Personally I don't believe that JEE dying. My 2 cents, 'May the best one win'. People!! you have much choices now then say couple of years back. Evaluate and find which one fits best to you. May you choose JEE over others. Complexities will be there with all the Enterprise level projects. There are lot other factors to consider. Resources involved, total cost of ownership, return of investment, maintainability etc etc.
Wednesday, July 05, 2006
Links for eclipse 3.2 Callisto
1. Eclipse Callisto http://www.eclipse.org/callisto/
2.
What's New in Eclipse 3.2 Java Development Tools http://www.onjava.com/pub/a/onjava/2006/06/28/whats-new-in-eclipse-3-2-java-development-tools.html?page=3
3. Ten coolest Eclipse 3.2 features http://blogs.zdnet.com/Burnette/?p=136
4. Customize Your Callisto Experience http://www.eclipse.org/callisto/custom.php
5. Eclipse Updates 10 Open-Source Projects in 'Callisto' http://www.eweek.com/article2/0,1895,1981651,00.asp
6. Step-by-step Eclipse Callisto http://www.ebernie.net/blog/2006/06/21/step-by-step-eclipse-callisto/
-----------------------------------------------------
New:
7. Series of Callisto podcasts http://www.eclipsezone.com/spotlights.jsp
-----------------------------------------------------
Trivia:
* Release Date: June 30, 2006
* Callisto, named for a moon of Jupiter
* The 10 projects included in the Callisto release are:
1. Business Intelligence and Reporting Tools (BIRT) 2.1
2. C/C++ IDE (CDT) 3.1
3. Data Tools Platform (DTP) 1.0
4. Graphical Editor Framework (GEF) 3.2
5. Graphical Modeling Framework (GMF)1.0
6. Eclipse Project 3.2
7. Test and Performance Tools Platform (TPTP) 4.2
8. Web Tools Platform (WTP) 1.5
9. Visual Editor (VE) 1.2
10. Eclipse Modeling Framework (EMF) 2.2
Tuesday, June 06, 2006
Links for JUnit on Eclipse
1. Unit Testing in Eclipse Using JUnit (http://open.ncsu.edu/se/tutorials/junit/#section6_0)
Date: Aug 29, 2005
To the point tutorial.
2. Using JUnit in Eclipse (www.cs.umanitoba.ca/~eclipse/10-JUnit.pdf)
Date: Oct 30, 2003
With a quick example
3. Eclipse Junit testing tutorial (http://www.laliluna.de/eclipse-junit-testing-tutorial.html)
Date: April, 12 2005
Definations, examples and source code
Friday, June 02, 2006
Quick reference of Autoboxing in JDK 1.5
Integer intObj=100;
Vice-versa is called unboxing. JDK 1.5 supports autoboxing and auto-unboxing.
Following is legal with autoboxing
1. Integer intObj1=100; Integer intObj2=200;
2. Integer intObj3=intObj1+intObj2;
3. map.put("zero", 0); //map is defined as Map
4. int z=map.get("zero");
5. Boolean result= (intObj1==intObj2);
6. int intValue = intObj1; //throws nullPointerException
7. foo(intValue); //foo is defined as - public void foo(Integer intObj1){}
8. bar(intObj1); //bar is defined as - public void bar(int intValue){}
9. if(booleanObj){} //booleanObj is of type Boolean
10. int intValue = -intObj1;
Following is illegal
1. Integer intObj=shortVal; // shortVal is of type short
2. Double doubleObj = 10; //Can not convert from int to Double
Advantage of autoboxing and auto-unboxing is concise code. But careless use might result in poor performance of the code. Certain primitives are cached and autoboxing returns same wrapper objects. This value may depend on jvm used, normally this value are:
1. The boolean values true and false.
2. The byte values.
3. The short and int values between -128 and 127.
4. The char values in the range '\u0000' to '\u007F'.
It means, if intObj1=127 and intObj2=127 then intObj1==intObj2 returns true. But, if if intObj1=128 and intObj2=128 then intObj1==intObj2 returns false.
Best practices compiled by Brian Pontarelli at http://brian.pontarelli.com/2004/07/15/jdk-5-auto-boxing-best-practices [3]
If you can use primitives do it, if you can’t don’t.
1. Avoid using wrapper classes whenever possible.
2. Never do math with wrappers.
3. Try not to use any of the comparison operators (<, >, <=, >=, ==, etc) with wrappers.
4. Avoid usage in loop statements.
5. Always check for null values.
References:
[1] SCJP 5 : Chapter 3. API Contents (Part-1) http://www.exforsys.com/content/view/1885/362/
[2] Autoboxing surprises from J2SE 5 http://www.theserverside.com/news/thread.tss?thread_id=27129
[3] JDK 5 - auto-boxing best practices http://brian.pontarelli.com/2004/07/15/jdk-5-auto-boxing-best-practices/
[4] J2SE 5.0 in a Nutshell http://java.sun.com/developer/technicalArticles/releases/j2se15/
[5] Autoboxing http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
[6] Object type http://en.wikipedia.org/wiki/Autoboxing
Thursday, June 01, 2006
TheServerSide @ JavaOne 2006
Above link is TheServerSide report on JavaOne2006 By Nitin Bharti, Frank Cohen and Rich Seeley.