Friday, 26 September 2008
Wednesday, 24 September 2008
Compile and test with different JDK versions Maven
 
Nice posting showing usage of defining JDK as a parameter in user profiles
http://unserializableone.blogspot.com/2008/09/compile-and-test-with-different-jdk.html
			

Friday, 5 September 2008
Google Chrome crash if link has :%
Many people are aware by now that placing about:% or just :% in to Chromes address bar will crash your Chrome Browser.
 
RELAX –WS
RELAX –WS
 
Relax-WS facilitates creation of WSDL file using Relax NG syntax, which is quite less verbose and straightforward.
http://relaxng.org/compact-tutorial-20030326.html
			
Example
service Hello {
    port {
        operation SayHello {
            in {
                element name {xsd:string}
            }
            out {
                element message {xsd:string}            
            }
    }
    }
}
 
Pitfalls
- Cardinality
 
XMLSchema
					
<xsd:element name="bar">
  <xsd:element name="foo" minOccurs="5" maxOccurs="30"/>
</xsd:element>
 
Relax NG Compact syntax
start = element bar { fivefoo, upto25foo }
fivefoo = element foo { empty }, element foo { empty },
          element foo { empty }, element foo { empty },
          element foo { empty }
maybefoo = element foo { empty }?
upto25foo =
  fivefoo?, fivefoo?, fivefoo?, fivefoo?,
  maybefoo, maybefoo, maybefoo, maybefoo, maybefoo
 
 
It would be extremely verbose if suppose we had to define cardinality lets say between 250 and 500. Also it would prone to human errors.
 
- Relax NG to Schema
 
Since xml schema seems to be more constrained version of RELAXNG grammar, everything defined in RELAX NG would not be possible to translate into Schema in a predictable way
 
 
start = DoSomething
DoSomething = element DoSomething { resAny* & DidSomething? }
DidSomething = element DidSomething { xsd:integer }
resAny = (anyAttribute | text | resAnyElem)
resAnyElem = element * - DidSomething { any* }
 
- Another approach is to do it spring way
 
http://static.springframework.org/spring-ws/sites/1.5/reference/html/tutorial.html
			
Thursday, 4 September 2008
OASIS Reference Architecture for SOA v 1.0 (public review draft 1)
 
Interesting reading material of SOA Architecture
http://docs.oasis-open.org/soa-rm/soa-ra/v1.0/soa-ra-pr-01.pdf
			
 
 

Tuesday, 2 September 2008
Google Browser Chrome
New google browser to be launched
http://news.cnet.com/8301-17939_109-10030025-2.html
			
 
Wednesday, 27 August 2008
Software engineering principals
 
Slides from the book Object-Oriented Software Engineering: Practical Software Development using UML and Java
				
 
http://www.site.uottawa.ca/school/research/lloseng/supportMaterial/slides/
			
 
The book was written by professor By Timothy C. Lethbridge and Robert Laganière, the book is bit old but the principals hold true.
 
 

Read write file stored in class folder of webapp
Read data from classes folder in WEB-INF.
Insure that text/xml file is packaged into the classes folder
Create a utility class to do file reading. This was tested in weblogic and tomcat
See code below:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class FileReader {
public String readTextFile(final String name) throws Exception {
StringBuffer xmlFromFile = new StringBuffer();
InputStream instr = null;
instr = getFilePath2(name);
if (instr == null)
throw new FileNotFoundException();
InputStreamReader streamreader= null;
try {
streamreader= new InputStreamReader(instr);
int x = 0;
x = streamreader.read();
char c;
while (x != -1) {
c= (char) x;
xmlFromFile.append(c);
x = streamreader.read();
}
} catch (Exception e) {
System.out.println("Exception " + e.getMessage());
throw e;
} finally {
streamreader.close();
}
return xmlFromFile.toString();
}
public byte[] readBinFileFromClassPath(final String name) throws Exception {
byte bytearray[]= null;
FileInputStream fileinputstream=null;
try {
fileinputstream = new FileInputStream(getFilePath(name));
int numberBytes = fileinputstream.available();
bytearray = new byte[numberBytes];
fileinputstream.read(bytearray);
} catch (Exception e) {
System.out.println("Exception " + e.getMessage());
throw e;
} finally {
if(fileinputstream!=null)
fileinputstream.close();
}
return bytearray;
}
public byte[] readBinFilePath(final String name) throws Exception {
byte bytearray[]= null;
FileInputStream fileinputstream=null;
try {
fileinputstream = new FileInputStream(name);
int numberBytes = fileinputstream.available();
bytearray = new byte[numberBytes];
fileinputstream.read(bytearray);
} catch (Exception e) {
System.out.println("Exception " + e.getMessage());
throw e;
} finally {
if(fileinputstream!=null)
fileinputstream.close();
}
return bytearray;
}
public void writeBinFileToPath(String name, byte data[]) throws IOException{
FileOutputStream fileoutputstream =new FileOutputStream(name);
try {
fileoutputstream.write(data );
} catch (IOException e) {
System.out.println(e.getMessage());
}finally{
if(fileoutputstream!=null)
fileoutputstream.close();
data=null;
}
}
private InputStream getFilePath2(String filename) {
return this.getClass().getClassLoader().getResourceAsStream(filename);
}
private String getFilePath(String filename) throws FileNotFoundException {
String path=this.getClass().getClassLoader().getResource(filename).getPath();
if ("".equals(path))
throw new FileNotFoundException();
return path;
}
}

