Source for file JavaPOCIdManager.class.php

Documentation is available at JavaPOCIdManager.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/id/IdManager.php");
  4.  
  5. /**
  6. * IdManager creates and gets Ids. Ids are used in many different contexts
  7. * throughout the OSIDs. As with other Managers, use the OsidLoader to load
  8. * an implementation of this interface.
  9. *
  10. * <p>
  11. * All implementations of OsidManager (manager) provide methods for accessing
  12. * and manipulating the various objects defined in the OSID package. A manager
  13. * defines an implementation of an OSID. All other OSID objects come either
  14. * directly or indirectly from the manager. New instances of the OSID objects
  15. * are created either directly or indirectly by the manager. Because the OSID
  16. * objects are defined using interfaces, create methods must be used instead
  17. * of the new operator to create instances of the OSID objects. Create methods
  18. * are used both to instantiate and persist OSID objects. Using the
  19. * OsidManager class to define an OSID's implementation allows the application
  20. * to change OSID implementations by changing the OsidManager package name
  21. * used to load an implementation. Applications developed using managers
  22. * permit OSID implementation substitution without changing the application
  23. * source code. As with all managers, use the OsidLoader to load an
  24. * implementation of this interface.
  25. * </p>
  26. *
  27. * <p>
  28. * Unlike most Managers, IdManager does not have methods to return Type
  29. * information.
  30. * </p>
  31. *
  32. *
  33. * <p>
  34. * OSID Version: 2.0
  35. * </p>
  36. *
  37. * @package harmoni.osid_v2.id
  38. *
  39. * @copyright Copyright &copy; 2005, Middlebury College
  40. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  41. *
  42. * @version $Id: JavaPOCIdManager.class.php,v 1.7 2007/09/04 20:25:42 adamfranco Exp $
  43. */
  44.  
  45. class JavaPOCIdManager
  46. extends IdManager
  47. {
  48. var $_javaClassName;
  49. var $_javaClass;
  50. /**
  51. * Constructor.
  52. */
  53. function JavaPOCIdManager( $className ) {
  54. $this->_javaClassName = $className;
  55. $testClass = new Java($className);
  56. $ex = java_last_exception_get();
  57. if ($ex) die("Could not instantiate '$className' (Java): ".$ex->toString);
  58. java_last_exception_clear();
  59. $this->_javaClass =$testClass;
  60. }
  61.  
  62. /**
  63. * Create a new unique identifier.
  64. *
  65. * @return object Id
  66. *
  67. * @throws object IdException An exception with one of the following
  68. * messages defined in org.osid.id.IdException: {@link }
  69. * org.osid.id.IdException#OPERATION_FAILED OPERATION_FAILED},
  70. * {@link org.osid.id.IdException#PERMISSION_DENIED}
  71. * PERMISSION_DENIED}, {@link }
  72. * org.osid.id.IdException#CONFIGURATION_ERROR
  73. * CONFIGURATION_ERROR}, {@link }
  74. * org.osid.id.IdException#UNIMPLEMENTED UNIMPLEMENTED}
  75. *
  76. * @access public
  77. */
  78. function createId () {
  79. $result = $this->_javaClass->createId();
  80. $ex = java_last_exception_get();
  81. if ($ex) { java_last_exception_clear(); return $ex->toString(); }
  82. java_last_exception_clear();
  83. return $result;
  84. }
  85.  
  86. /**
  87. * Get the unique Id with this String representation or create a new unique
  88. * Id with this representation.
  89. *
  90. * @param string $idString
  91. *
  92. * @return object Id
  93. *
  94. * @throws object IdException An exception with one of the following
  95. * messages defined in org.osid.id.IdException: {@link }
  96. * org.osid.id.IdException#OPERATION_FAILED OPERATION_FAILED},
  97. * {@link org.osid.id.IdException#PERMISSION_DENIED}
  98. * PERMISSION_DENIED}, {@link }
  99. * org.osid.id.IdException#CONFIGURATION_ERROR
  100. * CONFIGURATION_ERROR}, {@link }
  101. * org.osid.id.IdException#UNIMPLEMENTED UNIMPLEMENTED}, {@link }
  102. * org.osid.id.IdException#NULL_ARGUMENT NULL_ARGUMENT}
  103. *
  104. * @access public
  105. */
  106. function getId ( $idString ) {
  107. $result = $this->_javaClass->getId($idString);
  108. $ex = java_last_exception_get();
  109. if ($ex) { java_last_exception_clear(); return $ex->toString(); }
  110. java_last_exception_clear();
  111. return $result;
  112. }
  113.  
  114. ?>

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