• Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Architecture  RSS feed

 
Sean Riley
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have some really old code that I wrote in perl about 5 years ago which has grown and evolved over time. I now need to port it to\re-write it in java.

One thing that I dont have any idea how to do (amongst many others) is as follows;

In the old code I would launch a dedicated .exe file which would process events for each client to seperate service desk applications. So Client1 would launch myServiceDeskappA and Client2 would launch myServiceDeskappE also Client3 would launch its own myServiceDeskappA. Viewed in a table I could display this as follows;

  • Client1 - myServiceDeskappA
  • Client2 - myServiceDeskappE
  • Client3 - myServiceDeskappA


  • This gave me the opportunity to simply build a piece of code that would intergrate with myNEWapp and change the configuration for Client3 - myNEWapp and an exe called myNEWapp.exe would be launched.

    I am currently looking at doing the same thing in java, possibly with threads, although I am quite sure this will not work. I need to be able to launch a process per Client based on configuration. I.e. the process name may change over time. I hope this is making sence.

    Is there a proper way to architect this without having to re-compile the main code every time I add a myNEWapp bit of code?

    Regards
    Sean
    [ October 30, 2006: Message edited by: Sean Riley ]
     
    Ernest Friedman-Hill
    author and iconoclast
    Sheriff
    Posts: 24215
    37
    Chrome Eclipse IDE Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I'm not 100% sure what you're asking, but take a look at the java.lang.Runtime.exec() family of static methods, which are used to launch external applications. They of course can launch a process based just on String data that could come from a configuration file.

    If you're looking to replace this mechanism with something more Javaesque, Java has the ability to load a Java class based, again, on just String data -- in this case, the name of a class. So a client compiled on Monday could change their configuration file on Tuesday to load a service class written that day, and all would work just fine. Many important Java architectures (servlets and EJBs on the server side, applets in a browser) are based on exactly this capability. It's done using the static methods java.lang.Class.forName() and java.lang.Class.newInstance().
     
    Sean Riley
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you Ernest,

    This is a great starting point. I am looking for the Javaesque way of doing exactally what you described.

    I'll look further into the static methods java.lang.Class.forName() and java.lang.Class.newInstance()

    Thanks again.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!