Source for file BasicOutputHandlerConfigProperties.class.php

Documentation is available at BasicOutputHandlerConfigProperties.class.php

  1. <?php
  2. /**
  3. * @package harmoni.architecture.output
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: BasicOutputHandlerConfigProperties.class.php,v 1.6 2007/09/07 17:25:06 adamfranco Exp $
  9. */
  10.  
  11. require_once(OKI2."/osid/shared/Properties.php");
  12. require_once(HARMONI."oki2/shared/HarmoniObjectIterator.class.php");
  13. require_once(HARMONI."oki2/shared/ConfigurationPropertiesType.class.php");
  14.  
  15.  
  16. /**
  17. * Properties is a mechanism for returning read-only data about an object. An
  18. * object can have data associated with a PropertiesType. For each
  19. * PropertiesType, there are Properties which are Serializable values
  20. * identified by a key.
  21. *
  22. * <p>
  23. * OSID Version: 2.0
  24. * </p>
  25. *
  26. * @package harmoni.architecture.output
  27. *
  28. * @copyright Copyright &copy; 2005, Middlebury College
  29. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  30. *
  31. * @version $Id: BasicOutputHandlerConfigProperties.class.php,v 1.6 2007/09/07 17:25:06 adamfranco Exp $
  32. */
  33. class BasicOutputHandlerConfigProperties
  34. extends Properties
  35. {
  36.  
  37. /**
  38. * Constructor. Create a new Properties object.
  39. *
  40. * @param object Type $type
  41. * @return object
  42. * @access public
  43. * @since 11/18/04
  44. */
  45. function ConfigurationProperties() {
  46. $this->_type = new ConfigurationPropertiesType;
  47. $this->_properties = array(
  48. serialize('document_type') => serialize('text/html'),
  49. serialize('character_set') => serialize('utf-8'),
  50. serialize('document_type_definition') => serialize('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
  51. );
  52. }
  53.  
  54. /**
  55. * Get the Type for this Properties instance.
  56. *
  57. * @return object Type
  58. *
  59. * @throws object SharedException An exception with one of the
  60. * following messages defined in org.osid.shared.SharedException
  61. * may be thrown: {@link }
  62. * org.osid.shared.SharedException#UNKNOWN_TYPE UNKNOWN_TYPE},
  63. * {@link org.osid.shared.SharedException#PERMISSION_DENIED}
  64. * PERMISSION_DENIED}, {@link }
  65. * org.osid.shared.SharedException#CONFIGURATION_ERROR
  66. * CONFIGURATION_ERROR}, {@link }
  67. * org.osid.shared.SharedException#UNIMPLEMENTED UNIMPLEMENTED}
  68. *
  69. * @access public
  70. */
  71. function getType () {
  72. return $this->_type;
  73. }
  74.  
  75. /**
  76. * Get the Property associated with this key.
  77. *
  78. * @param object mixed $key (original type: java.io.Serializable)
  79. *
  80. * @return object mixed (original type: java.io.Serializable)
  81. *
  82. * @throws object SharedException An exception with one of the
  83. * following messages defined in org.osid.shared.SharedException
  84. * may be thrown: {@link }
  85. * org.osid.shared.SharedException#UNKNOWN_TYPE UNKNOWN_TYPE},
  86. * {@link org.osid.shared.SharedException#PERMISSION_DENIED}
  87. * PERMISSION_DENIED}, {@link }
  88. * org.osid.shared.SharedException#CONFIGURATION_ERROR
  89. * CONFIGURATION_ERROR}, {@link }
  90. * org.osid.shared.SharedException#UNIMPLEMENTED UNIMPLEMENTED},
  91. * {@link org.osid.shared.SharedException#UNKNOWN_KEY UNKNOWN_KEY}
  92. *
  93. * @access public
  94. */
  95. function getProperty ( $key ) {
  96. if (!isset($this->_properties[serialize($key)]))
  97. return null;
  98. return $this->_properties[serialize($key)];
  99. }
  100.  
  101. /**
  102. * Get the Keys associated with these Properties.
  103. *
  104. * @return object ObjectIterator
  105. *
  106. * @throws object SharedException An exception with one of the
  107. * following messages defined in org.osid.shared.SharedException
  108. * may be thrown: {@link }
  109. * org.osid.shared.SharedException#UNKNOWN_TYPE UNKNOWN_TYPE},
  110. * {@link org.osid.shared.SharedException#PERMISSION_DENIED}
  111. * PERMISSION_DENIED}, {@link }
  112. * org.osid.shared.SharedException#CONFIGURATION_ERROR
  113. * CONFIGURATION_ERROR}, {@link }
  114. * org.osid.shared.SharedException#UNIMPLEMENTED UNIMPLEMENTED}
  115. *
  116. * @access public
  117. */
  118. function getKeys () {
  119. $keys = array();
  120. foreach (array_keys($this->_properties) as $key) {
  121. $keys[] = unserialize($key);
  122. }
  123. $obj = new HarmoniObjectIterator($keys);
  124. return $obj;
  125. }
  126. /**
  127. * Set the value of a Property/
  128. *
  129. * WARNING: NOT IN OSID - This method is not in the OSIDs as of version 2.0
  130. * Use at your own risk
  131. *
  132. * @param mixed $key
  133. * @param mixed $value
  134. * @return void
  135. * @access public
  136. * @since 11/18/04
  137. */
  138. function setProperty ( $key, $value ) {
  139. if (!isset($this->_properties[serialize($key)]))
  140. throwError(new Error("Invalid configuration key, '$key'.", "BasicOutputHandlerConfigProperties", true));
  141. $this->_properties[serialize($key)] = $value;
  142. }
  143. }

Documentation generated on Wed, 19 Sep 2007 10:21:44 -0400 by phpDocumentor 1.3.0RC3