Changeset 1161
- Timestamp:
- 12/18/07 18:03:21 (1 year ago)
- Files:
-
- trunk/src/main/php/org/stubbles/examples/resources/MyResource.php (modified) (1 diff)
- trunk/src/main/php/org/stubbles/examples/resources/MyResourceImpl.php (modified) (1 diff)
- trunk/src/main/php/org/stubbles/examples/service/MathService.php (modified) (2 diffs)
- trunk/src/main/php/org/stubbles/examples/service/RememberNameService.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/stubbles/examples/resources/MyResource.php
r904 r1161 1 1 <?php 2 interface MyResource extends stubSessionResource { 2 /** 3 * Example resource interface. 4 * 5 * @author Stephan Schmidt <schst@stubbles.net> 6 * @package stubbles_examples 7 * @subpackage resources 8 */ 9 stubClassLoader::load('net.stubbles.ipo.session.resourcemanager.stubSessionResource'); 10 /** 11 * Example resource interface. 12 * 13 * @package stubbles_examples 14 * @subpackage resources 15 */ 16 interface MyResource extends stubSessionResource 17 { 18 /** 19 * returns the current count value 20 * 21 * @return int 22 */ 3 23 public function getCount(); 24 25 /** 26 * increments the counter 27 */ 4 28 public function incrementCount(); 5 29 } trunk/src/main/php/org/stubbles/examples/resources/MyResourceImpl.php
r1156 r1161 1 1 <?php 2 stubClassLoader::load('org.stubbles.examples.resources.MyResource'); 3 4 class MyResourceImpl extends stubSerializableObject implements MyResource { 5 2 /** 3 * Example resource implementation. 4 * 5 * @author Stephan Schmidt <schst@stubbles.net> 6 * @package stubbles_examples 7 * @subpackage resources 8 */ 9 stubClassLoader::load('net.stubbles.ipo.session.resourcemanager.stubSessionResource'); 10 /** 11 * Example resource implementation. 12 * 13 * @package stubbles_examples 14 * @subpackage resources 15 */ 16 class MyResourceImpl extends stubSerializableObject implements MyResource 17 { 18 /** 19 * the counter 20 * 21 * @var int 22 */ 6 23 protected $count; 7 24 8 public function __construct() { 25 /** 26 * constructor 27 */ 28 public function __construct() 29 { 9 30 $this->count = 0; 10 31 } 11 32 12 33 /** 13 * getthe current count value34 * returns the current count value 14 35 * 15 * @return int36 * @return int 16 37 * @XMLTag(tagName='count') 17 38 */ 18 public function getCount() { 39 public function getCount() 40 { 19 41 return $this->count; 20 42 } 21 43 22 44 /** 23 * Increment the count45 * increments the counter 24 46 * 25 47 * @XMLIgnore 26 48 */ 27 public function incrementCount() { 49 public function incrementCount() 50 { 28 51 $this->count++; 29 52 } trunk/src/main/php/org/stubbles/examples/service/MathService.php
r751 r1161 14 14 * @subpackage service 15 15 */ 16 class MathService {17 16 class MathService 17 { 18 18 /** 19 19 * Add two numbers 20 20 * 21 21 * @WebMethod 22 * @param int$arrKey23 * @return string22 * @param int $arrKey 23 * @return string 24 24 */ 25 public function add($a, $b) { 26 return $a+$b; 25 public function add($a, $b) 26 { 27 return $a + $b; 27 28 } 28 29 … … 32 33 * @WebMethod 33 34 */ 34 public function throwException() { 35 public function throwException() 36 { 35 37 throw new stubException("This exception is intended."); 36 38 } trunk/src/main/php/org/stubbles/examples/service/RememberNameService.php
r844 r1161 7 7 * @subpackage service 8 8 */ 9 10 9 /** 11 10 * Simple service to demonstrate stateful services. … … 15 14 * @subpackage service 16 15 */ 17 class RememberNameService { 18 16 class RememberNameService 17 { 18 /** 19 * session key 20 */ 19 21 const SESSION_KEY_NAME = '__name__'; 20 21 22 /** 22 23 * The session 23 24 * 24 * @var stubSession25 * @var stubSession 25 26 */ 26 27 private $session; … … 29 30 * Inject the session 30 31 * 31 * @param stubSession$session32 * @param stubSession $session 32 33 * @Inject 33 34 */ 34 public function setSession(stubSession $session) { 35 public function setSession(stubSession $session) 36 { 35 37 $this->session = $session; 36 38 } … … 40 42 * 41 43 * @WebMethod 42 * @return string44 * @return string 43 45 */ 44 public function getName() { 46 public function getName() 47 { 45 48 return $this->session->getValue(self::SESSION_KEY_NAME, 'No name set.'); 46 49 } … … 50 53 * 51 54 * @WebMethod 52 * @param string55 * @param string 53 56 */ 54 public function setName($name) { 57 public function setName($name) 58 { 55 59 return $this->session->putValue(self::SESSION_KEY_NAME, $name); 56 60 }
