Tuesday, July 14, 2009

Specifying SSL Certificate and Keystore Location & Password

A small reminder about how to configure the location and password for your keystore with Tomcat. By default Tomcat will look for your keystore (with the file name .keystore) in the home directory with the default password. It is possible to change the filename, password, and the location that Tomcat looks for the keystore by configuring the SSL Connector in "server.xml" (in conf folder in tomcat). "keystoreFile" is the parameter specifying key location and "keyPass" would specify the corresponding password. the finished config may look something like:
<Connector port="8443" 
protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/home/user_name/my_domain.key"
keypass="my_keystore_password"/>

This, however, will not help you if you are using an SSL socket. This is just for making an https connection. If you want to control only keystore and truststore name and password for your socket, you need to give the system properties the values by either specifying the same in vm parameters or setting it in the code:

Using VM parameters:
-Djavax.net.ssl.keyStore=keystore.jks 
-Djavax.net.ssl.keyStorePassword=abc123
-Djavax.net.ssl.trustStore=truststore.jks
-Djavax.net.ssl.trustStorePassword=abc123

In Code:
Properties properties = System.getProperties();
properties.put("javax.net.ssl.keyStore", keyStoreName);
properties.put("javax.net.ssl.keyStorePassword", keyStorePassword);
properties.put("javax.net.ssl.trustStore", trustStoreName);
properties.put("javax.net.ssl.trustStorePassword", trustStorePassword);

For a better understanding of SSL Sockets, please refer to the JSSE Reference Guide. Nevertheless, this is not the end of your woes if you want to control the location as well. This would make sense if you wished to package your application with some default stores so as it can potentially work right out of the box. Here is a piece of code that can help you to do exactly that: Managing store locations

Friday, July 10, 2009

Brainstorming Basics

A question asked is if this idea is unique. Yes and no is the answer. No, as a information systems are being built in one form or another. Yes, as there is no comprehensive information management and analysis system. For example, Joomla is unique as it gives a completely different perspective on building and managing website. Similarly, the project that I am proposing is unique in its vision and application.

Is it even possible to make information systems generalist when people use them so differently? Indeed, this problem is challenging. Nevertheless, in my experience, it is not only possible but is also desirable.

Am I not worried that somebody might steal my idea? Not really. In fact, if somebody can build such a system I may use it to make more applications. On the other hand, since this application that I intend to build may end up as open-source, it may have some appeal eventually.

The first step is to start defining the key modules. Let us brainstorm the objects that we can see in the system

Data Handler: A data handler that reads data in a standardized format and then stores, updates or deletes it as need be

Information: The central class that would act as a controller or central point of directing a particular information set

Webpage: A simple html page that we wish to use display various data interpretation elements

Report: A static report

Graph: Tools to generate static graphs on data set

Tables: Tools to generate smart tables on data set

Filters: Filters for graph or table data

Dashboard: Tools to generate a group of one or more dynamic graphs, smart tables and filters

Rules: Conditional treatment of incoming data

Alert: A notification broadcasted based on some rules defined on data

Logger: Logger that takes care of information logging

Support: A UI to dynamically manage the information system and see the system state visually

Each word in this list is inevitably linked to many more. As I work on it (time permitting) one definition a time, let us see where we reach. To reach the skeleton stage, we will define minimal (and final) goals for each list as we reach them.

Thursday, July 9, 2009

A Need For Generic Information Systems

Information systems are critical to any business. But what do I mean by information systems? I broadly define them as software entities that read data and perform some useful function on the same. These useful functions can include:

- Data visualization (reports & graphs)
- Aid manual data analysis and model making (with rich data dashboards)
- Generate event based alerts for stakeholders (email, sms, automated call, fax)
- Rule-based data analysis

Further, these systems can be either at real-time or passive.

The umpteen number of permutations mean infinite possibilities. Nevertheless, it is fair to assume that such systems should have some common governing principles as they perform a fairly similar job. The current market has a plethora of information system software that are sector specific and address a small subset according to needs of its users. Yet I have not seen an information engine that addresses all these concerns in a way that is generic and powerful enough. There are a lot of pieces that address some part of the puzzle, but what we are missing is something that takes into account the whole picture.

Such a project will be complex in scope and diverse in application. A modular approach that does not force user to take what he does not need is warranted. It should save the development cost for such systems for a wide array of sectors.

I would propose (naturally) a java based solution using mix of spring, maven, Apache libraries, Flex, OpenMQ, Quartz and PostGres. Making it work efficiently for real-time systems and the scale of the project are two immediate challenges that I see. Making it open-source and charging for elite training/support is the way to go; unless somebody has a better idea :D. In coming days, I will try to put down the basic pegs to work towards. Ta till then!

Monday, July 6, 2009

Writing DOM to XML File on Disk

Just wrote a small program to write a DOM to an XML on the disk using Xerces. The sample class can be seen here. If you are using maven, don't forget to add xerces dependencies:
        <dependency>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>apache-xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>

For more details, refer Processing XML with Java by Elliotte Rusty Harold