Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Modularity

Reply
Thread Tools

Modularity

 
 
Paul Selibas
Guest
Posts: n/a
 
      11-24-2005
Good day everyone...

I have a question and any bit of advice would be appreciated.

What would be the easiest possible way to implement a scripting system
in a java program so that you can have a core + modules kind of system.
Or even perhaps compile Java code at runtime. Is this even possible?

What i want to do it make a core and other people can program modules
that will just fit in without changing the core program.

Many thanks to those who contribute.

Paul Selibas

 
Reply With Quote
 
 
 
 
NullBock
Guest
Posts: n/a
 
      11-24-2005
You've lot's of different ways of implementing this. And you don't
have to require run-time compilation either, merely realease a public
API that the module creators can use. We do this fairly extensively
with our products, releasing a fairly large API that users can click
into.

If you do want to go run-time, there are a few things you could
consider. For instance, the Mozilla orginazation has a great pure-Java
JavaScript engine called Rhino (very stable, been around along
time)--go to http://mozilla.org/rhino. There are engines for almost
every language around, including Java. JavaWorld ran a comparison of
different engines a couple years back : http://linkfrog.net/daao

Walter Gildersleeve
Freiburg, Germany

___________________________________________
http://linkfrog.net
URL Shortening
Free and easy, small and green

 
Reply With Quote
 
 
 
 
pkriens@gmail.com
Guest
Posts: n/a
 
      11-25-2005
Take a look at Beanshell. It is a lightweight scripting language that
is very close to Java. This closeness makes it work very well with
standard Java objects.

If you want to build such an extendable model, it might also be worth
to take a look at the OSGi specifications. They form the foundation of
the Eclipse IDE. The OSGi specifies a small framework that manages the
modularity and lifecycle issues of a plugin based model.

Kind regards,

Peter Kriens

 
Reply With Quote
 
ericaro@gmail.com
Guest
Posts: n/a
 
      11-25-2005
you can also read at runtime a .properties file that contains a comma
separated list of fully qualified class
Instanciate using reflexion thoses classes (assuming they are in the
classpath), cast them as com.yourpackage.YourPluginInterface, and use
this list in your core program.

To get thoses classes in the classpath at runtime, set a directory for
"plugins", and instanciate an URLClassLoader, that "loads" all jars in.

Its very very basic and simple yet performant as far as your
application is not build upon thousands of different plugins type.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugins / Modularity =?iso-8859-1?q?Robin_K=E5veland?= Python 3 10-10-2007 07:25 PM
dispatch class, modularity, initialisation? bugbear Java 13 09-04-2007 01:38 PM
Java/OO techniques for modularity and re-use Richard Maher Java 6 07-02-2007 01:11 AM
New patent application to cover OS modularity restricted by DRM. Dianthus Mimulus NZ Computing 0 01-29-2007 06:40 PM
Adding Modularity to Triangle Compiler glory.faded@gmail.com Java 3 11-28-2005 10:42 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57