Tuesday, 26 August 2008
Web Service calls in BEA Aqualogic BPM 6
 
I spend quite a bit of time searching how to make web service calls in Aqualogic BPM. There is virtually no document, except for Expense report tutorial which still does not answer the question.
 
 
The solution
 
Below is an example code you could place in interactive process to 
 
 
service2 as  Webservice.HelloWsdl.HelloService = Webservice.HelloWsdl.HelloService ();
				
sayHello
					service2
					
				
using   string1.string1
				
returning result4 = @out
				
string1.string2=result4
 
Another interesting point to note is that Aqualogic supports XPDL
			
 
One XPDL tutorial that I found to be useful
http://www.together.at/together/zzznocms/twe/twedoc/twe.html#d0e1719
			
 

UI prototyping
Just came across this plugin for UI prototyping. No separate application is require and it has quite a bit of features
 

Faster Java development
 
JavaRebel is a JVM plugin (-javaagent) that enables to reload changes made to Java class files on-the-fly, saving developers the time that it takes to redeploy an application or perform a container restart. It is a generic solution that works for Java EE and Java standalone applications
http://www.zeroturnaround.com/javarebel/
			
 
http://www.zeroturnaround.com/docs/javarebel-jpetstore-screencast Shows how it works
Thursday, 21 August 2008
UI mock up in browser
 
Create UI mock ups in web browser
http://blogs.atlassian.com/developer/2008/07/balsamiq_mockups_brings_paper.html
			
Project templates, archetypes
Often it is found at project inception stage people ponder over project structure and then manually create them.
Instead one could  use standard templates or archtypes in Maven world.
Below are some ready to use templates for projects
http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
			
 
ach archetype page should enforce the following pattern :
* Archetype name
* Command line to call the archetype
* If the archetype can be used in an existing projects directory
* A tree view of the resulting files
* Some additional information like the additional properties used by the plugin
To use an archetype:
mvn archetype:generate
Generate gives you a wizard that will walk you through the various choices.
or
mvn
org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create
-DgroupId= -DartifactId= -DarchetypeArtifactId= -DarchetypeGroupId=
Find Jar files
I have found this website and it's quite useful when it comes to finding a jar file or when you are trying to find which jar a class belongs to.

Wednesday, 20 August 2008
Generate Logging code using eclipse plug-in LOG 4 E
 
A neat plug-in for logging in java code, this could be useful in case one has code base without proper logging, other usage scenarios include, if one has to change logging API, or just a handy code generation utility.
 
http://log4e.jayefem.de/content/view/10/6/
			
 
Taran
Tuesday, 19 August 2008
BEA XA Driver
Configuring Enterprise version of Aqualogic BPM on weblogic
 
 
 
Configuration wizard throws error, view the logs and you will find it is due to XS transactions
 
http://technet.microsoft.com/en-us/library/aa342335.aspx
			
Enable TCIP protocol from SQL server configuration manager
 
Copy the DLL for the environment (Linux, windows 32, 64)
Run the script included with the driver
Then run the script in link below this will install jxta sp required:
 
http://e-docs.bea.com/wls/docs81/jdbc_drivers/mssqlserver.html#1075232
			
Test from office 2007
I think this will help me finally start blogging J

