Source for file DataManager.abstract.php

Documentation is available at DataManager.abstract.php

  1. <?php
  2. /**
  3. * @package harmoni.datamanager
  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: DataManager.abstract.php,v 1.17 2007/09/04 20:25:31 adamfranco Exp $
  9. */
  10. require_once(HARMONI."dataManager/schema/SchemaManager.class.php");
  11. require_once(HARMONI."dataManager/DataTypeManager.class.php");
  12. require_once(HARMONI."dataManager/record/RecordManager.class.php");
  13. require_once(HARMONI."dataManager/record/TagManager.class.php");
  14. require_once(HARMONI."dataManager/record/RecordSet.class.php");
  15.  
  16. require_once(HARMONI."dataManager/search/include.php");
  17.  
  18. require_once(HARMONI."dataManager/versionConstraints/include.php");
  19.  
  20. /**
  21. * The HarmoniDataManager class is used purely to setup the services required to use the
  22. * other DataManager classes such as the {@link DataSetTypeManager} or the {@link RecordManager}.
  23. *
  24. * @package harmoni.datamanager
  25. *
  26. * @copyright Copyright &copy; 2005, Middlebury College
  27. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  28. *
  29. * @version $Id: DataManager.abstract.php,v 1.17 2007/09/04 20:25:31 adamfranco Exp $
  30. *
  31. * @author Gabe Schine
  32. * @abstract
  33. */
  34. class DataManager {
  35.  
  36. /**
  37. * Assign the configuration of this Manager. Valid configuration options are as
  38. * follows:
  39. * database_index integer
  40. * preload_types object TypeIterator
  41. *
  42. * @param object Properties $configuration (original type: java.util.Properties)
  43. *
  44. * @throws object OsidException An exception with one of the following
  45. * messages defined in org.osid.OsidException: {@link }
  46. * org.osid.OsidException#OPERATION_FAILED OPERATION_FAILED},
  47. * {@link org.osid.OsidException#PERMISSION_DENIED}
  48. * PERMISSION_DENIED}, {@link }
  49. * org.osid.OsidException#CONFIGURATION_ERROR
  50. * CONFIGURATION_ERROR}, {@link }
  51. * org.osid.OsidException#UNIMPLEMENTED UNIMPLEMENTED}, {@link }
  52. * org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT}
  53. *
  54. * @access public
  55. */
  56. function assignConfiguration ( $configuration ) {
  57. $dbIndex = $configuration->getProperty('database_index');
  58. $preloadTypes =$configuration->getProperty('preload_types');
  59. $this->setup($dbIndex, $preloadTypes);
  60. }
  61.  
  62. /**
  63. * Return context of this OsidManager.
  64. *
  65. * @return object OsidContext
  66. *
  67. * @throws object OsidException
  68. *
  69. * @access public
  70. */
  71. function getOsidContext () {
  72. return $this->_osidContext;
  73. }
  74.  
  75. /**
  76. * Assign the context of this OsidManager.
  77. *
  78. * @param object OsidContext $context
  79. *
  80. * @throws object OsidException An exception with one of the following
  81. * messages defined in org.osid.OsidException: {@link }
  82. * org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT}
  83. *
  84. * @access public
  85. */
  86. function assignOsidContext ( $context ) {
  87. $this->_osidContext =$context;
  88. }
  89. /**
  90. * Sets up the services required for the DataManager, including: DataSetTypeManager,
  91. * DataTypeManager, DataSetManager, RecordTagManager
  92. * @return void
  93. * @access public
  94. * @param int $dbID The DB index from the {@link DBHandler} that we should use to look for our data.
  95. * @param optional array An array of {@link HarmoniType} objects corresponding to Schemas that should be pre-loaded in one DB query.
  96. * @abstract
  97. */
  98. function setup( $dbID, $preloadTypes=null ) {
  99. if (ini_get("magic_quotes_runtime")) {
  100. throwError(
  101. new Error(
  102. "The DataManager requires that the php.ini config option <B>magic_quotes_runtime</B> be OFF.",
  103. "DataManager",
  104. true));
  105. }
  106. // let's setup all our services
  107. define("DATAMANAGER_DBID",$dbID);
  108.  
  109. // ok, now on to registering everything
  110. $schemaManager = new SchemaManager($preloadTypes);
  111. $dataTypeManager = new DataTypeManager();
  112. $recordManager = new RecordManager();
  113. $tagManager = new RecordTagManager();
  114.  
  115. Services::registerObjectAsService("SchemaManager",$schemaManager);
  116. Services::registerObjectAsService("DataTypeManager",$dataTypeManager);
  117. Services::registerObjectAsService("RecordManager",$recordManager);
  118. Services::registerObjectAsService("RecordTagManager",$tagManager);
  119. if (!Services::serviceRunning("Id")) {
  120. throwError(
  121. new Error(
  122. "The DataManager requires the IdManager, but it is not running.",
  123. "DataManager",
  124. true));
  125. }
  126. debug::output("Activated Harmoni Data Manager.",DEBUG_SYS1,"DataManager");
  127. }
  128. /**
  129. * Returns if the DataManager was previously loaded or not.
  130. * @access public
  131. * @return bool
  132. */
  133. function loaded()
  134. {
  135. return (
  136. Services::serviceRunning("SchemaManager") &&
  137. Services::serviceRunning("DataTypeManager") &&
  138. Services::serviceRunning("RecordManager") &&
  139. Services::serviceRunning("RecordTagManager")
  140. );
  141. }
  142. }
  143.  
  144. ?>

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