Codebase for #include now available

"Goldsack, Patrick" <[email protected]>
Newsgroups gmane.comp.java.smartfrog.devel
Message-ID <[email protected]>
One of the big issues with the language has been the lack of a #include
equivalent to the sfCodebase attribute for class loading. This is now
available in a first trial version - unfortunately just a touch late for
the newly released rc2, but only in the top-of-trunk cvs version.

The way it works is this:

Every #include can be preceded by an optional #codebase as follows:

#codebase "..." #include "..."

The syntax for the codebase is the same as that for the sfCodebase
attribute - a space separated set of urls to Jar files (which must be
signed if security is on).

If the codebase is not provided, the default daemon codebase is used,
otherwise the provided codebase is seqarched after the default if the
include file is not found there.

Nested includes propagate the codebase for its include, and indeed these
nested includes can add more jars to that codebase with their own
codebase statements. These are searched after the default and outer
codebase statements.

This model allows the following simple use model (as well as others):

- a set of .sf  file can be created for a service, including one (or
more) "top-level" sfConfig-defining .sf files that include some or all
the others directly or indirectly. It is important that these includes
do not need to be annotated with a specific codebase.

- these .sf files can be put into one or more jar files

- a new "top-level" deployable .sf file can be created for the top-level
file sf in the jar files that do nothing more than including that
top-level file with a codebase that includes all the required jar files.

As the codebase is passed down to the nested includes, all the directly
and indirectly included .sf files will be found. As an example consider:



Example.sf: (placed in /jars/ex1.jar)
---
#include "ExComp.sf"
sfConfig extends exComp { ... }
---


ExComp.sf:  (placed in /jars/ex2.jar)
---
#include "org/smartfrog/components.sf"
exComp extends Prim { ... }
---


This is deployable through the description

deployExample.sf:
---
#codebase "file:///jars/ex1.jar file:///jars/ex2.jar" #include
"Example.sf"
---


It is slightly primitive, but probably solves many of the problems that
people currently face. 

Please comment and play...

Patrick


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.