The Artima Developer Community
Sponsored Link

Java Answers Forum
Need help in architecture design

4 replies on 1 page. Most recent reply: Jan 24, 2005 8:57 AM by Torsten Uhlmann

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Torsten Uhlmann

Posts: 3
Nickname: tuhlmann
Registered: Oct, 2003

Need help in architecture design Posted: Dec 24, 2004 1:59 AM
Reply to this message Reply
Advertisement
Hi everybody,

first of all a merry christmas to all of you!

this is a pre questions so to say :)

I'm in the position to build a new distributed Java application. It's not gonna be a web application but rather
a server that monitors hardware parts and this server is monitored using JMX.

If someone of you would be interested in discussing the architecture for what would be a good design I would
write up an explanation of what the software should do either here or on a wiki of my website so that you have some information on the matter.

I'd really appreciate your help here. So if you would find it interesting for your own projects or you've done similar things in the past...

thanks in advance,
Torsten.


Guillaume Taglang

Posts: 18
Nickname: gouyou
Registered: Jul, 2003

Re: Need help in architecture design Posted: Jan 6, 2005 7:30 AM
Reply to this message Reply
Hello,

Happy new year !

I've already something a little bit like it in the past, if you need some advice or some feedback on the architecture, you are welcome to contact me.

Cheers, Guillaume

Torsten Uhlmann

Posts: 3
Nickname: tuhlmann
Registered: Oct, 2003

Re: Need help in architecture design Posted: Jan 6, 2005 8:38 AM
Reply to this message Reply
Hi Guillaume and others,

ok then, I'm trying to describe what I'm gonna do:

Suppose you have a bunch of electronic sensor devices (1 - 100). Each of them controls something. In regular interval those sensors send their data via a socket connection. For each bundle of 10 devices I need to listen on different ports.

The application monitors those devices.
If all goes well it mainly writes data into a db.
In case the sensor reports an error there is a workflow to follow like:
* sending an email and waiting for response
* sending sms and waiting for response
* all other sensor's data must be processed without interruption

Also I'd like to have pluggable components which I can more or less easy integrate into the system. Say for instance I develop a package which collects statistics about the sensor data and writes this into a data base. Or I develop another mechanism for reporting the error like calling a pager or whatever. I then need a mechanism to wire those components together.

For management of the server I would chose JMX. There is a very small number of admins who would access the system at the same time so I guess this is not a problem. It would also give me an existing architecture to use for start, like mx4j and mc4j, later I could implement a specialized Client using Eclipse RCP for instance.

What I'm currently not sure of is the server architecture I should choose. I don't think I need J2EE or even Tomcat. I have not much experience with it and need to concentrate my energy on business logic.

I have two favourites in my mind.
On one side there is the spring framework. It gives abstraction from the db layer and an IoC container which I would use to separate my components from each other. It does from my point of view not allow a great deal pluggability.

My other favourite is an OSGi framework like Oscal, Knopflerfish or even Eclipse (if I can make it run without display). Those frameworks base on the OSGi standard which makes it very easy to develop plugins (bundles) and pull them together in a descriptive way.

I'm unsure though how much overhead such an approach would mean and how easy unit testing and development itself would be.

So what do you think?

Thanks for reading thus far :)

Torsten.

Guillaume Taglang

Posts: 18
Nickname: gouyou
Registered: Jul, 2003

Re: Need help in architecture design Posted: Jan 10, 2005 10:02 AM
Reply to this message Reply
Hey !

Just a question before starting, did you have a look at existing open-source applications that might fit your need, have already implemented 80% of what is required and might already be used by your admin ?
* mon (http://www.kernel.org/software/mon/)
* nagios (http://www.nagios.org/)

So now comments about the architecture:

If you are using tools like log4j (http://logging.apache.org/log4j/docs/), you will have existing extension which will let you directly have prioritized data, database integration and even more important will let you use the standard monitoring capabilities of you operating system (syslog, windows event logger).

The spring framework, if I remember correctly will get you back to J2EE, you can get the database abstraction by using something like hibernate directly (http://hibernate.org). I would probably say that for a monitoring application you may probably want to use SQL directly, something like hibernate or JDOs should be way to heavy for the limited data structure you'll probably have.

OSGi looks nice, maybe you should also have a look at the avalon project from Apache (http://avalon.apache.org/).

Cheers, Guillaume

Torsten Uhlmann

Posts: 3
Nickname: tuhlmann
Registered: Oct, 2003

Re: Need help in architecture design Posted: Jan 24, 2005 8:57 AM
Reply to this message Reply
Hi Guillaume,

sorry for the delay. But thanks alot for helping me find a good track for app development!

I believe I have found a very flexible architecture on which I will build my system.

The kernel of the system will be Spring. Spring does not neccessarily need to be used in J2EE or Web context but can be used to any extend you need it. It is great for decoupling parts of my application.

Next I'm gonna use a messaging layer to separate my components. I thought about ActiveMQ and tried it a bit but it's far too big for what I need. I found a great article on messaging at http://www.enterpriseintegrationpatterns.com/ramblings/14_edainjvm.html
which explains a simple messaging solution.

I will then build one layer of listeners. These are threads that listen at ports or whatever mechanism we will use later (for now there is only a SocketListener) for incoming data. They will wrap this data in a Message (an object with a known interface) and give it to the message bus. They don't care who uses those messages, they have their single responsibility. Then there are transformer objects that subscribe to this message type and build a sensor message object out of the raw data. This way raw data from different sensor types can be transformed into one uniform view upon the data. The transformers will throw the created object into the bus and go along with their business.

Now that data can be taken from a SensorDispatcher object and given to the responsible sensor object. Then the heavy work will start :) I then need some kind of rule engine to determine what to do next with that sensor. If I always get a green light everything is fine and data is just written to db. If there is a problem I must take action according to the problem. But I will tackle that one later.

I will use XML to describe the sensor listeners, the transformers and the sensors.

This way the system is open for expansion.

I thought about this for a long time and have thrown away other approaches and played with yet others, but this appears to me as a fairly lightweight approach. I might throw JMX away and use Springs remoting support since I don't need to support generic MBeans but need to have a specialized Client application. But thats the beauty of this approach- I just need to change the fassade and can then deploy it within JBoss or with Jetty or Tomcat if I need to.
But for now I don't which I'm glad for :)

What do you think?

Torsten.

Flat View: This topic has 4 replies on 1 page
Topic: path Previous Topic   Next Topic Topic: API Extension java.lang.reflect.Array - help me make it worthy!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use