Posts

Blog Under Construction...

Blog Under Construction...

Java Reflections-Reloaded

Coming Soon.....

JAVA Reflection API - An Example to invoke fields

Image
Assume that we have 50 Java Bean classes with each class having atleast 5 fields with getter/setter methods. Now its time for you to debug the contents of each object. So how do we have to debug all these classes? - Implement a toString() method inside each class. - Create a StringBuilder/StringBuffer object inside the toString() method. - Append each and every field present inside the class to buider/buffer object in the toString() method, and    then return this object by converting it into a String. - This process translates the object into a well-defined understandable textual format. Well, this is really a good process, but, keeping in mind that we have tens of classes resulting in hundreds of variables, how long do you think it'd take to debug all our classes. I bet this process sucks big time So,What is the alternative???? Lets get into programming for a while. Class-1: RootObject.java package com.devonline.reflec.samples; import java.io.Serializable;...

Coming soon.......

Image
  This blog is Under Construction.

Server Migration from JBoss-4.0.5 to JBoss-4.2.3.GA

As the subject line says, this write-up covers a small note on JBoss Server migration. Hopefully it may not be a tough task migrating from JBoss-4.0.5 to JBoss-4.2.3 server, but I rather had a different experience while doing this. The reason behind this was the pre-compilation of the JSPs * in my project, which was performed using the jar files present in jbossweb-tomcat55.sar folder. * If I say compile/compiling in this write-up, please read it as ‘pre-compiling JSPs’ I was supposed to do the same compiling as it was done earlier when we used JBoss-4.0.5. The jar files used to compile are jasper-compiler.jar, jasper-runtime.jar, commons-el.jar and as I said earlier these files resided in the jbossweb-tomcat55.sar folder. Now where can I find jbossweb-tomcat55.sar folder in JBoss-4.2.3.? After some time, with the help of google, I was able to find out that this directory is been replaced by a new Tomcat servlet engine which is been named as jboss-web.deployer . This r...

JDBC Connectivity to Various Databases and SQL Query Syntax

Image
This writeup gives us an idea of the jar files and the drivers required to connect to various databases. We have chosen six databases for this purpose and they are MySQL,Oracle,MS SQL Server-2000,MS SQL Server-2005,Sybase and Apache Derby. We need to have suitable jar files to establish connections to corresponding databases. No need to set these jar files in Environment Variables or in any classpath. We will load the jar files dynamically.Here is the java code to establish connection to various DBs. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class JDBCConnectivityAndSQLQuerySyntax { private static String driver = null; private static String url = null; private static String userId = null; p...

Creating Custom Code Panels using InstallAnywhere

Image
In this write-up lets look at the way to create a Custom Choose File Panel using InstallAnywhere(IA) tool. IA is a multi-platform software tool for creating customized installers.There are many documents available on IA that gives us a clear picture of IA and its features. This write-up assumes that the reader of this blog is aware of the basic features available in IA and has a licensed InstallAnywhere enterprise Edition and not InstallAnywhere standard edition.In this blog I am adding a small piece of code that tells us how to develop custom panels. In the Advanced Designer we can add a file chooser by using "Panel: Choose File" action. The code below produces the same output as IA's Choose File action minus 'Restore Default File'. To write a custom code panel ,it is necessary to write a class that extends CustomCodePanel class and override a couple of methods present in it. Here is the custom code that demonstrates a custom choose file panel. packag...