Source for file FileDataPartStructure.class.php

Documentation is available at FileDataPartStructure.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/repository/PartStructure.php");
  4.  
  5. /**
  6. * Each Asset has one of the AssetType supported by the Repository. There are
  7. * also zero or more RecordStructures required by the Repository for each
  8. * AssetType. RecordStructures provide structural information. The values for
  9. * a given Asset's RecordStructure are stored in a Record. RecordStructures
  10. * can contain sub-elements which are referred to as PartStructures. The
  11. * structure defined in the RecordStructure and its PartStructures is used in
  12. * for any Records for the Asset. Records have Parts which parallel
  13. * PartStructures.
  14. *
  15. * <p>
  16. * OSID Version: 2.0
  17. * </p>
  18. *
  19. * @package harmoni.osid_v2.repository
  20. *
  21. * @copyright Copyright &copy;2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
  23. *
  24. * @version $Id: FileDataPartStructure.class.php,v 1.9 2007/09/04 20:25:44 adamfranco Exp $
  25. */
  26. class FileDataPartStructure extends PartStructure
  27. // extends java.io.Serializable
  28.  
  29. {
  30.  
  31. var $_recordStructure;
  32. function FileDataPartStructure($recordStructure) {
  33. $this->_recordStructure =$recordStructure;
  34. }
  35. /**
  36. * Get the display name for this PartStructure.
  37. *
  38. * @return string
  39. *
  40. * @throws object RepositoryException An exception with one of
  41. * the following messages defined in
  42. * org.osid.repository.RepositoryException may be thrown: {@link }
  43. * org.osid.repository.RepositoryException#OPERATION_FAILED
  44. * OPERATION_FAILED}, {@link }
  45. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  46. * PERMISSION_DENIED}, {@link }
  47. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  48. * CONFIGURATION_ERROR}, {@link }
  49. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  50. * UNIMPLEMENTED}
  51. *
  52. * @access public
  53. */
  54. function getDisplayName() {
  55. return "File Data";
  56. }
  57.  
  58. /**
  59. * Get the description for this PartStructure.
  60. *
  61. * @return string
  62. *
  63. * @throws object RepositoryException An exception with one of
  64. * the following messages defined in
  65. * org.osid.repository.RepositoryException may be thrown: {@link }
  66. * org.osid.repository.RepositoryException#OPERATION_FAILED
  67. * OPERATION_FAILED}, {@link }
  68. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  69. * PERMISSION_DENIED}, {@link }
  70. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  71. * CONFIGURATION_ERROR}, {@link }
  72. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  73. * UNIMPLEMENTED}
  74. *
  75. * @access public
  76. */
  77. function getDescription() {
  78. return "The binary data-stream for the file.";
  79. }
  80. /**
  81. * Get the Type for this PartStructure.
  82. *
  83. * @return object Type
  84. *
  85. * @throws object RepositoryException An exception with one of
  86. * the following messages defined in
  87. * org.osid.repository.RepositoryException may be thrown: {@link }
  88. * org.osid.repository.RepositoryException#OPERATION_FAILED
  89. * OPERATION_FAILED}, {@link }
  90. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  91. * PERMISSION_DENIED}, {@link }
  92. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  93. * CONFIGURATION_ERROR}, {@link }
  94. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  95. * UNIMPLEMENTED}
  96. *
  97. * @access public
  98. */
  99. function getType() {
  100. if (!isset($this->_type)) {
  101. $this->_type = new HarmoniType("Repository", "edu.middlebury.harmoni", "blob");
  102. }
  103. return $this->_type;
  104. }
  105.  
  106. /**
  107. * Get the unique Id for this PartStructure.
  108. *
  109. * @return object Id
  110. *
  111. * @throws object RepositoryException An exception with one of
  112. * the following messages defined in
  113. * org.osid.repository.RepositoryException may be thrown: {@link }
  114. * org.osid.repository.RepositoryException#OPERATION_FAILED
  115. * OPERATION_FAILED}, {@link }
  116. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  117. * PERMISSION_DENIED}, {@link }
  118. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  119. * CONFIGURATION_ERROR}, {@link }
  120. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  121. * UNIMPLEMENTED}
  122. *
  123. * @access public
  124. */
  125. function getId() {
  126. $idManager = Services::getService("Id");
  127. return $idManager->getId("FILE_DATA");
  128. }
  129.  
  130. /**
  131. * Get all the PartStructures in the PartStructure. Iterators return a
  132. * set, one at a time.
  133. *
  134. * @return object PartStructureIterator
  135. *
  136. * @throws object RepositoryException An exception with one of
  137. * the following messages defined in
  138. * org.osid.repository.RepositoryException may be thrown: {@link }
  139. * org.osid.repository.RepositoryException#OPERATION_FAILED
  140. * OPERATION_FAILED}, {@link }
  141. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  142. * PERMISSION_DENIED}, {@link }
  143. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  144. * CONFIGURATION_ERROR}, {@link }
  145. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  146. * UNIMPLEMENTED}
  147. *
  148. * @access public
  149. */
  150. function getPartStructures() {
  151. $array = array();
  152. $obj = new HarmoniNodeIterator($array);
  153. return $obj; // @todo replace with HarmoniPartStructureIterator
  154. }
  155.  
  156. /**
  157. * Return true if this PartStructure is automatically populated by the
  158. * Repository; false otherwise. Examples of the kind of PartStructures
  159. * that might be populated are a time-stamp or the Agent setting the data.
  160. *
  161. * @return boolean
  162. *
  163. * @throws object RepositoryException An exception with one of
  164. * the following messages defined in
  165. * org.osid.repository.RepositoryException may be thrown: {@link }
  166. * org.osid.repository.RepositoryException#OPERATION_FAILED
  167. * OPERATION_FAILED}, {@link }
  168. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  169. * PERMISSION_DENIED}, {@link }
  170. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  171. * CONFIGURATION_ERROR}, {@link }
  172. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  173. * UNIMPLEMENTED}
  174. *
  175. * @access public
  176. */
  177. function isPopulatedByRepository() {
  178. return FALSE;
  179. }
  180.  
  181. /**
  182. * Return true if this PartStructure is mandatory; false otherwise.
  183. *
  184. * @return boolean
  185. *
  186. * @throws object RepositoryException An exception with one of
  187. * the following messages defined in
  188. * org.osid.repository.RepositoryException may be thrown: {@link }
  189. * org.osid.repository.RepositoryException#OPERATION_FAILED
  190. * OPERATION_FAILED}, {@link }
  191. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  192. * PERMISSION_DENIED}, {@link }
  193. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  194. * CONFIGURATION_ERROR}, {@link }
  195. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  196. * UNIMPLEMENTED}
  197. *
  198. * @access public
  199. */
  200. function isMandatory() {
  201. return TRUE;
  202. }
  203.  
  204. /**
  205. * Return true if this PartStructure is repeatable; false otherwise. This
  206. * is determined by the implementation.
  207. *
  208. * @return boolean
  209. *
  210. * @throws object RepositoryException An exception with one of
  211. * the following messages defined in
  212. * org.osid.repository.RepositoryException may be thrown: {@link }
  213. * org.osid.repository.RepositoryException#OPERATION_FAILED
  214. * OPERATION_FAILED}, {@link }
  215. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  216. * PERMISSION_DENIED}, {@link }
  217. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  218. * CONFIGURATION_ERROR}, {@link }
  219. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  220. * UNIMPLEMENTED}
  221. *
  222. * @access public
  223. */
  224. function isRepeatable() {
  225. return FALSE;
  226. }
  227.  
  228. /**
  229. * Get the RecordStructure associated with this PartStructure.
  230. *
  231. * @return object RecordStructure
  232. *
  233. * @throws object RepositoryException An exception with one of
  234. * the following messages defined in
  235. * org.osid.repository.RepositoryException may be thrown: {@link }
  236. * org.osid.repository.RepositoryException#OPERATION_FAILED
  237. * OPERATION_FAILED}, {@link }
  238. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  239. * PERMISSION_DENIED}, {@link }
  240. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  241. * CONFIGURATION_ERROR}, {@link }
  242. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  243. * UNIMPLEMENTED}
  244. *
  245. * @access public
  246. */
  247. function getRecordStructure() {
  248. return $this->_recordStructure;
  249. }
  250.  
  251. /**
  252. * Validate a Part against its PartStructure. Return true if valid; false
  253. * otherwise. The status of the Asset holding this Record is not changed
  254. * through this method. The implementation may throw an Exception for any
  255. * validation failures and use the Exception's message to identify
  256. * specific causes.
  257. *
  258. * @param object Part $part
  259. *
  260. * @return boolean
  261. *
  262. * @throws object RepositoryException An exception with one of
  263. * the following messages defined in
  264. * org.osid.repository.RepositoryException may be thrown: {@link }
  265. * org.osid.repository.RepositoryException#OPERATION_FAILED
  266. * OPERATION_FAILED}, {@link }
  267. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  268. * PERMISSION_DENIED}, {@link }
  269. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  270. * CONFIGURATION_ERROR}, {@link }
  271. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  272. * UNIMPLEMENTED}, {@link }
  273. * org.osid.repository.RepositoryException#NULL_ARGUMENT
  274. * NULL_ARGUMENT}
  275. *
  276. * @access public
  277. */
  278. function validatePart($part) {
  279. // we can check if the Part (ie, ValueVersions) has values of the right type.
  280. // @todo
  281. return true;
  282. }
  283. /*******************************************************
  284. * Authority Lists:
  285. * The OSID does not have any support for authority lists.
  286. * These methods could have been placed in another system,
  287. * but have been placed here for ease of locating them.
  288. * Also involved with Authority Lists is a SearchType:
  289. * Repository::edu.middlebury.harmoni::AuthorityValue
  290. * which takes a PartStructure Id and a Value to search on.
  291. *********************************************************/
  292.  
  293. /**
  294. * Answer the authoritative values for this part.
  295. *
  296. * WARNING: NOT in OSID
  297. *
  298. * @return object ObjectIterator
  299. * @access public
  300. * @since 4/25/06
  301. */
  302. function getAuthoritativeValues () {
  303. $array = array();
  304. $iterator = new HarmoniIterator($array);
  305. return $iterator;
  306. }
  307. /**
  308. * Answer true if the value pass is authoritative.
  309. *
  310. * WARNING: NOT in OSID
  311. *
  312. * @param object $value
  313. * @return boolean
  314. * @access public
  315. * @since 4/25/06
  316. */
  317. function isAuthoritativeValue ( $value ) {
  318. return false;
  319. }
  320. /**
  321. * Remove an authoritative value.
  322. *
  323. * WARNING: NOT in OSID
  324. *
  325. * @param object $value
  326. * @return void
  327. * @access public
  328. * @since 4/25/06
  329. */
  330. function removeAuthoritativeValue ( $value ) {
  331. }
  332. /**
  333. * Add an authoritative value
  334. *
  335. * WARNING: NOT in OSID
  336. *
  337. * @param object $value
  338. * @return void
  339. * @access public
  340. * @since 4/25/06
  341. */
  342. function addAuthoritativeValue ( $value ) {
  343. $false = false;
  344. return $false;
  345. }
  346. /**
  347. * Add an authoritative value
  348. *
  349. * WARNING: NOT in OSID
  350. *
  351. * @param string $valueString
  352. * @return void
  353. * @access public
  354. * @since 4/25/06
  355. */
  356. function addAuthoritativeValueAsString ( $valueString ) {
  357. }
  358. /**
  359. * Answer the Primative object appropriate for this part, whose value is
  360. * represented by the input string.
  361. *
  362. * @param string $valueString
  363. * @return object
  364. * @access public
  365. * @since 4/27/06
  366. */
  367. function createValueObjectFromString ( $valueString ) {
  368. $false = false;
  369. return $false;
  370. }
  371. }

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