On 08/12/06, Simon Laws <[EMAIL PROTECTED]> wrote:

I've been thinking about the types of scripts that we might want to
support
in our PHP extension for the C++ SCA runtime. I've tried to extend the
calculator sample from the Ruby and Python extension and made notes on the
PHP SOA web site (
http://www.osoa.org/display/PHP/PHP+SCA+Extension+For+Tuscany+CPP+SCA). An
interesting question arises about who provides composite information. As
it
stands the PHP SCA implementation does not support SCDL files and all
composite information is provided in annotations in the PHP file. For
example, a calculator component might look like:

...

include 'SCA/SCA.php';

/**
* @service
* @binding.ws
*/
class Calculator {

   /**
    * @reference
    * @binding.php Add.php
    */
   public $add_service;

   /**
    * @reference
    * @binding.php Subtract.php
    */
   public $sub_service;

   /**
    * @reference
    * @binding.php Multiply.php
    */
   public $mul_service;

   /**
    * @reference
    * @binding.ws Divide.wsdl
    */
   public $div_service;

   /**
    * Addition
    *
    * @param float $num1 (the first number)
    * @param float $num2 (the second number)
    * @return float The result
    */
   function add($num1, $num2) {
       return $this->mul_service->add($num1, $num2);
   }

   /**
    * Subtraction
    *
    * @param float $num1 (the first number)
    * @param float $num2 (the second number)
    * @return float The result
    */
   function sub($num1, $num2) {
       return $this->mul_service->sub($num1, $num2);
   }

   /**
    * Multiplication
    *
    * @param float $num1 (the first number)
    * @param float $num2 (the second number)
    * @return float The result
    */
   function mul($num1, $num2) {
       return $this->mul_service->mul($num1, $num2);
   }

   /**
    * Division
    *
    * @param float $num1 (the first number)
    * @param float $num2 (the second number)
    * @return float The result
    */
   function div($num1, $num2) {
       return $this->div_service->div($num1, $num2);
   }
}
?>

Note that this contains enough binding information for the PHP SCA runtime
to operate without composite files (see
http://www.osoa.org/display/PHP/SCA+Documentation for more detail of the
PHP
SCA programming model). The ideal solution would be if we could drop these
kinds of PHP files into an SCA application and have the C++ SCA runtime
pick
them up, parse them, and wire them into the application automatically.
This
would mean that the XML composite model of the application would be
incomplete and consequently composite file writers (tools) would have to
look at the PHP script for service and reference information. To make it
work the C++ SCA runtime would need some work in the way that is loads
component implementations and to allow the model to be updated after the
composite files have been read.

An intermediate step would be to ignore any binding information in the PHP
file and rely on information provided in a composite file. This is the way
that C++ SCA currently works and so provides a stepping stone to the fully
featured solution with minimal changes to the C++ SCA runtime.

Thoughts?

Simon


Simon, the C++ core runtime needs to have an SPI for defining meta-data
dynamically. Currently there is a once only loading of the scdl model during
startup. With such an SPI an extension could add components etc. as
required. It may be less effort to develop this SPI than to develop tools
for parsing the PHP and generating SCDL files.

Cheers,

--
Pete

Reply via email to