Date: 2004-05-04T07:26:17
Editor: HarishKrishnaswamy <[EMAIL PROTECTED]>
Wiki: Jakarta HiveMind Wiki
Page: NotXMLProposal
URL: http://wiki.apache.org/jakarta-hivemind/NotXMLProposal
no comment
Change Log:
------------------------------------------------------------------------------
@@ -189,7 +189,7 @@
HowardLewisShip: ["JavaCC"] generates a token stream and each token knows it
start and end line number and column. I think it will be much easier to support
this than with XML. I suspect we'll be able to easily get that information out
of the parser and into the plugin. Like Tapestry, a plugin shouldn't be all
that necessary ... the SDL stuff takes the teeth out of XML, making it look
quite pleasant.
-HarishKrishnaswamy: Ok, here's a little more elaborate example.
+HarishKrishnaswamy: Ok, here's the same example with little more details.
{{{
/**
* Service point definition
@@ -222,7 +222,7 @@
(
"service-id",
ServiceImplementation.class,
- dependencies // Setter arguments
+ dependencies // Setter properties
)
);
}}}
@@ -238,7 +238,10 @@
{
Interpreter interpreter = new Interpreter();
- interpreter.set("$helper$", new BshBuilderHelper(registry));
+ helper = new BshBuilderHelper(registry);
+ helper.setCurrentModuleName(moduleUrl.toString());
+
+ interpreter.set("$helper$", helper);
interpreter.eval("importObject($helper$)"); // This is a mixin
command
@@ -247,8 +250,6 @@
interpreter.set("$interpreter$", interpreter);
interpreter.set("$callstack$", new
CallStack(interpreter.getNameSpace()));
- registry.setCurrentModuleName(moduleUrl.toString());
-
interpreter.set("$url$", moduleUrl);
interpreter.eval("evalModule($url$, $helper$, $interpreter$,
$callstack$)");
}
@@ -272,13 +273,13 @@
public void servicePoint(String serviceId, Class serviceInterface)
{
Location location = new Location(_currentModuleName,
_currentLineNumber);
- // Register the service point with the location
+ // Register the service point along with the location
}
public Object implementation(String serviceId, Class
serviceImplementation, Object[] constructorArgs)
{
Location location = new Location(_currentModuleName,
_currentLineNumber);
- // Register the service implementation with the location
+ // Register the service implementation along with the location
return service;
}
@@ -302,3 +303,7 @@
Of late, I have really subscribed into KISS and
[http://martinfowler.com/bliki/EnablingAttitude.html Enabling Attitude]
principles and these ideas are simply a repercussion of that.
KnutWannheden: Harish, your example is IMO getting very close to a purely
descriptive form (like the SDL or XML approach). Of course someone could
(ab)use the BSH design to write an absurdly cryptic module descriptor. This is
where I gather you say the Enabling Attitude principle comes in to play. IMO
the only thing with the XML descriptor which doesn't conform to this principle
is the XML syntax itself, and that's what SDL should solve. But then again
with the plethora of XML processing / spewing tools I think XML also has some
nice advantages. Also I think one of the main purposes of using a descriptive
syntax is to make the descriptor itself readable. And, as previously noted, if
users put arbitrary Java code into the descriptor I think it could prove
difficult for HiveDoc to produce something useful.
+
+HarishKrishnaswamy: Couple things I forgot to mention: Producing HiveDoc is
just as simple because the comments could be a part of the AST and we could
annotate them for HiveDoc. And secondly, with this approach I don't think we
need a special tool like Spindle for the descriptors; the eclipse scrapbook
page is good enough, IMO.
+
+I certainly like the SDL far better than XML for reasons I have already
mentioned, but my point of using scripting language was to save us the trouble
of creating another language and make it more easily adoptable. If I were new
to HiveMind, I wouldn't want to worry about the schema and factory and friends.
I would simply want to say here's my service point and here's the
implementation, you do your thing and get me the service. Or here's the
configuration point and here's all the contributions. Don't get me wrong, I
still like all the concepts in HiveMind, its just the usage ;) And just to make
it clear, there are no flames here!
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]