comp.lang.ada
 help / color / mirror / Atom feed
* [Ann]: Ada Utility Library 1.4.0 is available
@ 2012-01-15 21:41 Stephane Carrez
  2012-01-16  8:10 ` : " AdaMagica
  0 siblings, 1 reply; 4+ messages in thread
From: Stephane Carrez @ 2012-01-15 21:41 UTC (permalink / raw)


Hi all,

Ada Utility Library is a collection of utility packages for Ada 2005.
It includes:

  o A logging framework close to Java log4j framework,
  o Support for properties
  o A serialization/deserialization framework for XML, JSON, CSV
  o Ada beans framework
  o Encoding/decoding framework (Base16, Base64, SHA, HMAC-SHA)
  o A composing stream framework (raw, files, buffers, pipes)
  o Several concurrency tools (reference counters, counters, pools)

A new version is available which provides:

- Support for localized date format,
- Support for process creation and pipe streams (on Unix and Windows),
- Support for CSV in the serialization framework,
- Integratation of Ahven 2.1 for the unit tests (activate with --enable-ahven),
- A tool to generate perfect hash function

It has been compiled and ported on Linux, Windows and Netbsd (gcc 4.4, GNAT 2011, gcc 4.6.2).
You can download this new version at http://code.google.com/p/ada-util/.

Stephane




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: : Ada Utility Library 1.4.0 is available
  2012-01-15 21:41 [Ann]: Ada Utility Library 1.4.0 is available Stephane Carrez
@ 2012-01-16  8:10 ` AdaMagica
  2012-01-16 11:48   ` Georg Bauhaus
  2012-01-16 20:31   ` Stephane Carrez
  0 siblings, 2 replies; 4+ messages in thread
From: AdaMagica @ 2012-01-16  8:10 UTC (permalink / raw)


Hm, I looked at your beans, and I do not see the value of this.
What's the advantage of returning components with string names versus
returning them as usual?
First of all, the components are visible. If they aren't, why not just
use

function Radius (B: Compute_Bean) return Float;

--------------
with Util.Beans.Basic;
with Util.Beans.Objects;
...

   type Compute_Bean is new Util.Beans.Basic.Bean with record
      Height : My_Float := -1.0;
      Radius : My_Float := -1.0;
   end record;

   --  Get the value identified by the name.
   overriding
   function Get_Value (From : Compute_Bean;
                       Name : String) return
Util.Beans.Objects.Object;

   --  Set the value identified by the name.
   overriding
   procedure Set_Value (From  : in out Compute_Bean;
                        Name  : in String;
                        Value : in Util.Beans.Objects.Object);

Bean Implementation

The getter and setter will identify the property to get or set through
a name. The value is represented by an Object type that can hold
several data types (boolean, integer, floats, strings, dates, ...).
The getter looks for the name and returns the corresponding value in
an Object record. Several To_Object functions helps in creating the
result value.

   function Get_Value (From : Compute_Bean;
                       Name : String) return Util.Beans.Objects.Object
is
   begin
      if Name = "radius" and From.Radius >= 0.0 then
         return Util.Beans.Objects.To_Object (Float (From.Radius));

      elsif Name = "height" and From.Height >= 0.0 then
         return Util.Beans.Objects.To_Object (Float (From.Height));

      else
         return Util.Beans.Objects.Null_Object;
      end if;
   end Get_Value;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: : Ada Utility Library 1.4.0 is available
  2012-01-16  8:10 ` : " AdaMagica
@ 2012-01-16 11:48   ` Georg Bauhaus
  2012-01-16 20:31   ` Stephane Carrez
  1 sibling, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2012-01-16 11:48 UTC (permalink / raw)


On 16.01.12 09:10, AdaMagica wrote:
> Hm, I looked at your beans, and I do not see the value of this.

TTBOMK, beans at the most basic level will usually exist so that
there is a way for some kind of configurable framework to automatically
write ("serialize") plain old Ada objects to external storage, and restore
them as Ada objects, as needed. (There is more, like transactions,
or events sent to beans.)  The external storage typically
provides for storing conventional database types; the storage can
be configured without touching the programs, and can be anything
that meets some simple requirements, not just RDMSs. Could be
JSON, or XML, too.  JSON is particularly hip if you want
communication with Google terminals, such as Android devices
or browser based virtual machines, JSON being  a Javascript
format (assoc lists).

The easiest way to map plain old objects to external storage
is via symbolic names understood at both the Ada end
and at the data storage end. The resulting objects can be
used by programs written in other languages, too.
As long as the data items are complete (no references, say),
the data storage needs only know, for each data item to be handled,
a pair consisting of the name of data item, and the predefined
type of item, perhaps in some data nest fashion. Hence, I think,

   subtype Polytype is Util.Beans.Objects.Object;
     -- for illustrating the multi-type nature

   overriding
   function Get_Value (From : Compute_Bean;
                       Name : String) return Polytype;

together with the definition of a mapping between Polytype,
names, and program types.


<Side-note related="somewhat">Rumor has it that not all projects
are entirely happy after having moved away from plain old
relational SQL (such as JDBC) to object storage (such as Hibernate).</>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: : Ada Utility Library 1.4.0 is available
  2012-01-16  8:10 ` : " AdaMagica
  2012-01-16 11:48   ` Georg Bauhaus
@ 2012-01-16 20:31   ` Stephane Carrez
  1 sibling, 0 replies; 4+ messages in thread
From: Stephane Carrez @ 2012-01-16 20:31 UTC (permalink / raw)
  To: AdaMagica

Hi!

On 01/16/2012 09:10 AM, AdaMagica wrote:
> Hm, I looked at your beans, and I do not see the value of this.
> What's the advantage of returning components with string names versus
> returning them as usual?
> First of all, the components are visible. If they aren't, why not just
> use
>
> function Radius (B: Compute_Bean) return Float;
>

The purpose of these Ada beans is to be able to give access to
object values and object methods from withing a presentation layer.

The benefit of Ada beans comes when you need to get a value or invoke
a method on an object but you don't know at compile time the object or method.
That step being done later through some external configuration or presentation file.

In this case, you need somehow to dynamically retrieve the members of an object
(hence the Get_Value) and see what methods it exposes (hence the Get_Method_Bindings).

In a presentation page, the Ada bean values could be referenced as follows:

   Height: #{compute.height}
   Radius: #{compute.radius}

which triggers a call to Get_Value with the 'height' or 'radius' names on
an object registered under the name 'compute'.

To learn more on this presentation topic, I invite you to look at the following article:

http://blog.vacs.fr/index.php?post/2011/03/21/Ada-Server-Faces-Application-Example


Stephane



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-16 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15 21:41 [Ann]: Ada Utility Library 1.4.0 is available Stephane Carrez
2012-01-16  8:10 ` : " AdaMagica
2012-01-16 11:48   ` Georg Bauhaus
2012-01-16 20:31   ` Stephane Carrez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox