RE: [Embedlets-dev] Re: JAPL versus Embedlet integration....
Status: Alpha
Brought to you by:
tkosan
|
From: Christopher S. <cs...@oo...> - 2003-03-31 20:54:12
|
Ted says:
> From my perspective, this is the kind of situation that is confusing me:
>
> - A SerialTerminalEmbedlet instantiates a JaplUart peripheral and
> initializes
> it to 9600,8,N,1 in its initialize() method using I/O level semantics.
>
I propose that the embedlet should not 'know' the details of the JAPL
configuration. This is hardware and/or media specific and usually occurs
only once in the operational life of a peripheral.
The Embedlet should present a configuration 'Properties' to JAPL, but not
necessarily know the contents of the Properties. The Properties collection
is loaded by VM configuration settings as in the Ajile JVM setup or by a
coded PersistenceManager.
This would add a PropertyEnabled interface to the JAPL specification but
would have the huge benefit of breaking the coupling and knowledge
requirement between the API's. A snippet of code for configuration would
look like:
In the Embedlet PropertyEnabled interface:
public void readProperties(Properties properties) {
name = properties.getString("Name", name);
peripheral = (JAPLPeripheral) properties.getObject("Peripheral",
peripheral);
peripheral.readProperties(properties);
}
In the JAPL PropertyEnabled interface:
public void readProperties(Properties properties) {
baudRate = properties.getInt("BaudRate ", baudRate);
stopBits = properties.getInt("StopBits", stopBits);
...
}
The configuration XML would look like:
<Embedlet name="CommunicationChannel" ... >
<Peripheral baudRate="9600" stopBits="1" ... />
</Embedlets>
JAPL would need only import 2 new interfaces: PropertyEnabled and Properties
to utilize the configuration capabilities.
> - All application-semantic-level data that is sent to the
> terminal's screen by
> other Embedlets in the application is sent via Embedlet events to the
> SerialTerminalEmbedlet because it is the only piece of software in the
> application that has a reference to the JaplUart and so can send
> messages to
> it.
>
> - As asynchronous I/O level semantic data comes in from the
> JaplUart, it is
> routed through the JAPL wrapper and then published to the Embedlet event
> system. As posted in earlier emails, only application level
> semantics should
> be sent through the Embedlet event system so the JAPL wrapper
> would need to
> convert the I/O event semantics into application level semantics before
> publishing to the application.
>
In the case where the configuration is removed from the equation the
interfaces become symetrical. Embedlets write/read to/from the JAPL stream
and JAPL notifies the Embedlets of events.
I am preparing an upgraded Property package for first release that includes
this dynamic configuration capability.
Chris
|