Source for file XMLRepositoryFileImporter.class.php

Documentation is available at XMLRepositoryFileImporter.class.php

  1. <?php
  2. /**
  3. * @since 10/18/05
  4. * @package polyphony.importer
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: XMLRepositoryFileImporter.class.php,v 1.9 2007/09/19 14:04:47 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/Importer/XMLImporters/XMLImporter.class.php");
  13. require_once(POLYPHONY."/main/library/Importer/XMLImporters/XMLRepositoryImporter.class.php");
  14.  
  15. /**
  16. * XMLRepositoryFileImporter imports a repository via delegation to subclasses
  17. *
  18. * @since 10/18/05
  19. * @package polyphony.importer
  20. *
  21. * @copyright Copyright &copy; 2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  23. *
  24. * @version $Id: XMLRepositoryFileImporter.class.php,v 1.9 2007/09/19 14:04:47 adamfranco Exp $
  25. */
  26. class XMLRepositoryFileImporter extends XMLImporter {
  27.  
  28. /**
  29. * Constructor
  30. *
  31. *
  32. * @return object XMLRepositoryImporter
  33. * @access public
  34. * @since 10/5/05
  35. */
  36. function XMLRepositoryFileImporter ($existingArray) {
  37. parent::XMLImporter($existingArray);
  38. }
  39.  
  40. /**
  41. * Sets up importer's self-knowledge
  42. *
  43. * @access public
  44. * @since 10/5/05
  45. */
  46. function setupSelf () {
  47. $this->_childImporterList = array("XMLRepositoryImporter");
  48. $this->_childElementList = array("repository");
  49. $this->_info = array();
  50. }
  51.  
  52. /**
  53. * Filters nodes of incorrect type
  54. *
  55. * @param object DOMIT_Node
  56. * @return boolean
  57. * @static
  58. * @access public
  59. * @since 10/5/05
  60. */
  61. function isImportable ($element) {
  62. if($element->nodeName == "repositoryfile")
  63. return true;
  64. else
  65. return false;
  66. }
  67.  
  68.  
  69. /**
  70. * Organizes the import
  71. *
  72. * @param object mixed $topImporter is the importer instance that parsed the XML
  73. * @param object DOMIT_Node
  74. * @param string
  75. * @param object mixed
  76. * @param string
  77. * @return object HarmoniId
  78. * @access public
  79. * @since 10/5/05
  80. */
  81. function import ($topImporter, $node, $type, $parent) {
  82. $path = $node->getText();
  83. if (!ereg("^([a-zA-Z]+://|[a-zA-Z]+:\\|/)", $path))
  84. $path = $node->ownerDocument->xmlPath.$path;
  85. // @todo keep the topImporter passing down to new importer hierarchies!!!
  86. $imp = XMLRepositoryImporter::withFile($this->_existingArray, $path,
  87. $type);
  88. $imp->parseAndImport("asset");
  89. unset($imp);
  90. }
  91. }

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