pax_global_header00006660000000000000000000000064122127216160014512gustar00rootroot0000000000000052 comment=8ecbc13807661cf69252028a38a6b2c802bb7d9c php-irods-3.3.0~beta1/000077500000000000000000000000001221272161600145355ustar00rootroot00000000000000php-irods-3.3.0~beta1/.gitignore000066400000000000000000000000771221272161600165310ustar00rootroot00000000000000.idea/ nbproject **/nbproject/* **/.svn .DS_Store **/.DS_Store php-irods-3.3.0~beta1/LICENSE.txt000066400000000000000000000062341221272161600163650ustar00rootroot00000000000000iRODS license terms and copyright info from the irods site at: https://www.irods.org/index.php/License License iRODS Copyright and Licensing iRODS is open source software released under a BSD License, see license text in "iRODS License Terms and Conditions" below. The BSD license has been described in very general terms as allowing you to do whatever you want to with the software and source code as long as you acknowledge who wrote it and that, as with any open source software, there is no warranty and you're using the code "as is." In the spirit of collaborative open source software, the iRODS community encourages you to communicate with us, letting us know what features you like, features that would be useful, problems, bugs, suggestions, etc., and to perhaps contribute source code. The iRODS community has formed the Data Intensive Cyberinfrastructure Foundation, a 501(c)(3) nonprofit corporation established to serve as the home of the iRODS open source community over the long term. If you choose to contribute new code, you'll receive full acknowledgment. All you do is complete the Contributor's Agreement, under which you retain copyright ownership in your code but give a free license to the iRODS nonprofit foundation, allowing your code to be integrated into iRODS and in turn released under the BSD license. Note: The above text is an educational overview of iRODS open source licensing, and not intended as legal advice nor is it part of the iRODS license agreement, which is below. As always, for legal advice consult an attorney. iRODS License Terms and Conditions Notice Copyright (c) 2005-2011, Regents of the University of California, the University of North Carolina, and the Data Intensive Cyberinfrastructure Foundation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the University of California, San Diego (UCSD) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.php-irods-3.3.0~beta1/PHPUnitTest/000077500000000000000000000000001221272161600166645ustar00rootroot00000000000000php-irods-3.3.0~beta1/PHPUnitTest/prods/000077500000000000000000000000001221272161600200135ustar00rootroot00000000000000php-irods-3.3.0~beta1/PHPUnitTest/prods/src/000077500000000000000000000000001221272161600206025ustar00rootroot00000000000000php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsConfig.inc.php000066400000000000000000000002061221272161600242760ustar00rootroot00000000000000php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsDirTest.php000066400000000000000000000501261221272161600237050ustar00rootroot00000000000000rodsAcct = new RODSAccount($this->host, $this->port, $this->user, $this->passwd, $this->zone); $this->rodsDirStats = new RODSDirStats($this->user, $this->user, $this->zone, $this->mtime, $this->ctime, $this->id, $this->comment); $this->prodsDir = new ProdsDir($this->rodsAcct, $this->path_str); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } public function testFromURI() { // ProdsDir::fromURI does not set password, so temporarilly get rid of it for this test $save_pass = $this->rodsAcct->pass; $this->rodsAcct->pass = ""; $uri = $this->user . "." . $this->zone . "@" . $this->host . ":" . $this->port . $this->path_str; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $this->path_str); // add verify and rodsDirStats $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $this->assertInstanceOf('ProdsDir', $prods_dir_stub->fromURI($uri)); $this->assertEquals($this->prodsDir, $prods_dir_stub->fromURI($uri)); $this->assertEquals($this->prodsDir, $prods_dir_stub->fromURI("rods://" . $uri)); // test query and fragment in uri $query_and_frag = "?arg=happy#joy"; $new_prods_dir = $prods_dir_stub->fromURI($uri . $query_and_frag); $expected = $this->path_str . $query_and_frag; $this->assertEquals($expected, $new_prods_dir->path_str); // reset rodsAcct password attribute $this->rodsAcct->pass = $save_pass; $uri = $this->user . "." . $this->zone . ":" . $this->passwd . "@" . $this->host . ":" . $this->port . $this->path_str; $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $this->assertEquals($this->prodsDir, $prods_dir_stub->fromURI($uri)); } public function testVerify() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // ProdsDir::verify is a protected function - cannot mock // perhaps can do this with reflection (change method to public) in >= php 5.3.2 $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $prods_dir_stub = $this->getMockForAbstractClass('ProdsDir', $mocked_prodsdir_construct_params); $meta_array = $prods_dir_stub->verify( array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); } public function testRewind() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // can't really test this one - no access to private variable "position" //$prods_dir = new stubProdsDir($this->rodsAcct, $this->path_str); //var_dump($prods_dir); //$prods_dir->rewind(); //$this->assertEquals(0, $prods_dir->getPosition()); } public function testGetNextChild() { $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsfile_construct_params = array(&$this->rodsAcct, $path . "/filename"); $mocked_prodschild_methods = array('exists'); $prods_dir_child = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsdir_construct_params); $prods_dir_child->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $prods_file_child = $this->getMock('ProdsFile', $mocked_prodschild_methods, $mocked_prodsfile_construct_params); $prods_file_child->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $dirs = array($prods_dir_child, $prods_file_child); $mocked_prodsdir_methods = array('getAllChildren'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->once())->method('getAllChildren')->will($this->returnValue($dirs)); $child = $prods_dir_stub->getNextChild(); $this->assertEquals($prods_dir_child, $child); $child = $prods_dir_stub->getNextChild(); $this->assertEquals($prods_file_child, $child); } public function testGetAllChildren() { $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsfile_construct_params = array(&$this->rodsAcct, $path . "/filename"); $mocked_prodschild_methods = array('exists'); $prods_file_child = $this->getMock('ProdsFile', $mocked_prodschild_methods, $mocked_prodsfile_construct_params); $prods_file_child->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $files = array($prods_file_child); $prods_dir_child = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsdir_construct_params); $prods_dir_child->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $dirs = array($prods_dir_child); $mocked_prodsdir_methods = array('getChildDirs', 'getChildFiles'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->once())->method('getChildDirs')->will($this->returnValue($dirs)); $prods_dir_stub->expects($this->once())->method('getChildFiles')->will($this->returnValue($files)); $children = $prods_dir_stub->getAllChildren(); $this->assertEquals($prods_file_child, $children[0]); $this->assertEquals($prods_dir_child, $children[1]); } public function testGetChildDirs() { // NEED TO ADD to this test to test parameters for sorting results // might need to write a stub for findDirs $path = "/path/tonowhere"; $path1 = "/path/tonowhere/zeta"; $path2 = "/path/tonowhere/alpha"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir1_construct_params = array(&$this->rodsAcct, $path1); $mocked_prodsdir2_construct_params = array(&$this->rodsAcct, $path2); $mocked_prodschild_methods = array('exists'); $prods_dir_child1 = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsdir1_construct_params); $prods_dir_child1->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $prods_dir_child2 = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsdir2_construct_params); $prods_dir_child2->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $dirs = array($prods_dir_child1, $prods_dir_child2); $mocked_prodsdir_methods = array('findDirs'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->once())->method('findDirs')->will($this->returnValue($dirs)); $children = $prods_dir_stub->getChildDirs(); $this->assertEquals($prods_dir_child1, $children[0]); $this->assertEquals($prods_dir_child2, $children[1]); } public function testGetChildFiles() { // NEED TO ADD to this test to test parameters for sorting results // might need to write a stub for findFiles $path = "/path/tonowhere"; $path1 = "/path/tonowhere/firstfile"; $path2 = "/path/tonowhere/lastfile"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsfile1_construct_params = array(&$this->rodsAcct, $path1); $mocked_prodsfile2_construct_params = array(&$this->rodsAcct, $path2); $mocked_prodschild_methods = array('exists'); $prods_file_child1 = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsfile1_construct_params); $prods_file_child1->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $prods_file_child2 = $this->getMock('ProdsDir', $mocked_prodschild_methods, $mocked_prodsfile2_construct_params); $prods_file_child2->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $files = array($prods_file_child1, $prods_file_child2); $mocked_prodsdir_methods = array('findFiles'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->once())->method('findFiles')->will($this->returnValue($files)); $children = $prods_dir_stub->getChildFiles(); $this->assertEquals($prods_file_child1, $children[0]); $this->assertEquals($prods_file_child2, $children[1]); } public function testMkdir() { $path = "/path/tonowhere"; $new_dir_name = "test_dir"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $new_dir = $prods_dir_stub->mkdir($new_dir_name, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); // test params to RODSConn:mkdir() $this->assertEquals($path . "/" . $new_dir_name, $params_array[0]); // test newly created ProdsDir is correct $expectedDir = new ProdsDir($this->rodsAcct, $path . "/" . $new_dir_name); $this->assertEquals($expectedDir, $new_dir); } public function testRmDir() { $path = "/path/tonowhere"; $rm_dir_name = "test_dir"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $empty_array = array(); $prods_dir_stub->rmdir(TRUE, FALSE, $empty_array, NULL, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); // test params to RODSConn:mkdir() $this->assertEquals($path, $params_array[0]); $this->assertEquals(TRUE, $params_array[1]); $this->assertEquals(FALSE, $params_array[2]); $this->assertEquals($empty_array, $params_array[3]); $this->assertEquals(NULL, $params_array[4]); } public function testGetStats() { $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $expected_stats = new RODSDirStats($path, $this->user, $this->zone, $this->mtime, $this->ctime, $this->id, $this->comment); $stats = $prods_dir_stub->getStats(false, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $this->assertEquals($expected_stats, $stats); // second run should exercise first if block in ProdsDir::getStats $stats = $prods_dir_stub->getStats(false, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $this->assertEquals($expected_stats, $stats); // run another test to force refresh of stats data $stats = $prods_dir_stub->getStats(true, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $this->assertEquals($expected_stats, $stats); } public function testQueryStatistics() { $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $stats = $prods_dir_stub->queryStatistics("num_dirs", true, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $actual_name = $params_array[0]->getNames(); $this->assertEquals("COL_COLL_ID", $actual_name[0]); $this->assertEquals(1, $stats); // FIX this broken test // $stats = $prods_dir_stub->queryStatistics("num_files", true, array('stubRODSConnManager', 'getConn'), // array('stubRODSConnManager', 'releaseConn')); // $params_array = stubRODSConn::getParams(); // $actual_name = $params_array[0]->getNames(); // $this->assertEquals("COL_D_DATA_ID", $actual_name[0]); // $this->assertEquals(2, $stats); try { $stats = $prods_dir_stub->queryStatistics("something_wrong", true, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } public function testFindFiles() { $path = "/path/tonowhere"; $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $terms = array("descendantOnly" => true, "recursive" => false, "logicalFile" => false); $total_count = -1; $stats = $prods_dir_stub->findFiles($terms, $total_count, 0, -1, array("name"), array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); // check total count return $this->assertEquals(1, $total_count); // test limiting number of results to 0 $prods_dir_stub->findFiles($terms, $total_count, 0, 0, array(), array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $this->assertEquals(0, $total_count); // test that all search conditions ($terms) are specified correctly in params to RODSConn:query() // 'name' (string) - partial name of the target (file or dir) // 'descendantOnly' (boolean) - whether to search among this directory's decendents. default is false. // 'recursive' (boolean) - whether to search recursively, among all decendents and their children. default is false. This option only works when 'descendantOnly' is true // 'logicalFile' (boolean) - whether to return logical file, instead of all replicas for each file. if true, the resource name for each file will be null, instead, num_replicas will be provided. default is false. // 'smtime' (int) - start last-modified-time in unix timestamp. The specified time is included in query, in other words the search can be thought was "mtime >= specified time" // 'emtime' (int) - end last-modified-time in unix timestamp. The specified time is not included in query, in other words the search can be thought was "mtime < specified time" // 'owner' (string) - owner name of the file // 'rescname' (string) - resource name of the file $terms = array("name" => "test"); $prods_dir_stub->findFiles($terms, $total_count, 0, -1, array(), array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $cond = $params_array[1]->getCond(); // test all sort conditions ($sort_flds) are specified correctly in params to RODSConn:query() // 'name' - name of the file or dir // 'size' - size of the file // 'mtime' - last modified time // 'ctime' - creation time // 'owner' - owner of the file // 'typename' - file/data type // 'dirname' - directory/collection name for the file // var_dump($stats); // $params_array = stubRODSConn::getParams(); // var_dump($params_array); // $params_array = stubRODSConn::getParams(); // $actual_name = $params_array[0]->getNames(); // $this->assertEquals("COL_COLL_ID", $actual_name[0]); // $this->assertEquals(1, $stats); } public function testFindDirs() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } //This could be used to test getChildFiles and getChildDirs class stubFindDirs extends ProdsDir { public function __construct(RODSAccount $account, $path_str, $verify=false, RODSDirStats $stats=NULL) { parent::__construct($account, $path_str, $verify, $stats); } public function findDirs(array $terms, $total_count, $start=0, $limit=-1, array $sort_flds=array()) { return $sort_flds; } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsPathTest.php000066400000000000000000000313471221272161600240670ustar00rootroot00000000000000rodsAcct = new RODSAccount($this->host, $this->port, $this->user, $this->passwd, $this->zone); $this->rodsMeta = new RODSMeta("test_meta", "this is a test meta"); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement test__toString(). */ public function test__toString() { $path = "/path/tonowhere"; $expected = $this->user . "." . $this->zone . ":(password hidden)@" . $this->host . ":" . $this->port . $path; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals($expected, $prods_path_stub->__toString()); } /** * @todo Implement testExists(). */ public function testExists() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $path = "/path/tonowhere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); //$prods_path_stub->expects($this->any())->method('verify')->will($this->returnValue($path)); $this->assertEquals(NULL, $prods_path_stub->exists()); // need to figure out how to test this path of the code - cannot seem to access protected property path_exists //$prods_path_stub->path_exists = $path; $this->assertEquals($path, $prods_path_stub->exists()); } /** * @todo Implement testGetMeta(). */ public function testGetMeta() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $path = "/path/tonowhere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsDir'); $meta_array = $prods_path_stub->getMeta( array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $this->assertEquals("this is a test of metadata", $meta_array[0]); try { $ti_class = new testInstanceOf($this->rodsAcct, $this->path_str); $ti_class->getMeta(); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } /** * @todo Implement testUpdateMeta(). */ public function testUpdateMeta() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testAddMeta(). */ public function testAddMeta() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $path = "/path/tonowhere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsDir'); $prods_path_stub->addMeta( $this->rodsMeta, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $this->assertEquals("c", $params_array[0]); $this->assertEquals($path, $params_array[1]); $this->assertEquals($this->rodsMeta, $params_array[2]); try { $ti_class = new testInstanceOf($this->rodsAcct, $this->path_str); $ti_class->addMeta($this->rodsMeta); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } /** * @todo Implement testRmMeta(). */ public function testRmMeta() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $path = "/path/tohere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsFile'); $prods_path_stub->rmMeta( $this->rodsMeta, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $this->assertEquals("d", $params_array[0]); $this->assertEquals($path, $params_array[1]); $this->assertEquals($this->rodsMeta, $params_array[2]); try { $ti_class = new testInstanceOf($this->rodsAcct, $this->path_str); $ti_class->rmMeta($this->rodsMeta); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } /** * @todo Implement testRmMetaByID(). */ public function testRmMetaByID() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $test_id = "test_meta"; $path = "/path/tohere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsFile'); $prods_path_stub->rmMetaByID( $test_id, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $this->assertEquals("d", $params_array[0]); $this->assertEquals($path, $params_array[1]); $this->assertEquals($test_id, $params_array[2]); try { $ti_class = new testInstanceOf($this->rodsAcct, $this->path_str); $ti_class->rmMetaByID($test_id); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } /** * @todo Implement testCpMeta(). */ public function testCpMeta() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $path = "/path/tonowhere"; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $mocked_prodsdir_construct_params = array(&$this->rodsAcct, $this->path_str); $mocked_prodsdir_methods = array('exists'); $prods_dir_stub = $this->getMock('ProdsDir', $mocked_prodsdir_methods, $mocked_prodsdir_construct_params); $prods_dir_stub->expects($this->any())->method('exists')->will($this->returnValue(TRUE)); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsDir'); $prods_path_stub->cpMeta( $prods_dir_stub, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $this->assertEquals("c", $params_array[0]); $this->assertEquals("c", $params_array[1]); $this->assertEquals($path, $params_array[2]); $this->assertEquals($path, $params_array[3]); try { $ti_class = new testInstanceOf($this->rodsAcct, $this->path_str); $ti_class->cpMeta($prods_dir_stub); } catch(RODSException $ex) { return; } $this->fail("An expected exception has not been raised"); } /** * @todo Implement testRename(). */ public function testRename() { $path = "/path/tohere"; $new_ppath = "/path"; $new_name = "to_new_here"; $new_path = $new_ppath . "/" . $new_name; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params, 'ProdsFile1'); $prods_path_stub->rename( $new_path, array('stubRODSConnManager', 'getConn'), array('stubRODSConnManager', 'releaseConn')); $params_array = stubRODSConn::getParams(); $this->assertEquals($path, $params_array[0]); $this->assertEquals($new_path, $params_array[1]); // PROBABLY SHOULD ALSO ADD TEST FOR INSTANCE OF PRODSFILE PATH (params_array[2] = "0") IN METHOD SOURCE CODE $this->assertEquals("1", $params_array[2]); $this->assertEquals($new_path, $prods_path_stub->getPath()); $this->assertEquals($new_ppath, $prods_path_stub->getParentPath()); $this->assertEquals($new_name, $prods_path_stub->getName()); } /** * @todo Implement testGetName(). */ public function testGetName() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); $base = "/path/"; $name = "tonowhere"; $path = $base . $name; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals($name, $prods_path_stub->getName()); } /** * @todo Implement testGetPath(). */ public function testGetPath() { $base = "/path/"; $name = "tonowhere"; $path = $base . $name; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals($path, $prods_path_stub->getPath()); } /** * @todo Implement testGetParentPath(). */ public function testGetParentPath() { $nopath ="/"; $base = "/path"; $name = "/tonowhere"; $path = $base . $name; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $nopath); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals(NULL, $prods_path_stub->getParentPath()); $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals($base, $prods_path_stub->getParentPath()); } /** * @todo Implement testToURI(). */ public function testToURI() { $base = "/path/"; $name = "tonowhere"; $path = $base . $name; $expected = $this->user . "." . $this->zone . "@" . $this->host . ":" . $this->port . $path; $mocked_prodspath_construct_params = array(&$this->rodsAcct, $path); $prods_path_stub = $this->getMockForAbstractClass('ProdsPath', $mocked_prodspath_construct_params); $this->assertEquals($expected, $prods_path_stub->toURI()); } } class testInstanceOf extends ProdsPath { public function __construct(RODSAccount &$account, $path_str) { parent::__construct($account, $path_str); } public function verify() { } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsQueryTest.php000066400000000000000000000030361221272161600242720ustar00rootroot00000000000000markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetMetadataNamesForAllDirs(). */ public function testGetMetadataNamesForAllDirs() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetResources(). */ public function testGetResources() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsRuleTest.php000066400000000000000000000016501221272161600240740ustar00rootroot00000000000000markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/ProdsStreamerTest.php000066400000000000000000000103611221272161600247460ustar00rootroot00000000000000object = new ProdsStreamer; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testDir_opendir(). */ public function testDir_opendir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDir_readdir(). */ public function testDir_readdir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDir_rewinddir(). */ public function testDir_rewinddir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDir_closedir(). */ public function testDir_closedir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_open(). */ public function testStream_open() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_read(). */ public function testStream_read() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_write(). */ public function testStream_write() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_tell(). */ public function testStream_tell() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_eof(). */ public function testStream_eof() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_stat(). */ public function testStream_stat() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_seek(). */ public function testStream_seek() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_flush(). */ public function testStream_flush() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testStream_close(). */ public function testStream_close() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSAccountTest.php000066400000000000000000000341471221272161600242500ustar00rootroot00000000000000rodsAcct = new RODSAccount( $this->host, $this->port, $this->name, $this->passwd, $this->zone, $this->resc, $this->auth_type, $this->ticket); } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { unset($this->rodsAcct); } /** * @todo Implement testFromURI(). */ public function testFromURI() { // empty uri $this->rodsAcct = $this->rodsAcct->fromURI(""); $this->assertEquals("", $this->rodsAcct->user); //invalid format uri $this->rodsAcct = $this->rodsAcct->fromURI("wrongformat"); $this->assertEquals("", $this->rodsAcct->user); //valid uri $this->rodsAcct = $this->rodsAcct->fromURI("notme.myZone@myirods.myhost.mycom:1111/myZone/home/notme"); $this->assertEquals("notme", $this->rodsAcct->user); } /** * @todo Implement testEquals(). */ public function testEquals() { $newAcct = new RODSAccount("another_irods.notmyhost.mmm", "1112", "notme", "mememe", "notmyZone"); $this->assertEquals(FALSE, $this->rodsAcct->Equals($newAcct)); $newAcct = new RODSAccount($this->host, $this->port, $this->name, $this->passwd, $this->zone); $this->assertEquals(TRUE, $this->rodsAcct->Equals($newAcct)); } /** * @todo Implement testGetSignature(). */ public function testGetSignature() { // test_ret value should be 'd84456497b1b340d8f4f751d36fd2d8d' $expected_ret = bin2hex(md5("$this->name.$this->zone:this->pass@$this->host:$this->port.$this->ticket", TRUE)); $actual_ret = $this->rodsAcct->getSignature(); //$this->assertEquals($expected_ret, $actual_ret, TRUE); $this->assertEquals($expected_ret, $actual_ret); } /** * @todo Implement test__toString(). */ public function test__toString() { $expected = $this->name . "." . $this->zone . ":(password hidden)@" . $this->host . ":" . $this->port; //$this->assertEquals("me.myZone:(password hidden)@myirods.myhost.mycom:1111", $this->rodsAcct->__toString()); $this->assertEquals($expected, $this->rodsAcct->__toString()); } /** * @todo Implement testToURI(). */ public function testToURI() { $expected = $this->name . "." . $this->zone . "@" . $this->host . ":" . $this->port; //$this->assertEquals($this->rodsAcct->toURI(), "me.myZone@myirods.myhost.mycom:1111"); $this->assertEquals($expected, $this->rodsAcct->toURI()); // also add test for when zone is empty } /** * @todo Implement testGetUserInfo(). */ public function testGetUserInfo() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?) // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead // set up mock parameters $retval = stubGetUserInfo(); $mocked_rodsconn_methods = array('getUserInfo'); $mocked_rodsconn_construct_params = array(&$this->rodsAcct); $mocked_rodsaccount_methods = array('getRODSConnection'); $mocked_rodsaccount_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone); // need to stub out RODSAccount methods getRODSConnection and releaseRODSConnection // getRODS connection stub must return mocked RODSConn object // first mock RODSConn $conn_stub = $this->getMock('RODSConn', $mocked_conn_methods, $mocked_rodsconn_construct_params, 'RODSConnMock'); $conn_stub->expects($this->any())->method('getUserInfo')->will($this->returnValue($retval)); $acct_stub = $this->getMock('RODSAccount', $mocked_rodsaccount_methods, $mocked_rodsaccount_construct_params, 'RODSAccountMock'); $acct_stub->expects($this->any())->method('getRODSConnection')->will($this->returnValue($conn_stub)); // now setup mock for RODSConnManager //$conn_mgr_stub = $this->getMock('RODSConnManager', $mocked_rodsconnmanager_methods, $mocked_rodsconnmanager_construct_params, 'RODSConnManagerMock'); //$conn_mgr_stub->staticExpects($this->any())->method('getConn')->with($mocked_rodsconnmanager_getconn_params)->will($this->returnValue($retval)); //set up overload for constructors set_new_overload(array($this, 'newCallback')); // now run actual tests //var_dump($acct_stub); $this->assertEmpty($acct_stub->getRODSConnection()); unset_new_overload(); } /** * @todo Implement testGetTempPassword(). */ public function testGetTempPassword() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetUserHomeDir(). */ public function testGetUserHomeDir() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?) // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead // need to get fake info from getUserInfo() // test with/without $init_path set // need to Mock ProdsDir and method exists() // ProdsDir has 2 constructor args: // (RODSAccount &$account, $path_str, $verify=false, RODSDirStats $stats=NULL) // set up mock parameters $retval = $this->stubGetUserInfo(); $mocked_rodsacct_methods = array('getUserInfo'); $mocked_rodsacct_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone); $acct_stub = $this->getMock('RODSAccount', $mocked_rodsacct_methods, $mocked_rodsacct_construct_params); $acct_stub->expects($this->once())->method('getUserInfo')->will($this->returnValue($retval)); //set up overload for constructors set_new_overload(array($this, 'newCallback')); // now run actual tests // test null zone code path and init_zone not set $acct_stub->zone = null; $p = $acct_stub->getUserHomeDir(); $this->assertEquals("//home/". $this->name, $p->path_str); // test what path is taken when zone is not null and when init_path is set $acct_stub->expects($this->never())->method('getUserInfo')->will($this->returnValue($retval)); $acct_stub->zone = $this->zone; $init_val = "/thiszone/testhome/me"; $p = $acct_stub->getUserHomeDir($init_val); $this->assertEquals($init_val, $p->path_str); unset_new_overload(); } /** * @todo Implement testGetUserHomeDirURI(). */ public function testGetUserHomeDirURI() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?) // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead // set up mock parameters $retval = $this->stubGetUserInfo(); $mocked_rodsacct_methods = array('getUserInfo'); $mocked_rodsacct_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone); $acct_stub = $this->getMock('RODSAccount', $mocked_rodsacct_methods, $mocked_rodsacct_construct_params); $acct_stub->expects($this->any())->method('getUserInfo')->will($this->returnValue($retval)); //set up overload for constructors set_new_overload(array($this, 'newCallback')); // now run actual tests $p = $acct_stub->getUserHomeDirURI(); $expected = $this->name . "." . $acct_stub->zone . "@" . $acct_stub->host . ":" . $acct_stub->port . "/" . $acct_stub->zone . "/home/" . $acct_stub->user; $this->assertEquals($expected, $p); $init_val = "/thiszone/testhome/me"; $p = $acct_stub->getUserHomeDirURI($init_val); $expected = $this->name . "." . $acct_stub->zone . "@" . $acct_stub->host . ":" . $acct_stub->port . $init_val; $this->assertEquals($expected, $p); unset_new_overload(); } /** * @todo Implement testGetUserTrashDir(). */ public function testGetUserTrashDir() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?) // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead // set up mock parameters $retval = $this->stubGetUserInfo(); $mocked_rodsacct_methods = array('getUserInfo'); $mocked_rodsacct_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone); $acct_stub = $this->getMock('RODSAccount', $mocked_rodsacct_methods, $mocked_rodsacct_construct_params); $acct_stub->expects($this->once())->method('getUserInfo')->will($this->returnValue($retval)); //set up overload for constructors set_new_overload(array($this, 'newCallback')); // now run actual tests // test getUserInfo() is called when zone is null $acct_stub->zone = null; $p = $acct_stub->getUserTrashDir(); $this->assertInstanceOf("stubProdsDir", $p); $this->assertEquals("//trash/home/" . $acct_stub->user, $p->path_str); // test what path is taken when zone is not null $acct_stub->zone = $this->zone; $acct_stub->expects($this->never())->method('getUserInfo')->will($this->returnValue($retval)); $p = $acct_stub->getUserTrashDir(); $this->assertInstanceOf("stubProdsDir", $p); $this->assertEquals("/" . $acct_stub->zone . "/trash/home/" . $acct_stub->user, $p->path_str); unset_new_overload(); } /** * @todo Implement testGetUserTrashDirURI(). */ public function testGetUserTrashDirURI() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); // THIS TEST NEEDS TO BE FIXED - it causes a segmentation violation on Hudson (different PHP version?) // No RODSConnMOck defined? Or perhaps need to use stubRODSConn instead // set up mock parameters $retval = $this->stubGetUserInfo(); $mocked_rodsacct_methods = array('getUserInfo'); $mocked_rodsacct_construct_params = array($this->host, $this->port, $this->name, $this->passwd, $this->zone); $acct_stub = $this->getMock('RODSAccount', $mocked_rodsacct_methods, $mocked_rodsacct_construct_params); $acct_stub->expects($this->once())->method('getUserInfo')->will($this->returnValue($retval)); //set up overload for constructors set_new_overload(array($this, 'newCallback')); // now run actual tests $acct_stub->zone = null; $p = $acct_stub->getUserTrashDirURI(); $expected = $acct_stub->user . "@" . $acct_stub->host . ":" . $acct_stub->port . "//trash/home/" . $acct_stub->user; $this->assertEquals($expected, $p); // noew test with zone set - getUserInfo() should never be called $acct_stub->zone = $this->zone; $acct_stub->expects($this->never())->method('getUserInfo')->will($this->returnValue($retval)); $p = $acct_stub->getUserTrashDirURI(); $expected = $acct_stub->user . "." . $acct_stub->zone . "@" . $acct_stub->host . ":" . $acct_stub->port . "/" . $acct_stub->zone . "/trash/home/" . $acct_stub->user; $this->assertEquals($expected, $p); unset_new_overload(); } protected function newCallback($className) { switch($className) { case 'RODSConn': return RODSConnMock; case 'ProdsDir': return stubProdsDir; default: return $className; } } protected function stubGetUserInfo() { // set up mock parameters $retval = array(); $retval['id'] = "1"; $retval['name'] = $this->name; $retval['type'] = $this->type; $retval['zone'] = $this->zone; $retval['dn'] = $this->dn; $retval['info'] = $this->info; $retval['comment'] = $this->comment; $retval['ctime'] = $this->ctime; $retval['mtime'] = $this->mtime; return $retval; } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSConnManagerTest.php000066400000000000000000000024021221272161600250310ustar00rootroot00000000000000object = new RODSConnManager; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testGetConn(). */ public function testGetConn() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testReleaseConn(). */ public function testReleaseConn() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSConnTest.php000066400000000000000000000265351221272161600235530ustar00rootroot00000000000000markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testEquals(). */ public function testEquals() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetSignature(). */ public function testGetSignature() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testLock(). */ public function testLock() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testUnlock(). */ public function testUnlock() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testIsIdle(). */ public function testIsIdle() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetId(). */ public function testGetId() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testSetId(). */ public function testSetId() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetAccount(). */ public function testGetAccount() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testConnect(). */ public function testConnect() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDisconnect(). */ public function testDisconnect() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetTempPassword(). */ public function testGetTempPassword() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetKeyForTempPassword(). */ public function testGetKeyForTempPassword() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetUserInfo(). */ public function testGetUserInfo() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testMkdir(). */ public function testMkdir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRmdir(). */ public function testRmdir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetChildDir(). */ public function testGetChildDir() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetChildDirWithStats(). */ public function testGetChildDirWithStats() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetChildFile(). */ public function testGetChildFile() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetChildFileWithStats(). */ public function testGetChildFileWithStats() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetDirStats(). */ public function testGetDirStats() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetFileStats(). */ public function testGetFileStats() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testDirExists(). */ public function testDirExists() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFileExists(). */ public function testFileExists() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRepl(). */ public function testRepl() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRename(). */ public function testRename() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testOpenFileDesc(). */ public function testOpenFileDesc() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFileUnlink(). */ public function testFileUnlink() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testCloseFileDesc(). */ public function testCloseFileDesc() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFileRead(). */ public function testFileRead() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFileWrite(). */ public function testFileWrite() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFileSeek(). */ public function testFileSeek() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetMeta(). */ public function testGetMeta() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testAddMeta(). */ public function testAddMeta() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRmMeta(). */ public function testRmMeta() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRmMetaByID(). */ public function testRmMetaByID() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testCpMeta(). */ public function testCpMeta() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testExecUserRule(). */ public function testExecUserRule() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGenQuery(). */ public function testGenQuery() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testQuery(). */ public function testQuery() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSExceptionTest.php000066400000000000000000000051301221272161600246000ustar00rootroot00000000000000markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetCodeAbbr(). */ public function testGetCodeAbbr() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRodsErrCodeToAbbr(). */ public function testRodsErrCodeToAbbr() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testRodsErrAbbrToCode(). */ public function testRodsErrAbbrToCode() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetStackTrace(). */ public function testGetStackTrace() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testShowStackTrace(). */ public function testShowStackTrace() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test__toString(). */ public function test__toString() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSGenQueCondsTest.php000066400000000000000000000030131221272161600250130ustar00rootroot00000000000000object = new RODSGenQueConds; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testAdd(). */ public function testAdd() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testPacketize(). */ public function testPacketize() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testPacketizeKW(). */ public function testPacketizeKW() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSGenQueResultsTest.php000066400000000000000000000041111221272161600254060ustar00rootroot00000000000000object = new RODSGenQueResults; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testAddResults(). */ public function testAddResults() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetValues(). */ public function testGetValues() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetTotalCount(). */ public function testGetTotalCount() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetNumCol(). */ public function testGetNumCol() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetNumRow(). */ public function testGetNumRow() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSGenQueSelFldsTest.php000066400000000000000000000051351221272161600253100ustar00rootroot00000000000000object = new RODSGenQueSelFlds; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testAdd(). */ public function testAdd() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testUpdate(). */ public function testUpdate() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testAttr2GenQueNumber(). */ public function testAttr2GenQueNumber() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testPacketize(). */ public function testPacketize() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetIndexes(). */ public function testGetIndexes() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetAttrs(). */ public function testGetAttrs() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetCount(). */ public function testGetCount() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSKeyValPairTest.php000066400000000000000000000030161221272161600246520ustar00rootroot00000000000000object = new RODSKeyValPair; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testAddPair(). */ public function testAddPair() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testMakePacket(). */ public function testMakePacket() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFromPacket(). */ public function testFromPacket() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSMessageTest.php000066400000000000000000000044421221272161600242330ustar00rootroot00000000000000object = new RODSMessage; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testPack(). */ public function testPack() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testUnpack(). */ public function testUnpack() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetBody(). */ public function testGetBody() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetBinstr(). */ public function testGetBinstr() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testGetXML(). */ public function testGetXML() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testPackConnectMsg(). */ public function testPackConnectMsg() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/RODSQueryConditionTest.php000066400000000000000000000017221221272161600256210ustar00rootroot00000000000000markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/autoload.inc.php000066400000000000000000000021041221272161600236700ustar00rootroot00000000000000read())) { if($folder != "." && $folder != "..") { if(is_dir(CLASS_DIR.$sub.$folder)) { $subFolder = classFolder($className, $sub.$folder."/"); if($subFolder) return $subFolder; } } } $dir->close(); return false; } ?>php-irods-3.3.0~beta1/PHPUnitTest/prods/src/packet/000077500000000000000000000000001221272161600220515ustar00rootroot00000000000000php-irods-3.3.0~beta1/PHPUnitTest/prods/src/packet/RODSPacketTest.php000066400000000000000000000044371221272161600253310ustar00rootroot00000000000000object = new RODSPacket; } /** * Tears down the fixture, for example, closes a network connection. * This method is called after a test is executed. */ protected function tearDown() { } /** * @todo Implement testToXML(). */ public function testToXML() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testParseXML(). */ public function testParseXML() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testFromSXE(). */ public function testFromSXE() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement testToDOMElement(). */ public function testToDOMElement() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test__get(). */ public function test__get() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } /** * @todo Implement test__set(). */ public function test__set() { // Remove the following lines when you implement this test. $this->markTestIncomplete( 'This test has not been implemented yet.' ); } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/stubProdsDir.class.php000066400000000000000000000025141221272161600250450ustar00rootroot00000000000000account->user. (empty($this->account->zone)?'':'.'.$this->account->zone). "@".$this->account->host.":".$this->account->port; return ($retval.$this->path_str); } public function getPosition() { return $this->position; } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/stubRODSConn.class.php000066400000000000000000000126711221272161600247110ustar00rootroot00000000000000meta_array; } public function addMeta($pathtype, $name, RODSMeta $meta) { //parent::addMeta($pathtype, $name, $meta); stubRODSConn::$params = array($pathtype, $name, $meta); } public function rmMeta($pathtype, $name, RODSMeta $meta) { //parent::rmMeta($pathtype, $name, $meta); stubRODSConn::$params = array($pathtype, $name, $meta); } public function rmMetaByID($pathtype, $name, $metaid) { //parent::rmMetaByID($pathtype, $name, $metaid); stubRODSConn::$params = array($pathtype, $name, $metaid); } public function cpMeta($pathtype_src, $pathtype_dest, $name_src, $name_dest) { //parent::cpMeta($pathtype_src, $pathtype_dest, $name_src, $name_dest); stubRODSConn::$params = array($pathtype_src, $pathtype_dest, $name_src, $name_dest); } public function rename($path_src, $path_dest, $path_type) { //parent::rename($path_src, $path_dest, $path_type); stubRODSConn::$params = array($path_src, $path_dest, $path_type); } public function mkdir($dir) { //parent::rename($path_src, $path_dest, $path_type); stubRODSConn::$params = array($dir); } public function rmdir($dirpath,$recursive=true,$force=false, $additional_flags=array(), $status_update_func=null) { stubRODSConn::$params = array($dirpath, $recursive, $force, $additional_flags, $status_update_func); } public function getDirStats($dirpath) { $stats = new RODSDirStats($dirpath, "me", "myZone", "01298479459", "01298479459", "1", "foo"); return $stats; // parent::getDirStats($dirpath); } public function query(RODSGenQueSelFlds $select, RODSGenQueConds $condition, $start = 0, $limit =-1) { //parent::query($select, $condition, $start, $limit); stubRODSConn::$params = array($select, $condition, $start, $limit); $name_array = array("/myZone"); $owner_array = array("me"); $zone_array = array("myZone"); $create_array = array("01298479459"); $modify_array = array("01298479459"); $comment_array = array("foo"); $names = $select->getNames(); if(array_search("COL_D_DATA_ID", $names)) { //this is a file stats request - 2 files $id_array = array("2"); $dname_array = array("first_file.txt"); $dtype_array = array("generic"); $dresc_array = array("testResc"); $dsize_array = array("1020157"); $result_array = array( "COL_DATA_NAME" => $dname_array, "COL_COLL_NAME" => $name_array, "COL_D_DATA_ID" => $id_array, "COL_DATA_TYPE_NAME" => $dtype_array, "COL_D_RESC_NAME" => $dresc_array, "COL_DATA_SIZE" => $dsize_array, "COL_D_OWNER_NAME" => $owner_array, "COL_D_OWNER_ZONE" => $zone_array, "COL_D_CREATE_TIME" => $create_array, "COL_D_MODIFY_TIME" => $modify_array, "COL_D_COMMENTS" => $comment_array ); } else { // this is a dirs stats request - 1 directory $name_array = array("/myZone"); $id_array = array("1"); $owner_array = array("me"); $zone_array = array("myZone"); $create_array = array("01298479459"); $modify_array = array("01298479459"); $comment_array = array("foo"); $result_array = array( "COL_COLL_NAME" => $name_array, "COL_COLL_ID" => $id_array, "COL_COLL_OWNER_NAME", $owner_array, "COL_COLL_OWNER_ZONE" => $zone_array, "COL_COLL_CREATE_TIME" => $create_array, "COL_COLL_MODIFY_TIME" => $modify_array, "COL_COLL_COMMENTS" => $comment_array ); } if($limit == -1) { $total = 1; } else { $total = $limit; } $results = new RODSGenQueResults($total, $result_array); return $results; } public function dirExists($dir) { parent::dirExists($dir); } public static function getParams() { return stubRODSConn::$params; } } ?> php-irods-3.3.0~beta1/PHPUnitTest/prods/src/stubRODSConnManager.class.php000066400000000000000000000014051221272161600261750ustar00rootroot00000000000000 php-irods-3.3.0~beta1/prods/000077500000000000000000000000001221272161600156645ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/doc_config.ini000066400000000000000000000063351221272161600204660ustar00rootroot00000000000000;; phpDocumentor demonstration parse configuration file ;; ;; RUN THIS FILE FROM THE INSTALL DIRECTORY ;; CHANGE HERE: ;; where should the documentation be written? ;; legal values: a legal path ;target = /home/CelloG/output target = ./doc ;; DONT CHANGE BELOW HERE ;; ;; This file is designed to cut down on repetitive typing on the command-line or web interface ;; You can copy this file to create a number of configuration files that can be used with the ;; command-line switch -c, as in phpdoc -c default.ini or phpdoc -c myini.ini. The web ;; interface will automatically generate a list of .ini files that can be used. ;; ;; ALL .ini files must be in the user subdirectory of phpDocumentor with an extension of .ini ;; ;; Copyright 2002, Greg Beaver ;; ;; WARNING: do not change the [Parse Data] ;; title of all the documentation ;; legal values: any string title = PRODS (iRODS PHP Client API) Documentation ;; parse files that start with a . like .bash_profile ;; legal values: true, false hidden = false ;; show elements marked @access private in documentation by setting this to on ;; legal values: on, off parseprivate = off ;; parse with javadoc-like description (first sentence is always the short description) ;; legal values: on, off javadocdesc = on ;target=/dev/null ;; add any custom @tags separated by commas here ;; legal values: any legal tagname separated by commas. ;customtags = mytag1,mytag2 ;; what is the main package? ;; legal values: alphanumeric string plus - and _ defaultpackagename = Prods ;; output any parsing information? set to on for cron jobs ;; legal values: on ;quiet = on ;; limit output to the specified packages, even if others are parsed ;; legal values: package names separated by commas ;packageoutput = package1,package2 ;; comma-separated list of files to parse ;; legal values: paths separated by commas ;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory ;; comma-separated list of directories to parse ;; legal values: directory paths separated by commas ;directory = /path1,/path2,.,..,subdirectory ;directory = /home/jeichorn/cvs/pear ;directory = /you-MUST/change-me/to-fit/your-environment ;directory = . directory = ./src,./tutorials ;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore ;; legal values: any wildcard strings separated by commas ;; remember, this pathing is RELATIVE to the top-most directory in your "directory" value ;ignore = path/to/ignore*,*list.php,myfile.php,subdirectory/ ignore = templates_c/,*HTML/default/*,spec/,*.inc.php,packet/,set*.php,ProdsStreamer.class.php,RODSMessage.class.php,RODSConn.class.php,RODSKeyValPair.class.php,RODSConnManager.class.php ;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format ;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib ;; HTML:frames:phpedit,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de ;; HTML:Smarty:default,HTML:Smarty:PHP,PDF:default:default,CHM:default:default,XML:DocBook:default output=HTML:Smarty:PHP ;; turn this option on if you want highlighted source code for every file ;; legal values: on/off sourcecode = on php-irods-3.3.0~beta1/prods/release_notes.txt000066400000000000000000000013471221272161600212620ustar00rootroot00000000000000 *'''Project''': PHP Prods API for iRODS *'''Date''': 06/04/2013 *'''Release Version''': 3.3.0-beta1 *'''git tag''': 3.3.0-beta1 ==News== PHP API for iRODS This alpha is a merge of community supported additions for PAM and tickets GForge for iDrop-swing is at: [[https://code.renci.org/gf/project/irodsphp/]] ==Requirements== Note that the following bug and feature requests are logged in GForge with related commit information [[https://code.renci.org/gf/project/irodsphp/tracker/]] ==Features== *[#1280] Add PAM support to PHP *[#1122] Add Ticket support to PHP ==Bug Fixes== ==Outstanding Issues== Please consult [[https://code.renci.org/gf/project/irodsphp/tracker/]] for the latest open bugs and Jargon feature requests php-irods-3.3.0~beta1/prods/src/000077500000000000000000000000001221272161600164535ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/src/LICENSE.txt000066400000000000000000000062341221272161600203030ustar00rootroot00000000000000iRODS license terms and copyright info from the irods site at: https://www.irods.org/index.php/License License iRODS Copyright and Licensing iRODS is open source software released under a BSD License, see license text in "iRODS License Terms and Conditions" below. The BSD license has been described in very general terms as allowing you to do whatever you want to with the software and source code as long as you acknowledge who wrote it and that, as with any open source software, there is no warranty and you're using the code "as is." In the spirit of collaborative open source software, the iRODS community encourages you to communicate with us, letting us know what features you like, features that would be useful, problems, bugs, suggestions, etc., and to perhaps contribute source code. The iRODS community has formed the Data Intensive Cyberinfrastructure Foundation, a 501(c)(3) nonprofit corporation established to serve as the home of the iRODS open source community over the long term. If you choose to contribute new code, you'll receive full acknowledgment. All you do is complete the Contributor's Agreement, under which you retain copyright ownership in your code but give a free license to the iRODS nonprofit foundation, allowing your code to be integrated into iRODS and in turn released under the BSD license. Note: The above text is an educational overview of iRODS open source licensing, and not intended as legal advice nor is it part of the iRODS license agreement, which is below. As always, for legal advice consult an attorney. iRODS License Terms and Conditions Notice Copyright (c) 2005-2011, Regents of the University of California, the University of North Carolina, and the Data Intensive Cyberinfrastructure Foundation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the University of California, San Diego (UCSD) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.php-irods-3.3.0~beta1/prods/src/Prods.inc.php000066400000000000000000000001221221272161600210160ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/src/ProdsConfig.inc.php000066400000000000000000000004611221272161600221520ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/src/ProdsDir.class.php000066400000000000000000001011451221272161600220200ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); class ProdsDir extends ProdsPath { /** * @var RODSDirStats */ public $stats; private $child_dirs; private $child_files; private $all_children; private $position; /** * Default Constructor. * * @param RODSAccount account iRODS account used for connection * @param string $path_str the path of this dir * @param boolean $verify whether verify if the path exsits * @param RODSDirStats $stats if the stats for this dir is already known, initilize it here. * @return a new ProdsDir */ public function __construct(RODSAccount &$account, $path_str, $verify = false, RODSDirStats $stats = NULL) { $this->position = 0; $this->stats = $stats; parent::__construct($account, $path_str); if ($verify === true) { if ($this->exists() === false) { throw new RODSException("Directory '$this' does not exist", 'PERR_PATH_DOES_NOT_EXISTS'); } } } /** * Create a ProdsDir object from URI string. * @param string $path the URI Sting * @param boolean $verify whether verify if the path exsits * @return a new ProdsDir */ public static function fromURI($path, $verify=false) { if (0!=strncmp($path,"rods://",7)) $path="rods://".$path; $url=parse_url($path); $host=isset($url['host'])?$url['host']:''; $port=isset($url['port'])?$url['port']:''; $user=''; $zone=''; $authtype='irods'; if (isset($url['user'])) { if (strstr($url['user'],".")!==false) { $user_array=@explode(".",$url['user']); if (count($user_array)===3) { $user=$user_array[0]; $zone=$user_array[1]; $authtype=$user_array[2]; } else { $user=$user_array[0]; $zone=$user_array[1]; } } else $user=$url['user']; } $pass=isset($url['pass'])?$url['pass']:''; $account=new RODSAccount($host, $port, $user, $pass, $zone, '', $authtype); $path_str=isset($url['path'])?$url['path']:''; // treat query and fragment as part of name if (isset($url['query'])&&(strlen($url['query'])>0)) $path_str=$path_str.'?'.$url['query']; if (isset($url['fragment'])&&(strlen($url['fragment'])>0)) $path_str=$path_str.'#'.$url['fragment']; if (empty($path_str)) $path_str='/'; return (new ProdsDir($account,$path_str,$verify)); } /** * Verify if this dir exist with server. This function shouldn't be called directly, use {@link exists} */ //protected function verify() protected function verify($get_cb=array('RODSConnManager','getConn'), $rel_cb=array('RODSConnManager', 'releaseConn')) { //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $this->path_exists= $conn -> dirExists ($this->path_str); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * get next file or directory from the directory, where the internal iterator points to. * @return next file or directory from the directory. The file always come first and dir comes later. return false on failure */ public function getNextChild() { if (!$this->all_children) $this->all_children=$this->getAllChildren(); if (($this->position>=count($this->all_children))||($this->position<0)) return false; $names=array_keys($this->all_children); $ret_val=$this->all_children[$names[$this->position]]; $this->position++; return $ret_val; } /** * Get children files of this dir. * * @param array $orderby An associated array specifying how to sort the result by attributes. See details in method {@link findFiles}; * @param int $startingInx starting index of all files. default is 0. * @param int $maxresults max results returned. if negative, it returns all rows. default is -1 * @param int &$total_num_rows number of all results * @param boolean $logical_file whether to return only logical files, if false, it returns all replica with resource name, if true, it returns only 1 logical file, with num_replica available in the stats. default is false. * @return an array of ProdsFile */ public function getChildFiles(array $orderby=array(), $startingInx=0, $maxresults=-1, &$total_num_rows=-1, $logicalFile=false) { $terms=array("descendantOnly"=>true,"recursive"=>false, 'logicalFile'=>$logicalFile); return $this->findFiles($terms,$total_num_rows,$startingInx,$maxresults,$orderby); } /** * Resets the directory stream to the beginning of the directory. */ public function rewind() { $this->position = 0; } /** * @return all children (files and dirs) of current dir */ public function getAllChildren() { $this->all_children = array(); $this->all_children = array_merge($this->all_children, $this->getChildFiles()); $this->all_children = array_merge($this->all_children, $this->getChildDirs()); return $this->all_children; } /** * Get children directories of this dir. * @param $orderby An associated array specifying how to sort the result by attributes. See details in method {@link findDirs}; * Note that if the current dir is root '/', it will not return '/' as its child, unlike iCommand's current behavior. * @return an array of ProdsDir */ public function getChildDirs(array $orderby = array(), $startingInx = 0, $maxresults = -1, &$total_num_rows = -1) { $terms = array("descendantOnly" => true, "recursive" => false); return $this->findDirs($terms, $total_num_rows, $startingInx, $maxresults, $orderby); } /** * Make a new directory under this directory * @param string $name full path of the new dir to be made on server * @return ProdsDir the new directory just created (or already exists) */ // public function mkdir($name) public function mkdir($name, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->mkdir($this->path_str . "/$name"); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); return (new ProdsDir($this->account, $this->path_str . "/$name")); } /** * remove this directory * @param boolean $recursive whether recursively delete all child files and child directories recursively. * @param boolean $force whether force delete the file/dir. If force delete, all files will be wiped physically. Else, they are moved to trash derectory. * @param array $additional_flags An array of keyval pairs (array) reprenting additional flags passed to the server/client message. Each keyval pair is an array with first element repsenting the key, and second element representing the value (default to ''). Supported keys are: * - 'irodsRmTrash' - whether this rm is a rmtrash operation * - 'irodsAdminRmTrash' - whether this rm is a rmtrash operation done by admin user * @param mixed $status_update_func It can be an string or array that represents the status update function (see http://us.php.net/manual/en/language.pseudo-types.php#language.types.callback), which can update status based on the server status update. Leave it blank or 'null' if there is no need to update the status. The function will be called with an assossive arry as parameter, supported fields are: * - 'filesCnt' - finished number of files from previous update (normally 10 but not the last update) * - 'lastObjPath' - last object that was processed. * If this function returns 1, progress will be stopped. */ // public function rmdir($recursive=true,$force=false, $additional_flags=array(), // $status_update_func=null) public function rmdir($recursive = true, $force = false, $additional_flags = array(), $status_update_func = null, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->rmdir($this->path_str, $recursive, $force, $additional_flags, $status_update_func); // RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * get the dir stats * @param boolean $force_reload If stats already present in the object, and this flag is true, a force reload will be done. * @return RODSDirStats the stats object, note that if this object will not refresh unless $force_reload flag is used. */ // public function getStats($force_reload=false) public function getStats($force_reload = false, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if (($force_reload === false) && ($this->stats)) return $this->stats; //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $stats = $conn->getDirStats($this->path_str); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); if ($stats === false) $this->stats = NULL; else $this->stats = $stats; return $this->stats; } public function getACL() { $collection = $this->path_str; $connLocal = RODSConnManager::getConn($this->account); $que_result_coll = $connLocal->genQuery( array("COL_COLL_INHERITANCE", "COL_COLL_NAME", "COL_COLL_OWNER_NAME", "COL_COLL_ID"), array(new RODSQueryCondition("COL_COLL_NAME", $collection))); $users['COL_COLL_INHERITANCE'] = (int)($que_result_coll['COL_COLL_INHERITANCE'][0]); $que_result_users = $connLocal->genQuery( array("COL_DATA_ACCESS_NAME", "COL_DATA_ACCESS_USER_ID"), array(new RODSQueryCondition("COL_DATA_ACCESS_DATA_ID", $que_result_coll['COL_COLL_ID'][0]))); for($i=0; $igenQuery( array("COL_USER_NAME", "COL_USER_ZONE"), array(new RODSQueryCondition("COL_USER_ID", $que_result_users["COL_DATA_ACCESS_USER_ID"][$i]))); $users['COL_USERS'][] = (object) array( "COL_USER_NAME" => $que_result_user_info['COL_USER_NAME'][0], "COL_USER_ZONE" => $que_result_user_info['COL_USER_ZONE'][0], "COL_DATA_ACCESS_NAME" => $que_result_users['COL_DATA_ACCESS_NAME'][$i] ); } RODSConnManager::releaseConn($connLocal); return $users; } /** * get the dir statistics, such as total number of files under this dir * @param string $fld Name of the statistics, supported values are: * - num_dirs number of directories * - num_files number of files * @param boolean $recursive wheather recursively through the sub collections, default is true. * @return result, an integer value, assosiated with the query. */ //public function queryStatistics($fld, $recursive=true) public function queryStatistics($fld, $recursive = true, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { $condition = new RODSGenQueConds(); $select = new RODSGenQueSelFlds(); $ret_data_index = ''; switch ($fld) { case 'num_dirs' : $select->add('COL_COLL_ID', 'count'); $ret_data_index = 'COL_COLL_ID'; if ($recursive === true) $condition->add('COL_COLL_NAME', 'like', $this->path_str . '/%'); else $condition->add('COL_COLL_PARENT_NAME', '=', $this->path_str); break; case 'num_files' : $select->add('COL_D_DATA_ID', 'count'); $ret_data_index = 'COL_D_DATA_ID'; if ($recursive === true) $condition->add('COL_COLL_NAME', 'like', $this->path_str . '/%', array(array('op' => '=', 'val' => $this->path_str))); else $condition->add('COL_COLL_NAME', '=', $this->path_str); break; default : throw new RODSException("Query field '$fld' not supported!", 'PERR_USER_INPUT_ERROR'); } //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $results = $conn->query($select, $condition); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); $result_values = $results->getValues(); if (isset($result_values[$ret_data_index][0])) return intval($result_values[$ret_data_index][0]); else { throw new RODSException("Query did not get value back with expected " . "index: $ret_data_index!", 'GENERAL_PRODS_ERR'); } } /** * query metadata, and find matching files. * @param array $terms an assositive array of search conditions, supported ones are: * - 'name' (string) - partial name of the target (file or dir) * - 'descendantOnly' (boolean) - whether to search among this directory's decendents. default is false. * - 'recursive' (boolean) - whether to search recursively, among all decendents and their children. default is false. This option only works when 'descendantOnly' is true * - 'logicalFile' (boolean) - whether to return logical file, instead of all replicas for each file. if true, the resource name for each file will be null, instead, num_replicas will be provided. default is false. * - 'smtime' (int) - start last-modified-time in unix timestamp. The specified time is included in query, in other words the search can be thought was "mtime >= specified time" * - 'emtime' (int) - end last-modified-time in unix timestamp. The specified time is not included in query, in other words the search can be thought was "mtime < specified time" * - 'owner' (string) - owner name of the file * - 'rescname' (string) - resource name of the file * - 'metadata' (array of RODSMeta) - array of metadata. * @param int &$total_count This value (passed by reference) returns the total potential count of search results * @param int $start starting index of search results. * @param int $limit up to how many results to be returned. If negative, give all results back. * @param array $sort_flds associative array with following keys: * - 'name' - name of the file or dir * - 'size' - size of the file * - 'mtime' - last modified time * - 'ctime' - creation time * - 'owner' - owner of the file * - 'typename' - file/data type * - 'dirname' - directory/collection name for the file * The results are sorted by specified array keys. * The possible array value must be boolean: true stands for 'asc' and false stands for 'desc', default is 'asc' * @return array of ProdsPath objects (ProdsFile or ProdsDir). */ //public function findFiles(array $terms, &$total_count, $start=0, $limit=-1, array $sort_flds=array()) public function findFiles(array $terms, &$total_count, $start = 0, $limit = -1, array $sort_flds = array(), $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { $flds = array("COL_DATA_NAME" => NULL, "COL_D_DATA_ID" => NULL, "COL_DATA_TYPE_NAME" => NULL, "COL_D_RESC_NAME" => NULL, "COL_DATA_SIZE" => NULL, "COL_D_OWNER_NAME" => NULL, "COL_D_OWNER_ZONE" => NULL, "COL_D_CREATE_TIME" => NULL, "COL_D_MODIFY_TIME" => NULL, "COL_COLL_NAME" => NULL, "COL_D_COMMENTS" => NULL); foreach ($sort_flds as $sort_fld_key => $sort_fld_val) { switch ($sort_fld_key) { case 'name': if ($sort_fld_val === false) $flds['COL_DATA_NAME'] = 'order_by_desc'; else $flds['COL_DATA_NAME'] = 'order_by_asc'; break; case 'size': if ($sort_fld_val === false) $flds['COL_DATA_SIZE'] = 'order_by_desc'; else $flds['COL_DATA_SIZE'] = 'order_by_asc'; break; case 'mtime': if ($sort_fld_val === false) $flds['COL_D_MODIFY_TIME'] = 'order_by_desc'; else $flds['COL_D_MODIFY_TIME'] = 'order_by_asc'; break; case 'ctime': if ($sort_fld_val === false) $flds['COL_D_CREATE_TIME'] = 'order_by_desc'; else $flds['COL_D_CREATE_TIME'] = 'order_by_asc'; break; case 'typename': if ($sort_fld_val === false) $flds['COL_DATA_TYPE_NAME'] = 'order_by_desc'; else $flds['COL_DATA_TYPE_NAME'] = 'order_by_asc'; break; case 'owner': if ($sort_fld_val === false) $flds['COL_D_OWNER_NAME'] = 'order_by_desc'; else $flds['COL_D_OWNER_NAME'] = 'order_by_asc'; break; case 'dirname': if ($sort_fld_val === false) $flds['COL_COLL_NAME'] = 'order_by_desc'; else $flds['COL_COLL_NAME'] = 'order_by_asc'; break; default: /* throw new RODSException("Sort field name '$sort_fld_key' is not valid", 'PERR_USER_INPUT_ERROR'); break; */ } } $select = new RODSGenQueSelFlds(array_keys($flds), array_values($flds)); $descendantOnly = false; $recursive = false; $logicalFile = false; $condition = new RODSGenQueConds(); foreach ($terms as $term_key => $term_val) { switch ($term_key) { case 'name': //$condition->add('COL_DATA_NAME', 'like', '%'.$term_val.'%'); $condition->add('COL_DATA_NAME', 'like', $term_val); break; case 'smtime': $condition->add('COL_D_MODIFY_TIME', '>=', $term_val); break; case 'emtime': $condition->add('COL_D_MODIFY_TIME', '<', $term_val); break; case 'owner': $condition->add('COL_D_OWNER_NAME', '=', $term_val); break; case 'ownerzone': $condition->add('COL_D_OWNER_ZONE', '=', $term_val); break; case 'rescname': $condition->add('COL_D_RESC_NAME', '=', $term_val); break; case 'metadata': $meta_array = $term_val; foreach ($meta_array as $meta) { if (isset($meta->name)) { if ($meta->nameop === 'like') { $condition->add('COL_META_DATA_ATTR_NAME', 'like', '%' . $meta->name . '%'); } else if (isset($meta->nameop)) { $condition->add('COL_META_DATA_ATTR_NAME', $meta->nameop, $meta->name); } else { $condition->add('COL_META_DATA_ATTR_NAME', '=', $meta->name); } } if (isset($meta->value)) { if ($meta->op === 'like') { $condition->add('COL_META_DATA_ATTR_VALUE', 'like', '%' . $meta->value . '%'); } else if (isset($meta->op)) { $condition->add('COL_META_DATA_ATTR_VALUE', $meta->op, $meta->value); } else { $condition->add('COL_META_DATA_ATTR_VALUE', '=', $meta->value); } } if (isset($meta->unit)) { if ($meta->unitop === 'like') { $condition->add('COL_META_DATA_ATTR_UNIT', 'like', '%' . $meta->unit . '%'); } else if (isset($meta->unitop)) { $condition->add('COL_META_DATA_ATTR_UNIT', $meta->unitop, $meta->unit); } else { $condition->add('COL_META_DATA_ATTR_UNIT', '=', $meta->unit); } } } break; case 'descendantOnly': if (true === $term_val) $descendantOnly = true; break; case 'recursive': if (true === $term_val) $recursive = true; break; case 'logicalFile': if (true === $term_val) $logicalFile = true; break; default: throw new RODSException("Term field name '$term_key' is not valid", 'PERR_USER_INPUT_ERROR'); break; } } if ($descendantOnly === true) { if ($recursive === true) $condition->add('COL_COLL_NAME', 'like', $this->path_str . '/%', array(array('op' => '=', 'val' => $this->path_str))); else $condition->add('COL_COLL_NAME', '=', $this->path_str); } if ($logicalFile === true) { $select->update('COL_D_RESC_NAME', 'count'); $select->update('COL_DATA_SIZE', 'max'); $select->update('COL_D_CREATE_TIME', 'min'); $select->update('COL_D_MODIFY_TIME', 'max'); } //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $results = $conn->query($select, $condition, $start, $limit); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); $total_count = $results->getTotalCount(); $result_values = $results->getValues(); $found = array(); for ($i = 0; $i < $results->getNumRow(); $i++) { $resc_name = ($logicalFile === true) ? NULL : $result_values['COL_D_RESC_NAME'][$i]; $num_replica = ($logicalFile === true) ? intval($result_values['COL_D_RESC_NAME'][$i]) : NULL; $stats = new RODSFileStats( $result_values['COL_DATA_NAME'][$i], $result_values['COL_DATA_SIZE'][$i], $result_values['COL_D_OWNER_NAME'][$i], $result_values['COL_D_OWNER_ZONE'][$i], $result_values['COL_D_MODIFY_TIME'][$i], $result_values['COL_D_CREATE_TIME'][$i], $result_values['COL_D_DATA_ID'][$i], $result_values['COL_DATA_TYPE_NAME'][$i], $resc_name, $result_values['COL_D_COMMENTS'][$i], $num_replica ); if ($result_values['COL_COLL_NAME'][$i] == '/') $full_path = '/' . $result_values['COL_DATA_NAME'][$i]; else $full_path = $result_values['COL_COLL_NAME'][$i] . '/' . $result_values['COL_DATA_NAME'][$i]; $found[] = new ProdsFile($this->account, $full_path, false, $stats); } return $found; } /** * query metadata, and find matching diretories. * @param array $terms an assositive array of search conditions, supported ones are: * - 'name' (string) - partial name of the target (file or dir) * - 'descendantOnly' (boolean) - whether to search among this directory's decendents. default is false. * - 'recursive' (boolean) - whether to search recursively, among all decendents and their children. default is false. This option only works when 'descendantOnly' is true * - 'smtime' (int) - start last-modified-time in unix timestamp. The specified time is included in query, in other words the search can be thought was "mtime >= specified time" * - 'emtime' (int) - end last-modified-time in unix timestamp. The specified time is not included in query, in other words the search can be thought was "mtime < specified time" * - 'owner' (string) - owner name of the dir * - 'metadata' (array of RODSMeta) - array of metadata. * @param int &$total_count This value (passed by reference) returns the total potential count of search results * @param int $start starting index of search results. * @param int $limit up to how many results to be returned. If negative, give all results back. * @param array $sort_flds associative array with following keys: * - 'name' - name of the dir * - 'mtime' - last modified time * - 'ctime' - creation time * - 'owner' - owner of the dir * The results are sorted by specified array keys. * The possible array value must be boolean: true stands for 'asc' and false stands for 'desc', default is 'asc' * @return array of ProdsPath objects (ProdsFile or ProdsDir). */ public function findDirs(array $terms, &$total_count, $start = 0, $limit = -1, array $sort_flds = array()) { $flds = array("COL_COLL_NAME" => NULL, "COL_COLL_ID" => NULL, "COL_COLL_OWNER_NAME" => NULL, 'COL_COLL_OWNER_ZONE' => NULL, "COL_COLL_CREATE_TIME" => NULL, "COL_COLL_MODIFY_TIME" => NULL, "COL_COLL_COMMENTS" => NULL); foreach ($sort_flds as $sort_fld_key => $sort_fld_val) { switch ($sort_fld_key) { case 'name': if ($sort_fld_val === false) $flds['COL_COLL_NAME'] = 'order_by_desc'; else $flds['COL_COLL_NAME'] = 'order_by_asc'; break; case 'mtime': if ($sort_fld_val === false) $flds['COL_COLL_MODIFY_TIME'] = 'order_by_desc'; else $flds['COL_COLL_MODIFY_TIME'] = 'order_by_asc'; break; case 'ctime': if ($sort_fld_val === false) $flds['COL_COLL_CREATE_TIME'] = 'order_by_desc'; else $flds['COL_COLL_CREATE_TIME'] = 'order_by_asc'; break; case 'owner': if ($sort_fld_val === false) $flds['COL_COLL_OWNER_NAME'] = 'order_by_desc'; else $flds['COL_COLL_OWNER_NAME'] = 'order_by_asc'; break; default: /* throw new RODSException("Sort field name '$sort_fld_key' is not valid", 'PERR_USER_INPUT_ERROR'); */ break; } } $select = new RODSGenQueSelFlds(array_keys($flds), array_values($flds)); $descendantOnly = false; $recursive = false; $condition = new RODSGenQueConds(); foreach ($terms as $term_key => $term_val) { switch ($term_key) { case 'name': //$condition->add('COL_COLL_NAME', 'like', '%'.$term_val.'%'); $condition->add('COL_COLL_NAME', 'like', $term_val); break; case 'smtime': $condition->add('COL_COLL_MODIFY_TIME', '>=', $term_val); break; case 'emtime': $condition->add('COL_COLL_MODIFY_TIME', '<', $term_val); break; case 'owner': $condition->add('COL_COLL_OWNER_NAME', '=', $term_val); break; case 'metadata': $meta_array = $term_val; foreach ($meta_array as $meta) { $condition->add('COL_META_COLL_ATTR_NAME', '=', $meta->name); if (isset($meta->op)) $op = $meta->op; else $op = '='; if ($op == 'like') //$value='%'.$meta->value.'%'; $value = $meta->value; else $value = $meta->value; $condition->add('COL_META_COLL_ATTR_VALUE', $op, $value); } break; case 'descendantOnly': if (true === $term_val) $descendantOnly = true; break; case 'recursive': if (true === $term_val) $recursive = true; break; default: throw new RODSException("Term field name '$term_key' is not valid", 'PERR_USER_INPUT_ERROR'); break; } } if ($descendantOnly === true) { // eliminate '/' from children, if current path is already root if ($this->path_str == '/') $condition->add('COL_COLL_NAME', '<>', '/'); if ($recursive === true) $condition->add('COL_COLL_PARENT_NAME', 'like', $this->path_str . '/%', array(array('op' => '=', 'val' => $this->path_str))); else $condition->add('COL_COLL_PARENT_NAME', '=', $this->path_str); } $conn = RODSConnManager::getConn($this->account); $results = $conn->query($select, $condition, $start, $limit); RODSConnManager::releaseConn($conn); $total_count = $results->getTotalCount(); $result_values = $results->getValues(); $found = array(); for ($i = 0; $i < $results->getNumRow(); $i++) { $full_path = $result_values['COL_COLL_NAME'][$i]; $acctual_name = basename($result_values['COL_COLL_NAME'][$i]); $stats = new RODSDirStats( $acctual_name, $result_values['COL_COLL_OWNER_NAME'][$i], $result_values['COL_COLL_OWNER_ZONE'][$i], $result_values['COL_COLL_MODIFY_TIME'][$i], $result_values['COL_COLL_CREATE_TIME'][$i], $result_values['COL_COLL_ID'][$i], $result_values['COL_COLL_COMMENTS'][$i]); $found[] = new ProdsDir($this->account, $full_path, false, $stats); } return $found; } } php-irods-3.3.0~beta1/prods/src/ProdsFile.class.php000066400000000000000000000433411221272161600221640ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); class ProdsFile extends ProdsPath { public $stats; private $rodsconn; //real RODS connection private $l1desc; //lvl 1 descriptor on RODS server private $conn; //the connection to RODS agent l1desc lives on. private $rescname; //resource name. private $openmode; //open mode used if file is opened private $position; //current position of the file, if opened. /** * The class constructor */ public function __construct(RODSAccount &$account, $path_str, $verify = false, RODSFileStats $stats = NULL) { $this->l1desc = -1; $this->stats = $stats; if ($path_str{strlen($path_str) - 1} == '/') { throw new RODSException("Invalid file name '$path_str' ", 'PERR_USER_INPUT_PATH_ERROR'); } parent::__construct($account, $path_str); if ($verify === true) { if ($this->exists() === false) { throw new RODSException("File '$this' does not exist", 'PERR_PATH_DOES_NOT_EXISTS'); } } } /** * Create a new ProdsFile object from URI string. * @param string $path the URI Sting * @param boolean $verify whether verify if the path exsits * @return a new ProdsDir */ public static function fromURI($path, $verify=false) { if (0!=strncmp($path,"rods://",7)) $path="rods://".$path; $url=parse_url($path); $host=isset($url['host'])?$url['host']:''; $port=isset($url['port'])?$url['port']:''; $user=''; $zone=''; $authtype='irods'; if (isset($url['user'])) { if (strstr($url['user'],".")!==false) { $user_array=@explode(".",$url['user']); if (count($user_array)===3) { $user=$user_array[0]; $zone=$user_array[1]; $authtype=$user_array[2]; } else { $user=$user_array[0]; $zone=$user_array[1]; } } else $user=$url['user']; } $pass=isset($url['pass'])?$url['pass']:''; $account=new RODSAccount($host, $port, $user, $pass, $zone, '', $authtype); $path_str=isset($url['path'])?$url['path']:''; // treat query and fragment as part of name if (isset($url['query'])&&(strlen($url['query'])>0)) $path_str=$path_str.'?'.$url['query']; if (isset($url['fragment'])&&(strlen($url['fragment'])>0)) $path_str=$path_str.'#'.$url['fragment']; if (empty($path_str)) $path_str='/'; return (new ProdsFile($account,$path_str,$verify)); } /** * Verify if this file exist with server. This function shouldn't be called directly, use {@link exists} */ protected function verify() { $conn = RODSConnManager::getConn($this->account); $this->path_exists= $conn -> fileExists ($this->path_str); RODSConnManager::releaseConn($conn); } /** * get the file stats */ public function getStats() { $conn = RODSConnManager::getConn($this->account); $stats=$conn->getFileStats($this->path_str); RODSConnManager::releaseConn($conn); if ($stats===false) $this->stats=NULL; else $this->stats=$stats; return $this->stats; } /** * Open a file path (string) exists on RODS server. * * @param string $mode open mode. Supported modes are: * - 'r' Open for reading only; place the file pointer at the beginning of the file. * - 'r+' Open for reading and writing; place the file pointer at the beginning of the file. * - 'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * - 'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * - 'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. * - 'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. * - 'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. * - 'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. * @param string $rescname. Note that this parameter is required only if the file does not exists (create mode). If the file already exists, and if file resource is unknown or unique or you-dont-care for that file, leave the field, or pass NULL. * @param boolean $assum_file_exists. This parameter specifies whether file exists. If the value is false, this mothod will check with RODS server to make sure. If value is true, the check will NOT be done. Default value is false. * @param string $filetype. This parameter only make sense when you want to specify the file type, if file does not exists (create mode). If not specified, it defaults to "generic" * @param integer $cmode. This parameter is only used for "createmode". It specifies the file mode on physical storage system (RODS vault), in octal 4 digit format. For instance, 0644 is owner readable/writeable, and nothing else. 0777 is all readable, writable, and excutable. If not specified, and the open flag requirs create mode, it defaults to 0644. */ public function open($mode, $rescname = NULL, $assum_file_exists = false, $filetype = 'generic', $cmode = 0644) { if ($this->l1desc >= 0) return; if (!empty($rescname)) $this->rescname = $rescname; $this->conn = RODSConnManager::getConn($this->account); $this->l1desc = $this->conn->openFileDesc($this->path_str, $mode, $this->postion, $rescname, $assum_file_exists, $filetype, $cmode); $this->openmode = $mode; RODSConnManager::releaseConn($this->conn); } /** * get the file open mode, if opened previously * @return string open mode, if not opened, it return NULL */ public function getOpenmode() { return $this->openmode; } /** * get the file current position, if opened previously * @return string open mode, if not opened, it return NULL */ public function tell() { return $this->position; } /** * unlink the file on server * @param string $rescname resource name. Not required if there is no other replica. * @param boolean $force flag (true or false) indicating whether force delete or not. */ public function unlink($rescname = NULL, $force = false) { $conn = RODSConnManager::getConn($this->account); $conn->fileUnlink($this->path_str, $rescname, $force); RODSConnManager::releaseConn($conn); } /** * close the file descriptor (private) made from RODS server earlier. */ public function close() { if ($this->l1desc >= 0) { while ($this->conn->isIdle() === false) { trigger_error("The connection is not available! sleep for a while and retry...", E_USER_WARNING); usleep(50); } $this->conn->lock(); $this->conn->closeFileDesc($this->l1desc); $this->conn->unlock(); $this->conn = null; //release the connection $this->l1desc = -1; } } /** * reads up to length bytes from the file. Reading stops when up to length bytes have been read, EOF (end of file) is reached * * @param int $length up to how many bytes to read. * @return the read string. */ public function read($length) { if ($this->l1desc < 0) { throw new RODSException("File '$this' is not opened! l1desc=$this->l1desc", 'PERR_USER_INPUT_ERROR'); } while ($this->conn->isIdle() === false) { trigger_error("The connection is not available! sleep for a while and retry...", E_USER_WARNING); usleep(50); } $this->conn->lock(); $retval = $this->conn->fileRead($this->l1desc, $length); $this->position = $this->position + strlen($retval); $this->conn->unlock(); return $retval; } /** * write up to length bytes to the server. this function is binary safe. * @param string $string contents to be written. * @param int $length up to how many bytes to write. * @return the number of bytes written. */ public function write($string, $length = NULL) { if ($this->l1desc < 0) { throw new RODSException("File '$this' is not opened! l1desc=$this->l1desc", 'PERR_USER_INPUT_ERROR'); } while ($this->conn->isIdle() === false) { trigger_error("The connection is not available! sleep for a while and retry...", E_USER_WARNING); usleep(50); } $this->conn->lock(); $retval = $this->conn->fileWrite($this->l1desc, $string, $length); $this->position = $this->position + (int)$retval; $this->conn->unlock(); return $retval; } /** * Sets the file position for the file. The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence, whose values are defined as follows: * SEEK_SET - Set position equal to offset bytes. * SEEK_CUR - Set position to current location plus offset. * SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) * If whence is not specified, it is assumed to be SEEK_SET. * @return int the current offset */ public function seek($offset, $whence = SEEK_SET) { if ($this->l1desc < 0) { throw new RODSException("File '$this' is not opened! l1desc=$this->l1desc", 'PERR_USER_INPUT_ERROR'); } while ($this->conn->isIdle() === false) { trigger_error("The connection is not available! sleep for a while and retry...", E_USER_WARNING); usleep(50); } $this->conn->lock(); $retval = $this->conn->fileSeek($this->l1desc, $offset, $whence); $this->position = (int)$retval; $this->conn->unlock(); return $retval; } /** * Sets the file position to the beginning of the file stream. */ public function rewind() { while ($this->conn->isIdle() === false) { trigger_error("The connection is not available! sleep for a while and retry...", E_USER_WARNING); usleep(50); } $this->seek(0, SEEK_SET); $this->position = 0; } /** * get the file descriptor (private) made from RODS server earlier. */ public function getL1desc() { return $this->l1desc; } /** * Because RODS server can only do file operations in a single connection, a RODS * connection is 'reserved' when file is opened, and released when closed. */ public function getConn() { return $this->conn; } /** * Replicate file to resources with options. * @param string $desc_resc destination resource * @param array $options an assosive array of options: * - 'all' (boolean): only meaningful if input resource is a resource group. Replicate to all the resources in the resource group. * - 'backupMode' (boolean): if a good copy already exists in this resource, don't make another copy. * - 'admin' (boolean): admin user uses this option to backup/replicate other users files * - 'replNum' (integer): the replica to copy, typically not needed * - 'srcResc' (string): specifies the source resource of the data object to be replicate, only copies stored in this resource will be replicated. Otherwise, one of the copy will be replicated * These options are all 'optional', if omitted, the server will try to do it anyway * @return number of bytes written if success, in case of faliure, throw an exception */ public function repl($desc_resc, array $options = array()) { $conn = RODSConnManager::getConn($this->account); $bytesWritten = $conn->repl($this->path_str, $desc_resc, $options); RODSConnManager::releaseConn($conn); return $bytesWritten; } /** * get replica information for this file * @return array of array, each child array is a associative and contains: * [repl_num] : replica number * [chk_sum] : checksum of the file * [size] : size of the file (replica) * [resc_name] : resource name * [resc_repl_status] : replica status (dirty bit), whether this replica is dirty (modifed), and requirs synchs to other replicas. * [resc_grp_name] : resource group name * [resc_type] : resource type name * [resc_class] : resource class name * [resc_loc] : resource location * [resc_freespace]: resource freespace * [data_status] : data status * [ctime] : data creation time (unix timestamp) * [mtime] : data last modified time (unix timestamp) */ public function getReplInfo() { $select = new RODSGenQueSelFlds( array("COL_DATA_REPL_NUM", "COL_D_DATA_CHECKSUM", 'COL_DATA_SIZE', "COL_D_RESC_NAME", "COL_D_RESC_GROUP_NAME", "COL_D_DATA_STATUS", "COL_D_CREATE_TIME", "COL_D_MODIFY_TIME", 'COL_R_TYPE_NAME', 'COL_R_CLASS_NAME', 'COL_R_LOC', 'COL_R_FREE_SPACE', 'COL_D_REPL_STATUS') ); $condition = new RODSGenQueConds( array("COL_COLL_NAME", "COL_DATA_NAME"), array("=", "="), array($this->parent_path, $this->name) ); $conn = RODSConnManager::getConn($this->account); $que_result = $conn->query($select, $condition); RODSConnManager::releaseConn($conn); $ret_arr = array(); for ($i = 0; $i < $que_result->getNumRow(); $i++) { $ret_arr_row = array(); $que_result_val = $que_result->getValues(); $ret_arr_row['repl_num'] = $que_result_val['COL_DATA_REPL_NUM'][$i]; $ret_arr_row['chk_sum'] = $que_result_val['COL_D_DATA_CHECKSUM'][$i]; $ret_arr_row['size'] = $que_result_val['COL_DATA_SIZE'][$i]; $ret_arr_row['resc_name'] = $que_result_val['COL_D_RESC_NAME'][$i]; $ret_arr_row['resc_grp_name'] = $que_result_val['COL_D_RESC_GROUP_NAME'][$i]; $ret_arr_row['data_status'] = $que_result_val['COL_D_DATA_STATUS'][$i]; $ret_arr_row['ctime'] = $que_result_val['COL_D_CREATE_TIME'][$i]; $ret_arr_row['mtime'] = $que_result_val['COL_D_MODIFY_TIME'][$i]; $ret_arr_row['resc_type'] = $que_result_val['COL_R_TYPE_NAME'][$i]; $ret_arr_row['resc_class'] = $que_result_val['COL_R_CLASS_NAME'][$i]; $ret_arr_row['resc_loc'] = $que_result_val['COL_R_LOC'][$i]; $ret_arr_row['resc_freespace'] = $que_result_val['COL_R_FREE_SPACE'][$i]; $ret_arr_row['resc_repl_status'] = $que_result_val['COL_D_REPL_STATUS'][$i]; $ret_arr[] = $ret_arr_row; } return $ret_arr; } /** * Get ACL (users and their rights on a file) * @param string $filepath input file path string * @return RODSFileStats. If file does not exists, return fales. */ public function getACL() { $filepath = $this->path_str; $parent = dirname($filepath); $filename = basename($filepath); // $cond = array(new RODSQueryCondition("COL_COLL_NAME", $parent), // new RODSQueryCondition("COL_DATA_NAME", $filename)); $cond = array(new RODSQueryCondition("COL_DATA_NAME", $filename), new RODSQueryCondition("COL_COLL_NAME", $parent)); $connLocal = RODSConnManager::getConn($this->account); $que_result = $connLocal->genQuery( array("COL_USER_NAME", "COL_USER_ZONE", "COL_DATA_ACCESS_NAME"), $cond, array()); RODSConnManager::releaseConn($connLocal); if ($que_result === false) return false; for($i=0; $i < sizeof($que_result['COL_USER_NAME']); $i++) { $users[] = (object) array( "COL_USER_NAME" => $que_result['COL_USER_NAME'][$i], "COL_USER_ZONE" => $que_result['COL_USER_ZONE'][$i], "COL_DATA_ACCESS_NAME" => $que_result['COL_DATA_ACCESS_NAME'][$i] ); } return $users; } } php-irods-3.3.0~beta1/prods/src/ProdsPath.class.php000066400000000000000000000217551221272161600222060ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); require_once(CLASS_DIR . "/ProdsConfig.inc.php"); /** * ProdsPath class. This class is a abastract class for objects that can be represented as a path, such as file or directory * @package Prods */ abstract class ProdsPath { /** * string path * @var string */ public $path_str; public $account; protected $path_exists; protected $parent_path; protected $name; /** * Default Constructor. Because this class is abstract, this constructor should not be called directly. * * @param RODSAccount account iRODS account used for connection * @param string $path_str the path of this dir * @return ProdsPath a new ProdsPath */ public function __construct(RODSAccount &$account, $path_str) { $this->account = $account; // strip the tailing "/" while ((strlen($path_str) > 1) && ($path_str{strlen($path_str) - 1} == '/')) { $path_str = substr($path_str, 0, strlen($path_str) - 1); } // remove duplicate '/' characters $path_str = str_replace('//', '/', $path_str); $this->path_str = $path_str; if ($path_str == '/') { $this->parent_path = null; } else { $this->parent_path = dirname($this->path_str); } $this->name = basename($this->path_str); } public function __toString() { return $this->account . $this->path_str; } /** * Whether this path (dir or file) exists on the server. * @return boolean */ public function exists() { if (isset($this->path_exists)) return $this->path_exists; else { $this->verify(); return $this->path_exists; } } /** * Verify if a path exist with server. This function shouldn't be called directly, use {@link exists} */ abstract protected function verify(); /** * Get meta data of this path (file or dir). * @return array array of RODSMeta. */ //public function getMeta() public function getMeta($get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type = 'd'; else if ($this instanceof ProdsDir) $type = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $meta_array = $conn->getMeta($type, $this->path_str); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); return $meta_array; } /** * update metadata to this path (file or dir) */ public function updateMeta(RODSMeta $meta_old, RODSMeta $meta_new) { $this->rmMeta($meta_old); $this->addMeta($meta_new); } /** * Add metadata to this path (file or dir) */ // public function addMeta(RODSMeta $meta) public function addMeta(RODSMeta $meta, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type = 'd'; else if ($this instanceof ProdsDir) $type = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->addMeta($type, $this->path_str, $meta); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * remove metadata to this path (file or dir) */ // public function rmMeta(RODSMeta $meta) public function rmMeta(RODSMeta $meta, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type = 'd'; else if ($this instanceof ProdsDir) $type = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->rmMeta($type, $this->path_str, $meta); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * remove metadata of this path (file or dir) by id * @param integer metaid id of the metadata entry */ // public function rmMetaByID ($metaid) public function rmMetaByID($metaid, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type = 'd'; else if ($this instanceof ProdsDir) $type = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->rmMetaByID($type, $this->path_str, $metaid); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * copy meta data from this path (file or dir) to $dest path */ // public function cpMeta(ProdsPath $dest) public function cpMeta(ProdsPath $dest, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type_src = 'd'; else if ($this instanceof ProdsDir) $type_src = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); if ($dest instanceof ProdsFile) $type_dest = 'd'; else if ($dest instanceof ProdsDir) $type_dest = 'c'; else throw new RODSException("Unsupported data type:" . get_class($this), "PERR_INTERNAL_ERR"); //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->cpMeta($type_src, $type_dest, $this->path_str, $dest->path_str); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); } /** * rename this path (file of dir) * @param string $new_path_str new path string to be renamed to. */ // public function rename($new_path_str) public function rename($new_path_str, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { if ($this instanceof ProdsFile) $type = 0; else $type = 1; //$conn = RODSConnManager::getConn($this->account); $conn = call_user_func_array($get_cb, array(&$this->account)); $conn->rename($this->path_str, $new_path_str, $type); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); $this->path_str = $new_path_str; $this->parent_path = dirname($this->path_str); $this->name = basename($this->path_str); } /** * Get name of this path. note that this is not the full path. for instance if path is "/foo/bar", the name is "bar" * @return string name of the path. */ public function getName() { return $this->name; } /** * Get string form of this path. note that this is the full path. * @return string form of the path. */ public function getPath() { return $this->path_str; } /** * Get parent's path of this path. * @return string parent's path. */ public function getParentPath() { return $this->parent_path; } /** * Get URI of this path. * @return string this path's URI. */ public function toURI() { return $this->account->toURI() . $this->path_str; } } ?> php-irods-3.3.0~beta1/prods/src/ProdsQuery.class.php000066400000000000000000000101741221272161600224100ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); class ProdsQuery { public $account; public function __construct(RODSAccount $account) { $this->account = $account; } /** * Get all user defined metadata names for all files on the server. * @return array of strings (metadata names). */ public function getMetadataNamesForAllFiles() { $flds = array("COL_META_DATA_ATTR_NAME" => NULL); $select = new RODSGenQueSelFlds(array_keys($flds), array_values($flds)); $condition = new RODSGenQueConds(); $condition->add('COL_D_DATA_ID', '>=', '0'); $conn = RODSConnManager::getConn($this->account); $results = $conn->query($select, $condition); RODSConnManager::releaseConn($conn); if ($results->getNumRow() < 1) return array(); else { $values = $results->getValues(); return $values['COL_META_DATA_ATTR_NAME']; } } /** * Get all user defined metadata names for all directories(collections) on the server. * @return array of strings (metadata names). */ public function getMetadataNamesForAllDirs() { $flds = array("COL_META_COLL_ATTR_NAME" => NULL); $select = new RODSGenQueSelFlds(array_keys($flds), array_values($flds)); $condition = new RODSGenQueConds(); $condition->add('COL_COLL_ID', '>=', '0'); $conn = RODSConnManager::getConn($this->account); $results = $conn->query($select, $condition); RODSConnManager::releaseConn($conn); if ($results->getNumRow() < 1) return array(); else { $values = $results->getValues(); return $values['COL_META_COLL_ATTR_NAME']; } } /** * Get all resources registered on the server * @return array with fields: id, name, type, zone, class, loc, info, comment, ctime, mtime, vault_path, free_space. If user not found return empty array. */ public function getResources() { // set selected value $flds = array("COL_R_RESC_ID" => NULL, "COL_R_RESC_NAME" => NULL, "COL_R_ZONE_NAME" => NULL, "COL_R_TYPE_NAME" => NULL, "COL_R_CLASS_NAME" => NULL, "COL_R_LOC" => NULL, "COL_R_VAULT_PATH" => NULL, "COL_R_FREE_SPACE" => NULL, "COL_R_RESC_INFO" => NULL, "COL_R_RESC_COMMENT" => NULL, "COL_R_CREATE_TIME" => NULL, "COL_R_MODIFY_TIME" => NULL); $select = new RODSGenQueSelFlds(array_keys($flds), array_values($flds)); $condition = new RODSGenQueConds(); $conn = RODSConnManager::getConn($this->account); $results = $conn->query($select, $condition); RODSConnManager::releaseConn($conn); $result_vals = $results->getValues(); $retval = array(); for ($i = 0; $i < $results->getNumRow(); $i++) { $retval_row = array(); $retval_row['id'] = $result_vals["COL_R_RESC_ID"][$i]; $retval_row['name'] = $result_vals["COL_R_RESC_NAME"][$i]; $retval_row['type'] = $result_vals["COL_R_TYPE_NAME"][$i]; $retval_row['zone'] = $result_vals["COL_R_ZONE_NAME"][$i]; $retval_row['class'] = $result_vals["COL_R_CLASS_NAME"][$i]; $retval_row['loc'] = $result_vals["COL_R_LOC"][$i]; $retval_row['info'] = $result_vals["COL_R_RESC_INFO"][$i]; $retval_row['comment'] = $result_vals["COL_R_RESC_COMMENT"][$i]; $retval_row['ctime'] = $result_vals["COL_R_CREATE_TIME"][$i]; $retval_row['mtime'] = $result_vals["COL_R_MODIFY_TIME"][$i]; $retval_row['vault_path'] = $result_vals["COL_R_VAULT_PATH"][$i]; $retval_row['free_space'] = $result_vals["COL_R_FREE_SPACE"][$i]; $retval[] = $retval_row; } return $retval; } } ?>php-irods-3.3.0~beta1/prods/src/ProdsRule.class.php000066400000000000000000000052121221272161600222070ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); class ProdsRule { public $account; public $body; public $inp_params; public $out_params; public $remotesvr; public $options; /* * @param RODSAccount account this is the account used to connect to iRODS server * @param string $rule_body body of the rule. Read this tutorial for details about rules: http://www.irods.org/index.php/Executing_user_defined_rules/workflow * @param array $inp_params associative array defining input parameters for micro services used in this rule. only string and keyval pair are supported at this time. If the array value is a string, then type is string, if the array value is an RODSKeyValPair object, it will be treated a keyval pair * @param array $out_params an array of names (strings) * @param array $remotesvr if this rule need to run at remote server, this associative array should have the following keys: * - 'host' remote host name or address * - 'port' remote port * - 'zone' remote zone * if any of the value is empty, this option will be ignored. * @param RODSKeyValPair $options an RODSKeyValPair specifying additional options, purpose of this is unknown at the developement time. Leave it alone if you are as clueless as me... */ public function __construct(RODSAccount $account, $rule_body, array $inp_params = array(), array $out_params = array(), array $remotesvr = array(), RODSKeyValPair $options = null) { $this->account = $account; $this->rule_body = $rule_body; $this->inp_params = $inp_params; $this->out_params = $out_params; $this->remotesvr = $remotesvr; if (isset($options)) $this->options = $options; else $this->options = new RODSKeyValPair(); } /** * Excute the rule, assign * @return an associative array. Each array key is the lable, and each array value's type will depend on the type of $out_param, at this moment, only string and RODSKeyValPair are supported */ public function execute() { $conn = RODSConnManager::getConn($this->account); $result = $conn->execUserRule($this->rule_body, $this->inp_params, $this->out_params, $this->remotesvr, $this->options = null); RODSConnManager::releaseConn($conn); return $result; } } ?>php-irods-3.3.0~beta1/prods/src/ProdsStreamer.class.php000066400000000000000000000264051221272161600230710ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ require_once("autoload.inc.php"); class ProdsStreamer { /** * current position of the file or dir * * @access private */ private $position; /** * Name of the directory/collection specified in the URI to opendir(). * * @access private */ private $dir; /** * Name of the file specified in the URI to fopen(). * * @access private */ private $file; /** * url_stat() handler. * * @access private */ public function url_stat($path) { try { $file=ProdsDir::fromURI($path); $conn = RODSConnManager::getConn($file->account); $stats = $this->stat_file($conn, $file->path_str); if (!$stats) { $stats = $this->stat_dir($conn, $file->path_str); } RODSConnManager::releaseConn($conn); return $stats; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * @param $conn * @param $file * @return mixed */ private function stat_dir($conn, $path_str) { try { $irods_stats = $conn->getDirStats($path_str); if (!$irods_stats) return false; $stats = array(); $stats[0] = $stats['dev'] = 0; $stats[1] = $stats['ino'] = 0; $stats[2] = $stats['mode'] = octdec('040755'); $stats[3] = $stats['nlink'] = 1; $stats[4] = $stats['uid'] = 0; $stats[5] = $stats['gid'] = 0; $stats[6] = $stats['rdev'] = -1; $stats[7] = $stats['size'] = 0; $stats[8] = $stats['atime'] = time(); $stats[9] = $stats['mtime'] = $irods_stats->mtime; $stats[10] = $stats['ctime'] = $irods_stats->ctime; $stats[11] = $stats['blksize'] = -1; $stats[12] = $stats['blocks'] = -1; return $stats; } catch (Exception $e) { trigger_error("Got an exception: $e", E_USER_WARNING); return false; } } /** * @param $conn * @param $file * @return mixed */ private function stat_file($conn, $path_str) { try { $irods_stats = $conn->getFileStats($path_str); if (!$irods_stats) return false; $stats = array(); $stats[0] = $stats['dev'] = 0; $stats[1] = $stats['ino'] = 0; $stats[2] = $stats['mode'] = octdec('100644'); $stats[3] = $stats['nlink'] = 1; $stats[4] = $stats['uid'] = 0; $stats[5] = $stats['gid'] = 0; $stats[6] = $stats['rdev'] = -1; $stats[7] = $stats['size'] = $irods_stats->size; $stats[8] = $stats['atime'] = time(); $stats[9] = $stats['mtime'] = $irods_stats->mtime; $stats[10] = $stats['ctime'] = $irods_stats->ctime; $stats[11] = $stats['blksize'] = -1; $stats[12] = $stats['blocks'] = -1; return $stats; } catch (Exception $e) { trigger_error("Got an exception: $e", E_USER_WARNING); return false; } } /** * mkdir() handler. * * @access private */ function mkdir ($url, $mode, $options) { try { $file=ProdsDir::fromURI($url); $conn = RODSConnManager::getConn($file->account); $conn->mkdir($file->path_str); RODSConnManager::releaseConn($conn); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * rmdir() handler * * @param $url * @return bool */ function rmdir ($url) { try { $file=ProdsDir::fromURI($url); $conn = RODSConnManager::getConn($file->account); $conn->rmdir($file->path_str); RODSConnManager::releaseConn($conn); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * unlink() handler. * * @access private */ function unlink ($url) { try { $file=ProdsDir::fromURI($url); $conn = RODSConnManager::getConn($file->account); if (is_dir($url)) { $conn->rmdir($file->path_str, true, true); } else { $conn->fileUnlink($file->path_str, NULL, true); } RODSConnManager::releaseConn($conn); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * rename() handler. * * @access private */ function rename ($url_from, $url_to) { try { $file_from=ProdsDir::fromURI($url_from); $file_to=ProdsDir::fromURI($url_to); $conn = RODSConnManager::getConn($file_from->account); if (is_dir($url_from)) { $conn->rename($file_from->path_str, $file_to->path_str, 0); } else { $conn->rename($file_from->path_str, $file_to->path_str, 1); } RODSConnManager::releaseConn($conn); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * opendir() handler. * * @access private */ public function dir_opendir ($path, $options) { try { $this->dir=ProdsDir::fromURI($path,true); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * readdir() handler. * * @access private */ public function dir_readdir() { try { $child = $this->dir->getNextChild(); if ($child === false) return false; return $child->getName(); } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fread() and fgets() handler. * * @access private */ public function stream_read ($count) { if (in_array ($this->file->getOpenMode(), array ('w', 'a', 'x'))) { return false; } try { $ret = $this->file->read($count); $this->position=$this->file->tell(); return $ret; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fwrite() handler. * * @access private */ public function stream_write ($data) { if ($this->file->getOpenMode() =='r') { return false; } try { $ret = $this->file->write($data); $this->position=$this->file->tell(); return $ret; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * rewinddir() handler. * * @access private */ public function dir_rewinddir() { try { $this->dir->rewind(); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * closedir() handler. * * @access private */ public function dir_closedir() { try { $this->dir->rewind(); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fopen() handler. * * @access private */ public function stream_open($path, $mode, $options, &$opened_path) { // get rid of tailing 'b', if any. if (($mode{strlen($mode) - 1} == 'b') && (strlen($mode) > 1)) $mode = substr($mode, 0, strlen($mode) - 1); try { $this->file = ProdsFile::fromURI($path); $this->file->open($mode); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fstat() handler. * * @access private */ function stream_stat () { try { $stats=$this->file->getStats(); return array ( -1, -1, -1, -1, -1, -1, $stats->size, time (), $stats->mtime, $stats->ctime, -1, -1, 'dev' => -1, 'ino' => -1, 'mode' => -1, 'nlink' => -1, 'uid' => -1, 'gid' => -1, 'rdev' => -1, 'size' => $stats->size, 'atime' => time (), 'mtime' => $stats->mtime, 'ctime' => $stats->ctime, 'blksize' => -1, 'blocks' => -1, ); } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fclose() handler. * * @access private */ function stream_close () { $this->file->close(); $this->position = 0; $this->file = null; $this->dir = null; } /** * ftell() handler. * * @access private */ function stream_tell() { return $this->position; } /** * feof() handler. * * @access private */ function stream_eof() { try { $stats = $this->file->getStats(); return $this->position >= $stats->size; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return true; } } /** * fseek() handler. * * @access private */ function stream_seek($offset, $whence) { try { $this->file->seek($offset, $whence); return true; } catch (Exception $e) { trigger_error("Got an exception:$e", E_USER_WARNING); return false; } } /** * fflush() handler. Please Note: This method must be called for any * changes to be committed to the repository. * * @access private */ function stream_flush() { return true; } } stream_wrapper_register('rods', 'ProdsStreamer') or die ('Failed to register protocol:rods'); stream_wrapper_register('rods+ticket', 'ProdsStreamer') or die ('Failed to register protocol:rods'); ?> php-irods-3.3.0~beta1/prods/src/ProdsTicket.class.php000066400000000000000000000017101221272161600225220ustar00rootroot00000000000000 * Date: 30.01.13 * Time: 14:15 */ require_once("autoload.inc.php"); class ProdsTicket { private $account; public function __construct( RODSAccount &$account ) { $this->account = $account; } /* * This is just a stupid wrapper * It proxifies RODSConn->createTicket */ public function createTicket( $object, $permission = 'read', $ticket = '' ) { $conn = RODSConnManager::getConn($this->account); $ticket = $conn->createTicket($object, $permission, $ticket ); RODSConnManager::releaseConn($conn); return $ticket; } /* * This is also a stupid wrapper * It proxifies RODSConn->deleteTicket */ public function deleteTicket( $ticket ) { $conn = RODSConnManager::getConn($this->account); $ticket = $conn->deleteTicket( $ticket ); RODSConnManager::releaseConn($conn); } }php-irods-3.3.0~beta1/prods/src/RODSAccount.class.php000066400000000000000000000133401221272161600223550ustar00rootroot00000000000000host=$host; $this->port=$port; $this->user=$user; $this->pass=$pass; $this->zone=$zone; $this->default_resc=$default_resc; $this->auth_type=$auth_type; $this->ticket = $ticket; } /** * Create a RODSAccount object from URI string. * @param string $uri * @return a new RODSAccount object */ public static function fromURI($uri) { $url=parse_url($uri); $host=isset($url['host'])?$url['host']:''; $port=isset($url['port'])?$url['port']:''; $user=''; $zone=''; $authtype='irods'; if (isset($url['user'])) { if (strstr($url['user'],".")!==false) { $user_array=@explode(".",$url['user']); if (count($user_array)===3) { $user=$user_array[0]; $zone=$user_array[1]; $authtype=$user_array[2]; } else { $user=$user_array[0]; $zone=$user_array[1]; } } else $user=$url['user']; } $pass=isset($url['pass'])?$url['pass']:''; return (new RODSAccount($host, $port, $user, $pass, $zone, "", $authtype,$ticket = '')); } public function equals(RODSAccount $other) { if (!isset($other)) return false; if (($this->host == $other->host) && ($this->port == $other->port) && ($this->user == $other->user) ) { $ret_val = true; } else $ret_val = false; //echo ( "$this->host,$this->port,$this->user vs. $other->host,$other->port,$other->user = $ret_val"); //flush(); return $ret_val; } public function getSignature() { return (bin2hex(md5("$this->user.$this->zone:this->pass@$this->host:$this->port.$this->ticket", TRUE))); } public function __toString() { return "$this->user.$this->zone:(password hidden)@$this->host:$this->port"; } public function toURI() { return ($this->user . (empty($this->zone) ? '' : '.' . $this->zone) . "@" . $this->host . ":" . $this->port); } /** * Get user information * @param string username, if not specified, it will use current username instead * @return array with fields: id, name, type, zone, dn, info, comment, ctime, mtime. If user not found return empty array. */ public function getUserInfo($username = NULL, $get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { //$conn = RODSConnManager::getConn($this); $conn = call_user_func_array($get_cb, array(&$this)); //TODO: Overcome fear of passing $this by reference or stop passing $this by reference $userinfo = $conn->getUserInfo($username); //RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); if ((!empty($userinfo)) && (!empty($userinfo['zone']))) $this->zone = $userinfo['zone']; return $userinfo; } /** * Get a temp password for current user * @return string of temp password */ public function getTempPassword($get_cb = array('RODSConnManager', 'getConn'), $rel_cb = array('RODSConnManager', 'releaseConn')) { //$conn = RODSConnManager::getConn($this); $conn = call_user_func_array($get_cb, array(&$this)); //TODO: Overcome fear of passing $this by reference or stop passing $this by reference $temppass = $conn->getTempPassword(); // RODSConnManager::releaseConn($conn); call_user_func($rel_cb, $conn); return $temppass; } /** * Get user's home directory * @param string init_path, if specified, it will overwrite the default path * @return ProdsDir User's home directory */ public function getUserHomeDir($init_path = NULL) { if (empty($this->zone)) $this->getUserInfo(); if (isset($init_path)) { $dir = new ProdsDir($this, $init_path); if ($dir->exists()) { return $dir; } } return new ProdsDir($this, "/$this->zone/home/$this->user"); } /** * Get user's home directory URI * @param string init_path, if specified, it will overwrite the default path * @return String User's home */ public function getUserHomeDirURI($init_path = NULL) { $dir = $this->getUserHomeDir($init_path); return $dir->toURI(); } /** * Get user's trash directory * @return ProdsDir User's trash dir */ public function getUserTrashDir() { if (empty($this->zone)) $this->getUserInfo(); return new ProdsDir($this, "/$this->zone/trash/home/$this->user"); } /** * Get user's trash directory URI * @return String User's trash URI */ public function getUserTrashDirURI() { $dir = $this->getUserTrashDir(); return $dir->toURI(); } } ?> php-irods-3.3.0~beta1/prods/src/RODSConn.class.php000066400000000000000000002125341221272161600216640ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package RODSConn */ require_once("autoload.inc.php"); require_once("RodsAPINum.inc.php"); require_once("RodsConst.inc.php"); if (!defined("O_RDONLY")) define ("O_RDONLY", 0); if (!defined("O_WRONLY")) define ("O_WRONLY", 1); if (!defined("O_RDWR")) define ("O_RDWR", 2); if (!defined("O_TRUNC")) define ("O_TRUNC", 512); class RODSConn { private $conn; // (resource) socket connection to RODS server private $account; // RODS user account private $idle; private $id; public $connected; /** * Makes a new connection to RODS server, with supplied user information (name, passwd etc.) * @param string $host hostname * @param string $port port number * @param string $user username * @param string $pass passwd * @param string $zone zonename */ public function __construct(RODSAccount &$account) { $this->account=$account; $this->connected=false; $this->conn=NULL; $this->idle=true; } public function __destruct() { if ($this->connected===true) $this->disconnect(); } public function equals(RODSConn $other) { return $this->account->equals($other->account); } public function getSignature() { return $this->account->getSignature(); } public function lock() { $this->idle=false; } public function unlock() { $this->idle=true; } public function isIdle() { return ($this->idle); } public function getId() { return $this->id; } public function setId($id) { $this->id=$id; } public function getAccount() { return $this->account; } public function connect() { $host=$this->account->host; $port=$this->account->port; $user=$this->account->user; $pass=$this->account->pass; $zone=$this->account->zone; $auth_type = $this->account->auth_type; // if we're going to use PAM, set up the socket context // options for SSL connections when we open the connection if (strcasecmp($auth_type, "PAM") == 0) { $ssl_opts = array('ssl' => array()); if (array_key_exists('ssl', $GLOBALS['PRODS_CONFIG'])) { $ssl_conf = $GLOBALS['PRODS_CONFIG']['ssl']; if (array_key_exists('verify_peer', $ssl_conf)) { if (strcasecmp("true", $ssl_conf['verify_peer']) == 0) { $ssl_opts['ssl']['verify_peer'] = true; } } if (array_key_exists('allow_self_signed', $ssl_conf)) { if (strcasecmp("true", $ssl_conf['allow_self_signed']) == 0) { $ssl_opts['ssl']['allow_self_signed'] = true; } } if (array_key_exists('cafile', $ssl_conf)) { $ssl_opts['ssl']['cafile'] = $ssl_conf['cafile']; } if (array_key_exists('capath', $ssl_conf)) { $ssl_opts['ssl']['capath'] = $ssl_conf['capath']; } } $ssl_ctx = stream_context_get_default($ssl_opts); $sock_timeout = ini_get("default_socket_timeout"); $conn = @stream_socket_client("tcp://$host:$port", $errno, $errstr, $sock_timeout, STREAM_CLIENT_CONNECT, $ssl_ctx); } else { $conn = @fsockopen($host, $port, $errno, $errstr); } if (!$conn) throw new RODSException("Connection to '$host:$port' failed.1: ($errno)$errstr. ", "SYS_SOCK_OPEN_ERR"); $this->conn=$conn; // connect to RODS server $msg=RODSMessage::packConnectMsg($user,$zone); fwrite($conn, $msg); $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { throw new RODSException("Connection to '$host:$port' failed.2. User: $user Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } // are we doing PAM authentication if (strcasecmp($auth_type, "PAM") == 0) { // Ask server to turn on SSL $req_packet = new RP_sslStartInp(); $msg=new RODSMessage("RODS_API_REQ_T", $req_packet, $GLOBALS['PRODS_API_NUMS']['SSL_START_AN']); fwrite($conn, $msg->pack()); $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { throw new RODSException("Connection to '$host:$port' failed.ssl1. User: $user Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } // Turn on SSL on our side if (!stream_socket_enable_crypto($conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { throw new RODSException("Error turning on SSL on connection to server '$host:$port'."); } // all good ... do the PAM authentication over the encrypted connection $req_packet = new RP_pamAuthRequestInp($user, $pass, -1); $msg=new RODSMessage("RODS_API_REQ_T", $req_packet, $GLOBALS['PRODS_API_NUMS']['PAM_AUTH_REQUEST_AN']); fwrite($conn, $msg->pack()); $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { throw new RODSException("PAM auth failed at server '$host:$port' User: $user Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } // Update the account object with the temporary password // and set the auth_type to irods for this connection $pack = $msg->getBody(); $pass = $this->account->pass = $pack->irodsPamPassword; // Done authentication ... turn ask the server to turn off SSL $req_packet = new RP_sslEndInp(); $msg=new RODSMessage("RODS_API_REQ_T", $req_packet, $GLOBALS['PRODS_API_NUMS']['SSL_END_AN']); fwrite($conn, $msg->pack()); $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { throw new RODSException("Connection to '$host:$port' failed.ssl2. User: $user Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } // De-activate SSL on the connection stream_socket_enable_crypto($conn, false); // nasty hack ... some characters are left over to be read // from the socket after the SSL shutdown, and I can't // figure out how to consume them via SSL routines, so I // just read them and throw them away. They need to be consumed // or later reads get out of sync with the API responses $r = array($conn); $w = $e = null; while (stream_select($r, $w, $e, 0) > 0) { $s = fread($conn, 1); } } // request authentication $msg=new RODSMessage("RODS_API_REQ_T",NULL, $GLOBALS['PRODS_API_NUMS']['AUTH_REQUEST_AN']); fwrite($conn, $msg->pack()); // get chalange string $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { throw new RODSException("Connection to '$host:$port' failed.3. User: $user Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $pack=$msg->getBody(); $challenge_b64encoded=$pack->challenge; $challenge=base64_decode($challenge_b64encoded); // encode chalange with passwd $pad_pass=str_pad($pass,MAX_PASSWORD_LEN,"\0"); $pwmd5=md5($challenge.$pad_pass,true); for ($i=0;$ipack()); // check if we are connected // get chalange string $msg=new RODSMessage(); $intInfo=$msg->unpack($conn); if ($intInfo<0) { $this->disconnect(); throw new RODSException("Connection to '$host:$port' failed.4 (login failed, possible wrong user/passwd). User: $user Pass: $pass Zone: $zone", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $this->connected=true; // use ticket if specified if( !empty($this->account->ticket) ) { $ticket_packet = new RP_ticketAdminInp('session', $this->account->ticket); $msg = new RODSMessage('RODS_API_REQ_T', $ticket_packet, 723); fwrite($conn, $msg->pack()); // get response $msg = new RODSMessage(); $intInfo = $msg->unpack($conn); if ($intInfo < 0) { $this->disconnect(); throw new RODSException('Cannot set session ticket.', $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } } /** * Close the connection (socket) */ public function disconnect($force = false) { if (($this->connected === false) && ($force !== true)) return; $msg = new RODSMessage("RODS_DISCONNECT_T"); fwrite($this->conn, $msg->pack()); fclose($this->conn); $this->connected = false; } public function createTicket( $object, $permission = 'read', $ticket = '' ) { if ($this->connected === false) { throw new RODSException("createTicket needs an active connection, but the connection is currently inactive", 'PERR_CONN_NOT_ACTIVE'); } if( empty($ticket) ) { // create a 16 characters long ticket $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for ($i = 0; $i < 16; $i++) $ticket .= $chars[mt_rand(1, strlen($chars))-1]; } $ticket_packet = new RP_ticketAdminInp('create', $ticket, $permission, $object); $msg = new RODSMessage('RODS_API_REQ_T', $ticket_packet, 723); fwrite($this->conn, $msg->pack()); // get response $msg = new RODSMessage(); $intInfo = $msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException('Cannot create ticket "'.$ticket.'" for object "'.$object.'" with permission "'.$permission.'".', $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } return $ticket; } public function deleteTicket( $ticket ) { if ($this->connected === false) { throw new RODSException("deleteTicket needs an active connection, but the connection is currently inactive", 'PERR_CONN_NOT_ACTIVE'); } $ticket_packet = new RP_ticketAdminInp('delete', $ticket); $msg = new RODSMessage('RODS_API_REQ_T', $ticket_packet, 723); fwrite($this->conn, $msg->pack()); // get response $msg = new RODSMessage(); $intInfo = $msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException('Cannot delete ticket "'.$ticket.'".', $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * Get a temp password from the server. * @param string $key key obtained from server to generate password. If this key is not specified, this function will ask server for a new key. * @return string temp password */ public function getTempPassword($key = NULL) { if ($this->connected === false) { throw new RODSException("getTempPassword needs an active connection, but the connection is currently inactive", 'PERR_CONN_NOT_ACTIVE'); } if (NULL == $key) $key = $this->getKeyForTempPassword(); $auth_str = str_pad($key . $this->account->pass, 100, "\0"); $pwmd5 = bin2hex(md5($auth_str, true)); return $pwmd5; } /** * Get a key for temp password from the server. this key can then be hashed together with real password to generate an temp password. * @return string key for temp password */ public function getKeyForTempPassword() { if ($this->connected === false) { throw new RODSException("getKeyForTempPassword needs an active connection, but the connection is currently inactive", 'PERR_CONN_NOT_ACTIVE'); } $msg = new RODSMessage("RODS_API_REQ_T", null, $GLOBALS['PRODS_API_NUMS']['GET_TEMP_PASSWORD_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::getKeyForTempPassword has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } return ($msg->getBody()->stringToHashWith); } /** * Get user information * @param string username, if not specified, it will use current username instead * @return array with fields: id, name, type, zone, dn, info, comment, ctime, mtime. If user not found return empty array. */ public function getUserInfo($user = NULL) { if (!isset($user)) $user = $this->account->user; // set selected value $select_val = array("COL_USER_ID", "COL_USER_NAME", "COL_USER_TYPE", "COL_USER_ZONE", "COL_USER_DN", "COL_USER_INFO", "COL_USER_COMMENT", "COL_USER_CREATE_TIME", "COL_USER_MODIFY_TIME"); $cond = array(new RODSQueryCondition("COL_USER_NAME", $user)); $que_result = $this->genQuery($select_val, $cond); if (false === $que_result) { return array(); } else { $retval = array(); $retval['id'] = $que_result["COL_USER_ID"][0]; $retval['name'] = $que_result["COL_USER_NAME"][0]; $retval['type'] = $que_result["COL_USER_TYPE"][0]; // $retval['zone']=$que_result["COL_USER_ZONE"][0]; This can cause confusion if // username is same as another federated grid - sometimes multiple records are returned. // Changed source to force user to provide a zone until another method is suggested. if ($this->account->zone == "") { $retval['zone'] = $que_result["COL_USER_ZONE"][0]; } else { $retval['zone'] = $this->account->zone; } $retval['dn'] = $que_result["COL_USER_DN"][0]; $retval['info'] = $que_result["COL_USER_INFO"][0]; $retval['comment'] = $que_result["COL_USER_COMMENT"][0]; $retval['ctime'] = $que_result["COL_USER_CREATE_TIME"][0]; $retval['mtime'] = $que_result["COL_USER_MODIFY_TIME"][0]; return $retval; } } /** * Make a new directory * @param string $dir input direcotory path string */ public function mkdir($dir) { $collInp_pk = new RP_CollInp($dir); $msg = new RODSMessage("RODS_API_REQ_T", $collInp_pk, $GLOBALS['PRODS_API_NUMS']['COLL_CREATE_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME') { throw new RODSException("Collection '$dir' Already exists!", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } throw new RODSException("RODSConn::mkdir has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * remove a directory * @param string $dirpath input direcotory path string * @param boolean $recursive whether recursively delete all child files and child directories recursively. * @param boolean $force whether force delete the file/dir. If force delete, all files will be wiped physically. Else, they are moved to trash derectory. * @param array $additional_flags An array of keyval pairs (array) reprenting additional flags passed to the server/client message. Each keyval pair is an array with first element repsenting the key, and second element representing the value (default to ''). Supported keys are: * - 'irodsRmTrash' - whether this rm is a rmtrash operation * - 'irodsAdminRmTrash' - whether this rm is a rmtrash operation done by admin user * @param mixed $status_update_func It can be an string or array that represents the status update function (see http://us.php.net/manual/en/language.pseudo-types.php#language.types.callback), which can update status based on the server status update. Leave it blank or 'null' if there is no need to update the status. The function will be called with an assossive arry as parameter, supported fields are: * - 'filesCnt' - finished number of files from previous update (normally 10 but not the last update) * - 'lastObjPath' - last object that was processed. * If this function returns 1, progress will be stopped. */ public function rmdir($dirpath, $recursive = true, $force = false, $additional_flags = array(), $status_update_func = null) { $options = array(); if ($force === true) { $options["forceFlag"] = ""; } if ($recursive === true) { $options["recursiveOpr"] = ""; } foreach ($additional_flags as $flagkey => $flagval) { if (!empty($flagkey)) $options[$flagkey] = $flagval; } $options_pk = new RP_KeyValPair(); $options_pk->fromAssocArray($options); $collInp_pk = new RP_CollInp($dirpath, $options_pk); $msg = new RODSMessage("RODS_API_REQ_T", $collInp_pk, $GLOBALS['PRODS_API_NUMS']['RM_COLL_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); while ($msg->getBody() instanceof RP_CollOprStat) { if (is_callable($status_update_func)) // call status update function if requested { $status = call_user_func($status_update_func, array( "filesCnt" => $msg->getBody()->filesCnt, "lastObjPath" => $msg->getBody()->lastObjPath ) ); if (false === $status) throw new Exception("status_update_func failed!"); else if (1 == $status) { return; } } if ($intInfo == 0) //stop here if intinfo =0 (process completed) break; $this->replyStatusPacket(); $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); } if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { return; } throw new RODSException("RODSConn::rmdir has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } // this is a temp work around for status packet reply. // in status packet protocol, the server gives a status update packet: // SYS_SVR_TO_CLI_COLL_STAT (99999996) // and it expects an integer only SYS_CLI_TO_SVR_COLL_STAT_REPLY (99999997) private function replyStatusPacket() { fwrite($this->conn, pack("N", 99999997)); } /** * Get children direcotories of input direcotory path string * @param string $dir input direcotory path string * @return an array of string, each string is the name of a child directory. This fuction return empty array, if there is no child direcotry found */ public function getChildDir($dir, $startingInx = 0, $maxresults = 500, &$total_num_rows = -1) { $cond = array(new RODSQueryCondition("COL_COLL_PARENT_NAME", $dir)); $que_result = $this->genQuery(array("COL_COLL_NAME"), $cond, array(), $startingInx, $maxresults, true, array(), 0, $total_num_rows); if (false === $que_result) { return array(); } else { if ($dir == "/") { $result = array(); foreach ($que_result["COL_COLL_NAME"] as $childdir) { if ($childdir != "/") { $result[] = $childdir; } } return $result; } return array_values($que_result["COL_COLL_NAME"]); } } /** * Get children direcotories, with basic stats, of input direcotory path string * @param string $dir input direcotory path string * @param $orderby An associated array specifying how to sort the result by attributes. Each array key is the attribute, array val is 0 (assendent) or 1 (dessendent). The supported attributes are "name", "owner", "mtime". * @return an array of RODSDirStats */ public function getChildDirWithStats($dir, $orderby = array(), $startingInx = 0, $maxresults = 500, &$total_num_rows = -1) { // set selected value $select_val = array("COL_COLL_NAME", "COL_COLL_ID", "COL_COLL_OWNER_NAME", "COL_COLL_OWNER_ZONE", "COL_COLL_CREATE_TIME", "COL_COLL_MODIFY_TIME", "COL_COLL_COMMENTS"); $select_attr = array(); // set order by if (!empty($orderby)) { $select_attr = array_fill(0, count($select_val), 1); foreach ($orderby as $key => $val) { if ($key == "name") { if ($val == 0) $select_attr[0] = ORDER_BY; else $select_attr[0] = ORDER_BY_DESC; } else if ($key == "owner") { if ($val == 0) $select_attr[2] = ORDER_BY; else $select_attr[2] = ORDER_BY_DESC; } else if ($key == "mtime") { if ($val == 0) $select_attr[5] = ORDER_BY; else $select_attr[5] = ORDER_BY_DESC; } } } $cond = array(new RODSQueryCondition("COL_COLL_PARENT_NAME", $dir)); $continueInx = 0; $que_result = $this->genQuery($select_val, $cond, array(), $startingInx, $maxresults, true, $select_attr, $continueInx, $total_num_rows); if (false === $que_result) { return array(); } else { $ret_val = array(); for ($i = 0; $i < count($que_result['COL_COLL_ID']); $i++) { if ($que_result['COL_COLL_NAME'][$i] != "/") { $ret_val[] = new RODSDirStats( basename($que_result['COL_COLL_NAME'][$i]), $que_result['COL_COLL_OWNER_NAME'][$i], $que_result['COL_COLL_OWNER_ZONE'][$i], $que_result['COL_COLL_MODIFY_TIME'][$i], $que_result['COL_COLL_CREATE_TIME'][$i], $que_result['COL_COLL_ID'][$i], $que_result['COL_COLL_COMMENTS'][$i] ); } } return $ret_val; } } /** * Get children file of input direcotory path string * @param string $dir input direcotory path string * @return an array of string, each string is the name of a child file. This fuction return empty array, if there is no child direcotry found. */ public function getChildFile($dir, $startingInx = 0, $maxresults = 500, &$total_num_rows = -1) { $cond = array(new RODSQueryCondition("COL_COLL_NAME", $dir)); $que_result = $this->genQuery(array("COL_DATA_NAME"), $cond, array(), $startingInx, $maxresults, true, array(), 0, $total_num_rows); if (false === $que_result) { return array(); } else { return array_values($que_result["COL_DATA_NAME"]); } } /** * Get children file, with basic stats, of input direcotory path string * The stats * @param string $dir input direcotory path string * @param $orderby An associated array specifying how to sort the result by attributes. Each array key is the attribute, array val is 0 (assendent) or 1 (dessendent). The supported attributes are "name", "size", "owner", "mtime". * @return an array of RODSFileStats */ public function getChildFileWithStats($dir, array $orderby = array(), $startingInx = 0, $maxresults = 500, &$total_num_rows = -1) { // set selected value $select_val = array("COL_DATA_NAME", "COL_D_DATA_ID", "COL_DATA_TYPE_NAME", "COL_D_RESC_NAME", "COL_DATA_SIZE", "COL_D_OWNER_NAME", "COL_D_CREATE_TIME", "COL_D_MODIFY_TIME"); $select_attr = array(); // set order by if (!empty($orderby)) { $select_attr = array_fill(0, count($select_val), 1); foreach ($orderby as $key => $val) { if ($key == "name") { if ($val == 0) $select_attr[0] = ORDER_BY; else $select_attr[0] = ORDER_BY_DESC; } else if ($key == "size") { if ($val == 0) $select_attr[4] = ORDER_BY; else $select_attr[4] = ORDER_BY_DESC; } else if ($key == "owner") { if ($val == 0) $select_attr[5] = ORDER_BY; else $select_attr[5] = ORDER_BY_DESC; } else if ($key == "mtime") { if ($val == 0) $select_attr[7] = ORDER_BY; else $select_attr[7] = ORDER_BY_DESC; } } } $cond = array(new RODSQueryCondition("COL_COLL_NAME", $dir)); $continueInx = 0; $que_result = $this->genQuery($select_val, $cond, array(), $startingInx, $maxresults, true, $select_attr, $continueInx, $total_num_rows); if (false === $que_result) { return array(); } else { $ret_val = array(); for ($i = 0; $i < count($que_result['COL_D_DATA_ID']); $i++) { $ret_val[] = new RODSFileStats( $que_result['COL_DATA_NAME'][$i], $que_result['COL_DATA_SIZE'][$i], $que_result['COL_D_OWNER_NAME'][$i], $que_result['COL_D_MODIFY_TIME'][$i], $que_result['COL_D_CREATE_TIME'][$i], $que_result['COL_D_DATA_ID'][$i], $que_result['COL_DATA_TYPE_NAME'][$i], $que_result['COL_D_RESC_NAME'][$i] ); } return $ret_val; } } /** * Get basic stats, of input dir path string * @param string $dirpath input dir path string * @return RODSDirStats. If dir does not exists, return fales. */ public function getDirStats($dirpath) { $cond = array(new RODSQueryCondition("COL_COLL_NAME", $dirpath)); $que_result = $this->genQuery( array("COL_COLL_NAME", "COL_COLL_ID", "COL_COLL_OWNER_NAME", "COL_COLL_OWNER_ZONE", "COL_COLL_CREATE_TIME", "COL_COLL_MODIFY_TIME", "COL_COLL_COMMENTS"), $cond, array(), 0, 1, false); if ($que_result === false) return false; $stats = new RODSDirStats( basename($que_result['COL_COLL_NAME'][0]), $que_result['COL_COLL_OWNER_NAME'][0], $que_result['COL_COLL_OWNER_ZONE'][0], $que_result['COL_COLL_MODIFY_TIME'][0], $que_result['COL_COLL_CREATE_TIME'][0], $que_result['COL_COLL_ID'][0], $que_result['COL_COLL_COMMENTS'][0] ); return $stats; } /** * Get basic stats, of input file path string * @param string $filepath input file path string * @return RODSFileStats. If file does not exists, return fales. */ public function getFileStats($filepath) { $parent = dirname($filepath); $filename = basename($filepath); $cond = array(new RODSQueryCondition("COL_COLL_NAME", $parent), new RODSQueryCondition("COL_DATA_NAME", $filename)); $que_result = $this->genQuery( array("COL_DATA_NAME", "COL_D_DATA_ID", "COL_DATA_TYPE_NAME", "COL_D_RESC_NAME", "COL_DATA_SIZE", "COL_D_OWNER_NAME", "COL_D_OWNER_ZONE", "COL_D_CREATE_TIME", "COL_D_MODIFY_TIME", "COL_D_COMMENTS"), $cond, array(), 0, 1, false); if ($que_result === false) return false; $stats = new RODSFileStats( $que_result['COL_DATA_NAME'][0], $que_result['COL_DATA_SIZE'][0], $que_result['COL_D_OWNER_NAME'][0], $que_result['COL_D_OWNER_ZONE'][0], $que_result['COL_D_MODIFY_TIME'][0], $que_result['COL_D_CREATE_TIME'][0], $que_result['COL_D_DATA_ID'][0], $que_result['COL_DATA_TYPE_NAME'][0], $que_result['COL_D_RESC_NAME'][0], $que_result['COL_D_COMMENTS'][0]); return $stats; } /** * Check whether a directory (in string) exists on RODS server. * @return true/false */ public function dirExists($dir) { $cond = array(new RODSQueryCondition("COL_COLL_NAME", $dir)); $que_result = $this->genQuery(array("COL_COLL_ID"), $cond); if ($que_result === false) return false; else return true; } /** * Check whether a file (in string) exists on RODS server. * @return true/false */ public function fileExists($filepath, $rescname = NULL) { $parent = dirname($filepath); $filename = basename($filepath); if (empty($rescname)) { $cond = array(new RODSQueryCondition("COL_COLL_NAME", $parent), new RODSQueryCondition("COL_DATA_NAME", $filename)); $que_result = $this->genQuery(array("COL_D_DATA_ID"), $cond); } else { $cond = array(new RODSQueryCondition("COL_COLL_NAME", $parent), new RODSQueryCondition("COL_DATA_NAME", $filename), new RODSQueryCondition("COL_D_RESC_NAME", $rescname)); $que_result = $this->genQuery(array("COL_D_DATA_ID"), $cond); } if ($que_result === false) return false; else return true; } /** * Replicate file to resources with options. * @param string $path_src full path for the source file * @param string $desc_resc destination resource * @param array $options an assosive array of options: * - 'all' (boolean): only meaningful if input resource is a resource group. Replicate to all the resources in the resource group. * - 'backupMode' (boolean): if a good copy already exists in this resource, don't make another copy. * - 'admin' (boolean): admin user uses this option to backup/replicate other users files * - 'replNum' (integer): the replica to copy, typically not needed * - 'srcResc' (string): specifies the source resource of the data object to be replicate, only copies stored in this resource will be replicated. Otherwise, one of the copy will be replicated * These options are all 'optional', if omitted, the server will try to do it anyway * @return number of bytes written if success, in case of faliure, throw an exception */ public function repl($path_src, $desc_resc, array $options = array()) { require_once(dirname(__FILE__) . "/RODSObjIOOpr.inc.php"); require_once(dirname(__FILE__) . "/RodsGenQueryKeyWd.inc.php"); $optype = REPLICATE_OPR; $opt_arr = array(); $opt_arr[$GLOBALS['PRODS_GENQUE_KEYWD']['DEST_RESC_NAME_KW']] = $desc_resc; foreach ($options as $option_key => $option_val) { switch ($option_key) { case 'all': if ($option_val === true) $opt_arr[$GLOBALS['PRODS_GENQUE_KEYWD']['ALL_KW']] = ''; break; case 'admin': if ($option_val === true) $opt_arr[$GLOBALS['PRODS_GENQUE_KEYWD']['IRODS_ADMIN_KW']] = ''; break; case 'replNum': $opt_arr[$GLOBALS['PRODS_GENQUE_KEYWD']['REPL_NUM_KW']] = $option_val; break; case 'backupMode': if ($option_val === true) $opt_arr[$GLOBALS['PRODS_GENQUE_KEYWD'] ['BACKUP_RESC_NAME_KW']] = $desc_resc; break; default: throw new RODSException("Option '$option_key'=>'$option_val' is not supported", 'PERR_USER_INPUT_ERROR'); } } $keyvalpair = new RP_KeyValPair(); $keyvalpair->fromAssocArray($opt_arr); $inp_pk = new RP_DataObjInp($path_src, 0, 0, 0, 0, 0, $optype, $keyvalpair); $msg = new RODSMessage("RODS_API_REQ_T", $inp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_REPL_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::repl has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $retpk = $msg->getBody(); return $retpk->bytesWritten; } /** * Rename path_src to path_dest. * @param string $path_src * @param string $path_dest * @param integer $path_type if 0, then path type is file, if 1, then path type if directory * @return true/false */ public function rename($path_src, $path_dest, $path_type) { require_once(dirname(__FILE__) . "/RODSObjIOOpr.inc.php"); if ($path_type === 0) { $path_type_magic_num = RENAME_DATA_OBJ; } else { $path_type_magic_num = RENAME_COLL; } $src_pk = new RP_DataObjInp($path_src, 0, 0, 0, 0, 0, $path_type_magic_num); $dest_pk = new RP_DataObjInp($path_dest, 0, 0, 0, 0, 0, $path_type_magic_num); $inp_pk = new RP_DataObjCopyInp($src_pk, $dest_pk); $msg = new RODSMessage("RODS_API_REQ_T", $inp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_RENAME_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::rename has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * Open a file path (string) exists on RODS server. * * @param string $path file path * @param string $mode open mode. Supported modes are: * 'r' Open for reading only; place the file pointer at the beginning of the file. * 'r+' Open for reading and writing; place the file pointer at the beginning of the file. * 'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * 'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. * 'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. * 'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. * 'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. * 'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. * @param postion updated position * @param string $rescname. Note that this parameter is required only if the file does not exists (create mode). If the file already exists, and if file resource is unknown or unique or you-dont-care for that file, leave the field, or pass NULL. * @param boolean $assum_file_exists. This parameter specifies whether file exists. If the value is false, this mothod will check with RODS server to make sure. If value is true, the check will NOT be done. Default value is false. * @param string $filetype. This parameter only make sense when you want to specify the file type, if file does not exists (create mode). If not specified, it defaults to "generic" * @param integer $cmode. This parameter is only used for "createmode". It specifies the file mode on physical storage system (RODS vault), in octal 4 digit format. For instance, 0644 is owner readable/writeable, and nothing else. 0777 is all readable, writable, and excutable. If not specified, and the open flag requirs create mode, it defaults to 0644. * @return integer level 1 descriptor */ public function openFileDesc($path, $mode, &$position, $rescname = NULL, $assum_file_exists = false, $filetype = 'generic', $cmode = 0644) { $create_if_not_exists = false; $error_if_exists = false; $seek_to_end_of_file = false; $position = 0; switch ($mode) { case 'r': $open_flag = O_RDONLY; break; case 'r+': $open_flag = O_RDWR; break; case 'w': $open_flag = O_WRONLY|O_TRUNC; $create_if_not_exists = true; break; case 'w+': $open_flag = O_RDWR|O_TRUNC; $create_if_not_exists = true; break; case 'a': $open_flag = O_WRONLY; $create_if_not_exists = true; $seek_to_end_of_file = true; break; case 'a+': $open_flag = O_RDWR; $create_if_not_exists = true; $seek_to_end_of_file = true; break; case 'x': $open_flag = O_WRONLY; $create_if_not_exists = true; $error_if_exists = true; break; case 'x+': $open_flag = O_RDWR; $create_if_not_exists = true; $error_if_exists = true; break; default: throw new RODSException("RODSConn::openFileDesc() does not recognize input mode:'$mode' ", "PERR_USER_INPUT_ERROR"); } if ($assum_file_exists === true) $file_exists = true; else $file_exists = $this->fileExists($path, $rescname); if (($error_if_exists) && ($file_exists === true)) { throw new RODSException("RODSConn::openFileDesc() expect file '$path' dose not exists with mode '$mode', but the file does exists", "PERR_USER_INPUT_ERROR"); } if (($create_if_not_exists) && ($file_exists === false)) // create new file { $keyValPair_pk = new RP_KeyValPair(2, array("rescName", "dataType"), array("$rescname", "$filetype")); $dataObjInp_pk = new RP_DataObjInp($path, $cmode, $open_flag, 0, -1, 0, 0, $keyValPair_pk); $api_num = $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_CREATE_AN']; } else // open existing file { // open the file and get descriptor if (isset($rescname)) { $keyValPair_pk = new RP_KeyValPair(1, array("rescName"), array("$rescname")); $dataObjInp_pk = new RP_DataObjInp ($path, 0, $open_flag, 0, -1, 0, 0, $keyValPair_pk); } else { $dataObjInp_pk = new RP_DataObjInp ($path, 0, $open_flag, 0, -1, 0, 0); } $api_num = $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_OPEN_AN']; } $msg = new RODSMessage("RODS_API_REQ_T", $dataObjInp_pk, $api_num); fwrite($this->conn, $msg->pack()); // send it // get value back $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { throw new RODSException("trying to open a file '$path' " . "which does not exists with mode '$mode' ", "PERR_USER_INPUT_ERROR"); } throw new RODSException("RODSConn::openFileDesc has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $l1desc = $intInfo; if ($seek_to_end_of_file === true) { $position = $this->fileSeek($l1desc, 0, SEEK_END); } return $l1desc; } /** * unlink the file on server * @param string $path path of the file * @param string $rescname resource name. Not required if there is no other replica. * @param boolean $force flag (true or false) indicating whether force delete or not. * */ public function fileUnlink($path, $rescname = NULL, $force = false) { $options = array(); if (isset($rescname)) { $options['rescName'] = $rescname; } if ($force == true) { $options['forceFlag'] = ""; } if (!empty($options)) { $options_pk = new RP_KeyValPair(); $options_pk->fromAssocArray($options); $dataObjInp_pk = new RP_DataObjInp ($path, 0, 0, 0, -1, 0, 0, $options_pk); } else { $dataObjInp_pk = new RP_DataObjInp ($path, 0, 0, 0, -1, 0, 0); } $msg = new RODSMessage("RODS_API_REQ_T", $dataObjInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_UNLINK_AN']); fwrite($this->conn, $msg->pack()); // send it // get value back $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { throw new RODSException("trying to unlink a file '$path' " . "which does not exists", "PERR_USER_INPUT_ERROR"); } throw new RODSException("RODSConn::fileUnlink has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * close the input file descriptor on RODS server. * * @param int $l1desc level 1 file descriptor */ public function closeFileDesc($l1desc) { try { $dataObjCloseInp_pk = new RP_dataObjCloseInp($l1desc); $msg = new RODSMessage("RODS_API_REQ_T", $dataObjCloseInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_CLOSE_AN']); fwrite($this->conn, $msg->pack()); // send it // get value back $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { trigger_error("Got an error from server:$intInfo", E_USER_WARNING); } } catch (RODSException $e) { trigger_error("Got an exception:$e", E_USER_WARNING); } } /** * reads up to length bytes from the file pointer referenced by handle. Reading stops when up to length bytes have been read, EOF (end of file) is reached * * @param int $l1desc level 1 file descriptor * @param int $length up to how many bytes to read. * @return the read string. */ public function fileRead($l1desc, $length) { $dataObjReadInp_pk = new RP_dataObjReadInp($l1desc, $length); $msg = new RODSMessage("RODS_API_REQ_T", $dataObjReadInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_READ_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::fileRead has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } return $msg->getBinstr(); } /** * writes up to length bytes from the file pointer referenced by handle. returns number of bytes writtne. * * @param int $l1desc level 1 file descriptor * @param string $string contents (binary safe) to be written * @param int $length up to how many bytes to read. * @return the number of bytes written. */ public function fileWrite($l1desc, $string, $length = NULL) { if (!isset($length)) $length = strlen($string); $dataObjWriteInp_pk = new RP_dataObjWriteInp($l1desc, $length); $msg = new RODSMessage("RODS_API_REQ_T", $dataObjWriteInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_WRITE_AN'], $string); fwrite($this->conn, $msg->pack()); // send header and body msg fwrite($this->conn, $string); // send contents $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::fileWrite has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } return $intInfo; } /** * Sets the file position indicator for the file referenced by l1desc (int descriptor). The new position, measured in bytes from the beginning of the file, is obtained by adding offset to the position specified by whence, whose values are defined as follows: * SEEK_SET - Set position equal to offset bytes. * SEEK_CUR - Set position to current location plus offset. * SEEK_END - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) * If whence is not specified, it is assumed to be SEEK_SET. * @return int the current offset */ public function fileSeek($l1desc, $offset, $whence = SEEK_SET) { $dataObjReadInp_pk = new RP_fileLseekInp($l1desc, $offset, $whence); $msg = new RODSMessage("RODS_API_REQ_T", $dataObjReadInp_pk, $GLOBALS['PRODS_API_NUMS']['DATA_OBJ_LSEEK_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::fileSeek has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $retpk = $msg->getBody(); return $retpk->offset; } /** * Get metadata for a file, dir, resource or user * @param char $pathtype 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param string $name name of the target object. in the case of file and dir, use its full path * @return RODSMeta $meta meta data for the target. */ public function getMeta($pathtype, $name) { switch ($pathtype) { case 'd': $select = array("COL_META_DATA_ATTR_NAME", "COL_META_DATA_ATTR_VALUE", "COL_META_DATA_ATTR_UNITS", 'COL_META_DATA_ATTR_ID'); $condition = array( new RODSQueryCondition("COL_COLL_NAME", dirname($name)), new RODSQueryCondition("COL_DATA_NAME", basename($name)) ); break; case 'c': $select = array("COL_META_COLL_ATTR_NAME", "COL_META_COLL_ATTR_VALUE", "COL_META_COLL_ATTR_UNITS", 'COL_META_COLL_ATTR_ID'); $condition = array(new RODSQueryCondition("COL_COLL_NAME", $name)); break; case 'r': $select = array("COL_META_RESC_ATTR_NAME", "COL_META_RESC_ATTR_VALUE", "COL_META_RESC_ATTR_UNITS", 'COL_META_RESC_ATTR_ID'); $condition = array(new RODSQueryCondition("COL_R_RESC_NAME", $name)); break; case 'u': $select = array("COL_META_USER_ATTR_NAME", "COL_META_USER_ATTR_VALUE", "COL_META_USER_ATTR_UNITS", 'COL_META_USER_ATTR_ID'); $condition = array(new RODSQueryCondition("COL_USER_NAME", $name)); break; default: throw new RODSException("RODSConn::getMeta pathtype '$pathtype' is not supported!", 'PERR_USER_INPUT_ERROR'); } $genque_result = $this->genQuery($select, $condition); if ($genque_result === false) { return array(); } $ret_array = array(); for ($i = 0; $i < count($genque_result[$select[0]]); $i++) { $ret_array[$i] = new RODSMeta( $genque_result[$select[0]][$i], $genque_result[$select[1]][$i], $genque_result[$select[2]][$i], $genque_result[$select[3]][$i] ); } return $ret_array; } /** * Add metadata to a file, dir, resource or user * @param char $pathtype 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param string $name name of the target object. in the case of file and dir, use its full path * @param RODSMeta $meta meta data to be added. */ public function addMeta($pathtype, $name, RODSMeta $meta) { $pkt = new RP_ModAVUMetadataInp("add", "-$pathtype", $name, $meta->name, $meta->value, $meta->units); $msg = new RODSMessage("RODS_API_REQ_T", $pkt, $GLOBALS['PRODS_API_NUMS']['MOD_AVU_METADATA_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::addMeta has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * remove metadata to a file, dir, resource or user * @param char $pathtype 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param string $name name of the target object. in the case of file and dir, use its full path * @param RODSMeta $meta meta data to be removed. */ public function rmMeta($pathtype, $name, RODSMeta $meta) { $pkt = new RP_ModAVUMetadataInp("rm", "-$pathtype", $name, $meta->name, $meta->value, $meta->units); $msg = new RODSMessage("RODS_API_REQ_T", $pkt, $GLOBALS['PRODS_API_NUMS']['MOD_AVU_METADATA_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::rmMeta has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * remove metadata to a file, dir, resource or user * @param char $pathtype 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param string $name name of the target object. in the case of file and dir, use its full path * @param integer $metaid id of the metadata to be removed. */ public function rmMetaByID($pathtype, $name, $metaid) { $pkt = new RP_ModAVUMetadataInp("rmi", "-$pathtype", $name, $metaid); $msg = new RODSMessage("RODS_API_REQ_T", $pkt, $GLOBALS['PRODS_API_NUMS']['MOD_AVU_METADATA_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) != 'CAT_SUCCESS_BUT_WITH_NO_INFO') { throw new RODSException("RODSConn::rmMetaByID has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } } /** * copy metadata between file, dir, resource or user * @param char $pathtype_src source path type 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param char $pathtype_dest destination path type 'd'=file, 'c'=dir, 'r'=resource, 'u'=user * @param string $name_src name of the source target object. in the case of file and dir, use its full path * @param string $name_dest name of the destination target object. in the case of file and dir, use its full path */ public function cpMeta($pathtype_src, $pathtype_dest, $name_src, $name_dest) { $pkt = new RP_ModAVUMetadataInp("cp", "-$pathtype_src", "-$pathtype_dest", $name_src, $name_dest); $msg = new RODSMessage("RODS_API_REQ_T", $pkt, $GLOBALS['PRODS_API_NUMS']['MOD_AVU_METADATA_AN']); fwrite($this->conn, $msg->pack()); // send it $msg = new RODSMessage(); $intInfo = (int)$msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::cpMeta has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } /** * Excute a user defined rule * @param string $rule_body body of the rule. Read this tutorial for details about rules: http://www.irods.org/index.php/Executing_user_defined_rules/workflow * @param array $inp_params associative array defining input parameter for micro services used in this rule. only string and keyval pair are supported at this time. If the array value is a string, then type is string, if the array value is an RODSKeyValPair object, it will be treated a keyval pair * @param array $out_params an array of names (strings) * @param array $remotesvr if this rule need to run at remote server, this associative array should have the following keys: * - 'host' remote host name or address * - 'port' remote port * - 'zone' remote zone * if any of the value is empty, this option will be ignored. * @param RODSKeyValPair $options an RODSKeyValPair specifying additional options, purpose of this is unknown at the developement time. Leave it alone if you are as clueless as me... * @return an associative array. Each array key is the lable, and each array value's type will depend on the type of $out_param, at this moment, only string and RODSKeyValPair are supported */ public function execUserRule($rule_body, array $inp_params = array(), array $out_params = array(), array $remotesvr = array(), RODSKeyValPair $options = null) { $inp_params_packets = array(); foreach ($inp_params as $inp_param_key => $inp_param_val) { if (is_a($inp_param_val, 'RODSKeyValPair')) { $inp_params_packets[] = new RP_MsParam($inp_param_key, $inp_param_val->makePacket()); } else // a string { $inp_params_packets[] = new RP_MsParam($inp_param_key, new RP_STR($inp_param_val)); } } $inp_param_arr_packet = new RP_MsParamArray($inp_params_packets); $out_params_desc = implode('%', $out_params); if ((isset($remotesvr['host'])) && (isset($remotesvr['port'])) && (isset($remotesvr['zone'])) ) { $remotesvr_packet = new RP_RHostAddr($remotesvr['host'], $remotesvr['zone'], $remotesvr['port']); } else { $remotesvr_packet = new RP_RHostAddr(); } if (!isset($options)) $options = new RODSKeyValPair(); $options_packet = $options->makePacket(); $pkt = new RP_ExecMyRuleInp($rule_body, $remotesvr_packet, $options_packet, $out_params_desc, $inp_param_arr_packet); $msg = new RODSMessage("RODS_API_REQ_T", $pkt, $GLOBALS['PRODS_API_NUMS']['EXEC_MY_RULE_AN']); fwrite($this->conn, $msg->pack()); // send it $resv_msg = new RODSMessage(); $intInfo = (int)$resv_msg->unpack($this->conn); if ($intInfo < 0) { throw new RODSException("RODSConn::execUserRule has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $retpk = $resv_msg->getBody(); $param_array = $retpk->MsParam_PI; $ret_arr = array(); foreach ($param_array as $param) { if ($param->type == 'STR_PI') { $label = $param->label; $ret_arr["$label"] = $param->STR_PI->myStr; } else if ($param->type == 'KeyValPair_PI') { $label = $param->label; $ret_arr["$label"] = RODSKeyValPair::fromPacket($param->KeyValPair_PI); } else if ($param->type == 'ExecCmdOut_PI') { $label = $param->label; $exec_ret_val = $param->ExecCmdOut_PI->buf; $ret_arr["$label"] = $exec_ret_val; } else { throw new RODSException("RODSConn::execUserRule got. " . "an unexpected output param with type: '$param->type' \n", "PERR_UNEXPECTED_PACKET_FORMAT"); } } return $ret_arr; } /** * This function is depreciated, and kept only for lagacy reasons! * Makes a general query to RODS server. Think it as an SQL. "select foo from sometab where bar = '3'". In this example, foo is specified by "$select", bar and "= '3'" are speficed by condition. * @param array $select the fields (names) to be returned/interested. There can not be more than 50 input fields. For example:"COL_COLL_NAME" means collection-name. * @param array $condition Array of RODSQueryCondition. All fields are defined in RodsGenQueryNum.inc.php * @param array $condition_kw Array of RODSQueryCondition. All fields are defined in RodsGenQueryKeyWd.inc.php * @param integer $startingInx result start from which row. * @param integer $maxresult up to how man rows should the result contain. * @param boolean $getallrows whether to retreive all results * @param boolean $select_attr attributes (array of int) of each select value. For instance, the attribute can be ORDER_BY (0x400) or ORDER_BY_DESC (0x800) to have the results sorted on the server. The default value is 1 for each attribute. Pass empty array or leave the option if you don't want anything fancy. * @param integer $continueInx This index can be used to retrieve rest of results, when there is a overflow of the rows (> 500) * @return an associated array, keys are the returning field names, each value is an array of the field values. Also, it returns false (boolean), if no rows are found. * Note: This function is very low level. It's not recommended for beginners. */ public function genQuery(array $select, array $condition = array(), array $condition_kw = array(), $startingInx = 0, $maxresults = 500, $getallrows = true, array $select_attr = array(), &$continueInx = 0, &$total_num_rows = -1) { if (count($select) > 50) { trigger_error("genQuery(): Only upto 50 input are supported, rest ignored", E_USER_WARNING); $select = array_slice($select, 0, 50); } $GenQueInp_options = 0; if ($total_num_rows != -1) { $GenQueInp_options = 1; } require_once("RodsGenQueryNum.inc.php"); //load magic numbers require_once("RodsGenQueryKeyWd.inc.php"); //load magic numbers // contruct select packet (RP_InxIvalPair $selectInp) $select_pk = NULL; if (count($select) > 0) { if (empty($select_attr)) $select_attr = array_fill(0, count($select), 1); $idx = array(); foreach ($select as $selval) { if (isset($GLOBALS['PRODS_GENQUE_NUMS']["$selval"])) $idx[] = $GLOBALS['PRODS_GENQUE_NUMS']["$selval"]; else trigger_error("genQuery(): select val '$selval' is not support, ignored", E_USER_WARNING); } $select_pk = new RP_InxIvalPair(count($select), $idx, $select_attr); } else { $select_pk = new RP_InxIvalPair(); } foreach ($condition_kw as &$cond_kw) { if (isset($GLOBALS['PRODS_GENQUE_KEYWD'][$cond_kw->name])) $cond_kw->name = $GLOBALS['PRODS_GENQUE_KEYWD'][$cond_kw->name]; } foreach ($condition as &$cond) { if (isset($GLOBALS['PRODS_GENQUE_NUMS'][$cond->name])) $cond->name = $GLOBALS['PRODS_GENQUE_NUMS'][$cond->name]; } $condInput = new RP_KeyValPair(); $condInput->fromRODSQueryConditionArray($condition_kw); $sqlCondInp = new RP_InxValPair(); $sqlCondInp->fromRODSQueryConditionArray($condition); // construct RP_GenQueryInp packet $genque_input_pk = new RP_GenQueryInp($maxresults, $continueInx, $condInput, $select_pk, $sqlCondInp, $GenQueInp_options, $startingInx); // contruce a new API request message, with type GEN_QUERY_AN $msg = new RODSMessage("RODS_API_REQ_T", $genque_input_pk, $GLOBALS['PRODS_API_NUMS']['GEN_QUERY_AN']); fwrite($this->conn, $msg->pack()); // send it // get value back $msg_resv = new RODSMessage(); $intInfo = $msg_resv->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { return false; } throw new RODSException("RODSConn::genQuery has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $genque_result_pk = $msg_resv->getBody(); $result_arr = array(); for ($i = 0; $i < $genque_result_pk->attriCnt; $i++) { $sql_res_pk = $genque_result_pk->SqlResult_PI[$i]; $attri_name = $GLOBALS['PRODS_GENQUE_NUMS_REV'][$sql_res_pk->attriInx]; $result_arr["$attri_name"] = $sql_res_pk->value; } if ($total_num_rows != -1) $total_num_rows = $genque_result_pk->totalRowCount; $more_results = true; // if there are more results to be fetched while (($genque_result_pk->continueInx > 0) && ($more_results === true) && ($getallrows === true)) { $msg->getBody()->continueInx = $genque_result_pk->continueInx; fwrite($this->conn, $msg->pack()); // re-send it with new continueInx // get value back $msg_resv = new RODSMessage(); $intInfo = $msg_resv->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { $more_results = false; break; } else throw new RODSException("RODSConn::genQuery has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $genque_result_pk = $msg_resv->getBody(); for ($i = 0; $i < $genque_result_pk->attriCnt; $i++) { $sql_res_pk = $genque_result_pk->SqlResult_PI[$i]; $attri_name = $GLOBALS['PRODS_GENQUE_NUMS_REV'][$sql_res_pk->attriInx]; $result_arr["$attri_name"] = array_merge($result_arr["$attri_name"], $sql_res_pk->value); } } // Make sure and close the query if there are any results left. if ($genque_result_pk->continueInx > 0) { $msg->getBody()->continueInx=$genque_result_pk->continueInx; $msg->getBody()->maxRows=-1; // tells the server to close the query fwrite($this->conn, $msg->pack()); $msg_resv=new RODSMessage(); $intInfo=$msg_resv->unpack($this->conn); if ($intInfo<0) { throw new RODSException("RODSConn::genQuery has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } return $result_arr; } /** * Makes a general query to RODS server. Think it as an SQL. "select foo from sometab where bar = '3'". In this example, foo is specified by "$select", bar and "= '3'" are speficed by condition. * @param RODSGenQueSelFlds $select the fields (names) to be returned/interested. There can not be more than 50 input fields. For example:"COL_COLL_NAME" means collection-name. * @param RODSGenQueConds $condition All fields are defined in RodsGenQueryNum.inc.php and RodsGenQueryKeyWd.inc.php * @param integer $start result start from which row. * @param integer $limit up to how many rows should the result contain. If -1 is passed, all available rows will be returned * @return RODSGenQueResults * Note: This function is very low level. It's not recommended for beginners. */ public function query(RODSGenQueSelFlds $select, RODSGenQueConds $condition, $start = 0, $limit = -1) { if (($select->getCount() < 1) || ($select->getCount() > 50)) { throw new RODSException("Only 1-50 fields are supported", 'PERR_USER_INPUT_ERROR'); } // contruct select packet (RP_InxIvalPair $selectInp), and condition packets $select_pk = $select->packetize(); $cond_pk = $condition->packetize(); $condkw_pk = $condition->packetizeKW(); // determin max number of results per query if (($limit > 0) && ($limit < 500)) $max_result_per_query = $limit; else $max_result_per_query = 500; $num_fetched_rows = 0; $continueInx = 0; $results = new RODSGenQueResults(); do { // construct RP_GenQueryInp packet $options = 1 | $GLOBALS['PRODS_GENQUE_NUMS']['RETURN_TOTAL_ROW_COUNT']; $genque_input_pk = new RP_GenQueryInp($max_result_per_query, $continueInx, $condkw_pk, $select_pk, $cond_pk, $options, $start); // contruce a new API request message, with type GEN_QUERY_AN $msg = new RODSMessage("RODS_API_REQ_T", $genque_input_pk, $GLOBALS['PRODS_API_NUMS']['GEN_QUERY_AN']); fwrite($this->conn, $msg->pack()); // send it // get value back $msg_resv = new RODSMessage(); $intInfo = $msg_resv->unpack($this->conn); if ($intInfo < 0) { if (RODSException::rodsErrCodeToAbbr($intInfo) == 'CAT_NO_ROWS_FOUND') { break; } throw new RODSException("RODSConn::query has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } $genque_result_pk = $msg_resv->getBody(); $num_row_added = $results->addResults($genque_result_pk); $continueInx = $genque_result_pk->continueInx; $start = $start + $results->getNumRow(); } while (($continueInx > 0) && (($results->getNumRow() < $limit) || ($limit < 0))); // Make sure and close the query if there are any results left. if ($continueInx > 0) { $msg->getBody()->continueInx=$continueInx; $msg->getBody()->maxRows=-1; // tells the server to close the query fwrite($this->conn, $msg->pack()); $msg_resv=new RODSMessage(); $intInfo=$msg_resv->unpack($this->conn); if ($intInfo<0) { throw new RODSException("RODSConn::query has got an error from the server", $GLOBALS['PRODS_ERR_CODES_REV']["$intInfo"]); } } return $results; } } ?> php-irods-3.3.0~beta1/prods/src/RODSConnManager.class.php000066400000000000000000000046071221272161600231570ustar00rootroot00000000000000waiting_queue = array(); $this->conn_map = array(); } public static function getConn(RODSAccount $account) { $manager = $GLOBALS['RODSConnManager']; $conn = new RODSConn($account); $conn_sig = $conn->getSignature(); if (!isset($manager->conn_map[$conn_sig])) $manager->conn_map[$conn_sig] = array(); //check if there is any opened connection idle foreach ($manager->conn_map[$conn_sig] as &$opened_conn) { if ($opened_conn->isIdle()) { //$opened_conn->lock(); $account = $opened_conn->getAccount(); //update account if needed... return $opened_conn; } } //check if there is any more new connection allowed if (count($manager->conn_map[$conn_sig]) < MAX_NUM_CONN_PER_USER_SERVER) { $conn->connect(); $id = count($manager->conn_map[$conn_sig]); $manager->conn_map[$conn_sig][$id] = $conn; $conn->setId($id); //$conn->lock(); $account = $conn->getAccount(); //update account if needed... return $conn; } //because PHP doesn't support multithread, if we run out of connections, //there is probably something went wrong. throw new RODSException("Unexpectedly ran out of connections. Maybe some connections are not released??? ", "PERR_INTERNAL_ERR"); //if no connection are available, sleep for 100ms and retry usleep(100); echo "i am sleeping...
\n"; return RODSConnManager::getConn($account); } public static function releaseConn(RODSConn $conn) { $manager = $GLOBALS['RODSConnManager']; $conn_sig = $conn->getSignature(); //echo "id:".$conn->getId()." ".implode(",",array_keys($manager->conn_map[$conn_sig]))."
\n"; if (isset($manager->conn_map[$conn_sig][$conn->getId()])) { $manager->conn_map[$conn_sig][$conn->getId()]->unlock(); } } } ?>php-irods-3.3.0~beta1/prods/src/RODSDirStats.class.php000066400000000000000000000010151221272161600225120ustar00rootroot00000000000000name = $name; $this->owner = $owner; $this->ownerzone = $ownerzone; $this->mtime = $mtime; $this->ctime = $ctime; $this->id = $id; $this->comments = $comments; } } php-irods-3.3.0~beta1/prods/src/RODSException.class.php000066400000000000000000000141171221272161600227220ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package Prods */ $errtable_file = dirname(__FILE__) . "/RodsErrorTable.inc.php"; if (is_readable($errtable_file)) require_once($errtable_file); else die("Could not read file $errtable_file
\n"); /** * custom exception class for RODS */ class RODSException extends Exception { private $code_abbr; private $cause; /** * Makes a new RODS excption * @param string $message err/exception message * @param string $code_abbr error code abbreviation */ public function __construct($message, $code_abbr = "UNKNOWN_PRODS_ERR", Exception $cause = NULL) { $this->code_abbr = $code_abbr; $this->cause = $cause; parent::__construct($message, $GLOBALS['PRODS_ERR_CODES'][$code_abbr]); } public function getCause() { return $this->cause; } public function getCodeAbbr() { return $this->code_abbr; } public static function rodsErrCodeToAbbr($code) { if (isset($GLOBALS['PRODS_ERR_CODES_REV']["$code"])) return $GLOBALS['PRODS_ERR_CODES_REV']["$code"]; else return null; } public static function rodsErrAbbrToCode($codeabbr) { if (isset($GLOBALS['PRODS_ERR_CODES']["$codeabbr"])) return $GLOBALS['PRODS_ERR_CODES']["$codeabbr"]; else return null; } public function getStackTrace() { if ($this->cause !== null) { $arr = array(); $trace = $this->getTrace(); array_push($arr, $trace[0]); unset($trace); if (get_class($this->cause) == "RODSException") { foreach ($this->cause->getStackTrace() as $key => $trace) { array_push($arr, $trace); } } else { foreach ($this->cause->getTrace() as $key => $trace) { array_push($arr, $trace); } } return $arr; } else { return $this->getTrace(); } } public function showStackTrace() { $htmldoc = "

An exception was thrown :
"; $htmldoc .= "Exception code : $this->code
"; $htmldoc .= "Exception abbr : $this->code_abbr
"; $htmldoc .= "Exception message : $this->message
"; $htmldoc .= ""; $i = 0; foreach ($this->getStackTrace() as $key => $trace) { $htmldoc .= $this->showTrace($trace, $i); $i++; } $htmldoc .= "#$i {main}
"; unset($i); $htmldoc .= "

"; return $htmldoc; } private function showTrace($_trace, $_i) { $htmldoc = "#$_i "; if (array_key_exists("file", $_trace)) { $htmldoc .= $_trace["file"]; } if (array_key_exists("line", $_trace)) { $htmldoc .= "(" . $_trace["line"] . "): "; } if (array_key_exists("class", $_trace) && array_key_exists("type", $_trace)) { $htmldoc .= $_trace["class"] . $_trace["type"]; } if (array_key_exists("function", $_trace)) { $htmldoc .= $_trace["function"] . "("; if (array_key_exists("args", $_trace)) { if (count($_trace["args"]) > 0) { $args = $_trace["args"]; $type = gettype($args[0]); $value = $args[0]; unset($args); if ($type == "boolean") { if ($value) { $htmldoc .= "true"; } else { $htmldoc .= "false"; } } elseif ($type == "integer" || $type == "double") { if (settype($value, "string")) { if (strlen($value) <= 20) { $htmldoc .= $value; } else { $htmldoc .= substr($value, 0, 17) . "..."; } } else { if ($type == "integer") { $htmldoc .= "? integer ?"; } else { $htmldoc .= "? double or float ?"; } } } elseif ($type == "string") { if (strlen($value) <= 18) { $htmldoc .= "'$value'"; } else { $htmldoc .= "'" . substr($value, 0, 15) . "...'"; } } elseif ($type == "array") { $htmldoc .= "Array"; } elseif ($type == "object") { $htmldoc .= "Object"; } elseif ($type == "resource") { $htmldoc .= "Resource"; } elseif ($type == "NULL") { $htmldoc .= "null"; } elseif ($type == "unknown type") { $htmldoc .= "? unknown type ?"; } unset($type); unset($value); } if (count($_trace["args"]) > 1) { $htmldoc .= ",..."; } } $htmldoc .= ")
"; } return $htmldoc; } /** * Magic function to turn exception obj to a string */ public function __toString() { return __CLASS__ . ": [{$this->code} $this->code_abbr]: {$this->message}\n"; //return $this->showStackTrace(); } } ?> php-irods-3.3.0~beta1/prods/src/RODSFileStats.class.php000066400000000000000000000015221221272161600226560ustar00rootroot00000000000000name = $name; $this->size = $size; $this->owner = $owner; $this->ownerzone = $ownerzone; $this->mtime = $mtime; $this->ctime = $ctime; $this->id = $id; $this->typename = $typename; $this->rescname = $rescname; $this->comments = $comments; $this->num_replica = $num_replica; } } php-irods-3.3.0~beta1/prods/src/RODSGenQueConds.class.php000066400000000000000000000112101221272161600231260ustar00rootroot00000000000000=' and val='0', then the triplex means * "foo >= 0" as one iRODS general query condition. * @param array (of string) $names names of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'. * @param array (of string) $ops logical operator, such as '=' 'like' '>' * @param array (of string) $vals value of the filed */ public function __construct(array $names = array(), array $ops = array(), array $vals = array()) { require_once("RodsGenQueryNum.inc.php"); //load magic numbers require_once("RodsGenQueryKeyWd.inc.php"); //load magic keywords $this->cond = array('names' => array(), 'sysnames' => array(), 'values' => array()); $this->cond_kw = array('names' => array(), 'sysnames' => array(), 'values' => array()); for ($i = 0; $i < count($names); $i++) { $name = $names[$i]; $op = $ops[$i]; $val = $vals[$i]; if (isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) { $this->cond['names'][] = $name; $this->cond['sysnames'][] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"]; $this->cond['values'][] = "$op '$val'"; } else if (isset($GLOBALS['PRODS_GENQUE_KEYWD']["$name"])) { $this->cond_kw['names'][] = $name; $this->cond_kw['sysnames'][] = $GLOBALS['PRODS_GENQUE_KEYWD']["$name"]; $this->cond_kw['values'][] = "$op '$val'"; } else { throw new RODSException("General Query condition field name '$name' is not valid", 'PERR_USER_INPUT_ERROR'); } } } /** * Add a single select field. * @param string $name names of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'. * @param string $op logical operator, such as '=' 'like' '>' * @param string $val value of the filed * @param array an array of tuples of extra op's and val's, each tuple is an assosive array that has key 'op' and 'val'. These conditions will be 'OR' with the other conditions. * for example add ('COL_D_DATA_ID','like', '/tempZone/home/rods/%', array(array('op'=>'=','val'=>'/tempZone/home/rods'"))) * would select all file ids both in subdirectories under '/tempZone/home/rods' and directly under '/tempZone/home/rods' */ public function add($name, $op, $val, array $OR_ops_vals = array()) { require_once("RodsGenQueryNum.inc.php"); //load magic numbers require_once("RodsGenQueryKeyWd.inc.php"); //load magic keywords if (isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) { $this->cond['names'][] = $name; $this->cond['sysnames'][] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"]; $value = "$op '$val'"; foreach ($OR_ops_vals as $op_val) { $or_op = $op_val['op']; $or_val = $op_val['val']; if (empty($or_op) || empty($or_val)) continue; $value = $value . " || $or_op '$or_val'"; } $this->cond['values'][] = $value; } else if (isset($GLOBALS['PRODS_GENQUE_KEYWD']["$name"])) { $this->cond_kw['names'][] = $name; $this->cond_kw['sysnames'][] = $GLOBALS['PRODS_GENQUE_KEYWD']["$name"]; $value = "$op '$val'"; foreach ($OR_ops_vals as $op_val) { $or_op = $op_val['op']; $or_val = $op_val['val']; if (empty($or_op) || empty($or_val)) continue; $value = $value . " || $or_op '$or_val'"; } $this->cond_kw['values'][] = $value; } else { throw new RODSException("General Query condition field name '$name' is not valid", 'PERR_USER_INPUT_ERROR'); } } /** * make a RP_InxValPair. */ public function packetize() { return (new RP_InxValPair(count($this->cond['names']), $this->cond['sysnames'], $this->cond['values'])); } /** * make a RP_KeyValPair. */ public function packetizeKW() { return (new RP_KeyValPair(count($this->cond_kw['names']), $this->cond_kw['sysnames'], $this->cond_kw['values'])); } public function getCond() { return $this->cond; } } ?>php-irods-3.3.0~beta1/prods/src/RODSGenQueResults.class.php000066400000000000000000000061321221272161600235300ustar00rootroot00000000000000total_count = $total_count; $this->values = $result_array; $this->numcol = count($result_array); if ($this->numcol > 0) $this->numrow = count(current($result_array)); else $this->numrow = 0; } /** * Add general query result packet RP_GenQueryOut, directly from the protocol level query, into the result structure. * @param RP_GenQueryOut $genque_result_pk result packet directly from the protocol level query. * @return number of rows just added */ public function addResults(RP_GenQueryOut $genque_result_pk) { if ($genque_result_pk->totalRowCount > $this->total_count) $this->total_count = $genque_result_pk->totalRowCount; require_once("RodsGenQueryNum.inc.php"); //load magic numbers $num_row_added = 0; for ($i = 0; $i < $genque_result_pk->attriCnt; $i++) { $sql_res_pk = $genque_result_pk->SqlResult_PI[$i]; $attri_name = $GLOBALS['PRODS_GENQUE_NUMS_REV'][$sql_res_pk->attriInx]; if (empty($this->values["$attri_name"])) $this->values["$attri_name"] = $sql_res_pk->value; else array_splice($this->values["$attri_name"], count($this->values["$attri_name"]), 0, $sql_res_pk->value); if ($i == 0) { $num_row_added = count($sql_res_pk->value); if ($num_row_added != (int)$genque_result_pk->rowCnt) { throw new RODSException("Gen Query result packet num row mismatch. Expect: $genque_result_pk->rowCnt, got: $num_row_added", 'PERR_UNEXPECTED_PACKET_FORMAT'); } } } $this->numcol = count($this->values); if ($this->numcol > 0) $this->numrow = count(current($this->values)); else $this->numrow = 0; return $num_row_added; } /** * get result values in (2-d) array, each array key is the name * used RODSGenQueSelFlds, such as COL_COLL_NAME */ public function getValues() { return $this->values; } /** * get total result count, including all the potential results not returned. */ public function getTotalCount() { return $this->total_count; } /** * get number of columns/fields of the results. */ public function getNumCol() { return $this->numcol; } /** * get number of rows of the results. */ public function getNumRow() { return $this->numrow; } } ?>php-irods-3.3.0~beta1/prods/src/RODSGenQueSelFlds.class.php000066400000000000000000000122141221272161600234210ustar00rootroot00000000000000names = $names; $this->attrs = array(); $this->indexes = array(); for ($i = 0; $i < count($names); $i++) { $name = $names[$i]; if (!isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) { throw new RODSException("General Query select field name '$name' is not valid", 'PERR_USER_INPUT_ERROR'); } $this->indexes[] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"]; $this->attrs[] = RODSGenQueSelFlds::attr2GenQueNumber($attrs[$i]); } } /** * Add a single select field. * * @param string name name of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'. */ public function add($name, $attr = NULL) { require_once("RodsGenQueryNum.inc.php"); //load magic numbers if (!isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) { throw new RODSException("General Query select field name '$name' is not valid", 'PERR_USER_INPUT_ERROR'); } $this->indexes[] = $GLOBALS['PRODS_GENQUE_NUMS']["$name"]; $this->names[] = $name; $this->attrs[] = RODSGenQueSelFlds::attr2GenQueNumber($attr); } /** * update a single select field's attr/value. Note that if the value already exists, * it will OR the bits. This is used when you want more than one type of operation * for a select field, such as select_max and sort. */ public function update($name, $attr) { require_once("RodsGenQueryNum.inc.php"); //load magic numbers if (!isset($GLOBALS['PRODS_GENQUE_NUMS']["$name"])) { throw new RODSException("General Query select field name '$name' is not valid", 'PERR_USER_INPUT_ERROR'); } $newattr = RODSGenQueSelFlds::attr2GenQueNumber($attr); for ($i = 0; $i < count($this->names); $i++) { if ($this->names[$i] == $name) { if ($this->attrs[$i] == 1) $this->attrs[$i] = $newattr; else $this->attrs[$i] = $newattr | $this->attrs[$i]; return; } } $this->add($name, $attr); } /** * Convert supported attribute to magic number, that iRODS protocol uses * Following attributes are supported: * - 'order_by_asc' order the result by this field, in ASCENDING order * - 'order_by_desc' order the result by this field, in DESCENDING order * - min minimum of the group * - max maximum of the group * - sum sum of the group * - avg average of the group * - count count of the group */ public static function attr2GenQueNumber($attr) { if (empty($attr)) return 1; $retval = 1; switch ($attr) { case 'order_by_asc': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['ORDER_BY']; break; case 'order_by_desc': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['ORDER_BY_DESC']; break; case 'min': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['SELECT_MIN']; break; case 'max': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['SELECT_MAX']; break; case 'sum': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['SELECT_SUM']; break; case 'avg': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['SELECT_AVG']; break; case 'count': $retval = $GLOBALS['PRODS_GENQUE_NUMS']['SELECT_COUNT']; break; default: throw new RODSException("Unexpected attribute: '$attr'", 'PERR_USER_INPUT_ERROR'); } return intval($retval); } /** * make a RP_InxIvalPair, a low level iRODS packet */ public function packetize() { return (new RP_InxIvalPair(count($this->names), $this->indexes, $this->attrs)); } public function getIndexes() { return $this->indexes; } public function getAttrs() { return $this->attrs; } public function getCount() { return count($this->names); } public function getNames() { return $this->names; } } ?> php-irods-3.3.0~beta1/prods/src/RODSKeyValPair.class.php000066400000000000000000000021201221272161600227620ustar00rootroot00000000000000 * @copyright Copyright © 2007, TBD * @package RODSConn */ require_once("autoload.inc.php"); class RODSKeyValPair { private $keys; private $vals; public function __construct(array $arr = array()) { $this->keys = array_keys($arr); $this->vals = array_values($arr); } public function addPair($key, $val) { $this->keys[] = $key; $this->vals[] = $val; } /** * Make a RP_KeyValPair * @return RP_KeyValPair a RP_KeyValPair object */ public function makePacket() { return new RP_KeyValPair(count($this->keys), $this->keys, $this->vals); } /** * make a RODSKeyValPair from a RP_KeyValPair */ public static function fromPacket(RP_KeyValPair $RP_KeyValPair) { $new_keyval = new RODSKeyValPair(); $new_keyval->keys = $RP_KeyValPair->keyWord; $new_keyval->vals = $RP_KeyValPair->svalue; return $new_keyval; } } ?>php-irods-3.3.0~beta1/prods/src/RODSMessage.class.php000066400000000000000000000147721221272161600223570ustar00rootroot00000000000000 "RODS_CONNECT", "RODS_VERSION_T" => "RODS_VERSION", "RODS_API_REQ_T" => "RODS_API_REQ", "RODS_DISCONNECT_T" => "RODS_DISCONNECT", "RODS_REAUTH_T" => "RODS_REAUTH", "RODS_API_REPLY_T" => "RODS_API_REPLY" ); class RODSMessage { private $type; // (String) message type, such as "RODS_CONNECT_T" private $typestr; // (String) str representation of the type that RODS server understand private $msg; // (RODSPacket) main message body private $header; // (RODSPacket) a special packet, header for other packets private $header_xml; // (string) packet header in XML private $msg_xml; // (string) message in XML private $binstr; // (string) binary string private $errstr; // (string) error string private $intinfo; // an additional integer info, for API, it is the // apiReqNum private $serialized; public function __construct($type = NULL, $_msg = NULL, $intinfo = 0, $binstr = "", $errstr = "") { if (!isset($type)) { return; } $this->type = $type; $RODSMessage_types = $GLOBALS['RODSMessage_types']; if (!isset($RODSMessage_types[$type])) { throw new RODSException("RODSMessage::__construct failed.1! Unknown type '$type'", "PERR_INTERNAL_ERR"); } $this->typestr = $RODSMessage_types[$type]; if (isset($_msg)) { if (!($_msg instanceof RODSPacket)) { throw new RODSException("RODSMessage::__construct failed.2!", "PERR_INTERNAL_ERR"); } } $this->msg = $_msg; $this->intinfo = $intinfo; $this->binstr = $binstr; $this->errstr = $errstr; } public function pack() { if (isset($this->msg)) $this->msg_xml = $this->msg->toXML(); $this->header = new RP_MsgHeader($this->typestr, strlen($this->msg_xml), strlen($this->errstr), strlen($this->binstr), $this->intinfo); $header_xml = $this->header->toXML(); $this->serialized = pack("N", strlen($header_xml)) . $header_xml . $this->msg_xml; return $this->serialized; } public function unpack($conn, &$bslen = NULL) { if (FALSE === ($chunk = stream_get_contents($conn, 4))) { throw new RODSException("RODSMessage::unpack failed.0! ", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } $arr = unpack("Nlen", $chunk); $header_len = $arr['len']; if ((!is_int($header_len)) || ($header_len < 1) || ($header_len > 8192 - 4)) { throw new RODSException("RODSMessage::unpack failed.1! The header length is unexpected: '$header_len'", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } $this->header_xml = stream_get_contents($conn, $header_len); $this->parseHeaderXML($this->header_xml); $intInfo = $this->header->intInfo; // get main msg string $msg_len = $this->header->msgLen; $this->msg_xml = stream_get_contents($conn, $msg_len); if ($msg_len != strlen($this->msg_xml)) { throw new RODSException("RODSMessage::unpack failed.2! " . "The body length is unexpected: " . strlen($this->msg_xml) . " expecting: $msg_len", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } if ($msg_len > 0) { $this->parseBodyXML($this->msg_xml); } // get err string $errlen = $this->header->errorLen; $this->errstr = stream_get_contents($conn, $errlen); if ($errlen != strlen($this->errstr)) { throw new RODSException("RODSMessage::unpack failed.3! " . "The err length is unexpected: " . strlen($this->errstr) . " expecting: $errlen", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } // get bin string $bslen = $this->header->bsLen; $this->binstr = stream_get_contents($conn, $bslen); if ($bslen != strlen($this->binstr)) { throw new RODSException("RODSMessage::unpack failed.4! " . "The bin str length is unexpected: " . strlen($this->binstr) . " expecting: $bslen", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } return $this->header->intInfo; } private function parseHeaderXML($xmlstr) { $xml = new SimpleXMLElement($xmlstr); $name = $xml->getName(); if ($name != "MsgHeader_PI") { throw new RODSException("RODSMessage::parseHeaderXML failed! " . "The XML header name is unexpected:$name " . " expecting: MsgHeader_PI", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } $this->header = new RP_MsgHeader(); $this->header->fromSXE($xml); } private function parseBodyXML($xmlstr) { //try { $xml = new SimpleXMLElement($xmlstr); $name = $xml->getName(); if (substr($name, -3, 3) != "_PI") { throw new RODSException("RODSMessage::parseMainBodyXML failed! " . "The XML node's name is unexpected:$name " . " expecting some thing like xxx_PI", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } $rp_classname = "RP_" . substr($name, 0, strlen($name) - 3); $this->msg = new $rp_classname(); $this->msg->fromSXE($xml); /*} catch (Exception $e) { throw new RODSException("RODSMessage::parseMainBodyXML failed! ". "Mal formated XML in RODS message :". $xmlstr, "SYS_PACK_INSTRUCT_FORMAT_ERR",$e); } */ } public function getBody() { return $this->msg; } public function getBinstr() { return $this->binstr; } public function getXML() { return $this->header_xml . "\n" . $this->msg_xml; } public static function packConnectMsg($user, $zone, $relVersion = RODS_REL_VERSION, $apiVersion = RODS_API_VERSION, $option = NULL) { $msgbody = new RP_StartupPack($user, $zone, $relVersion, $apiVersion . $option); $rods_msg = new RODSMessage("RODS_CONNECT_T", $msgbody); return $rods_msg->pack(); } } ?>php-irods-3.3.0~beta1/prods/src/RODSMeta.class.php000066400000000000000000000005751221272161600216550ustar00rootroot00000000000000name = $name; $this->value = $value; $this->units = $units; $this->id = $id; $this->op = $op; } } php-irods-3.3.0~beta1/prods/src/RODSObjIOOpr.inc.php000066400000000000000000000010161221272161600220450ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/src/RODSQueryCondition.class.php000066400000000000000000000005671221272161600237440ustar00rootroot00000000000000name = $name; $this->value = $value; $this->op = $op; } public function __toString() { return "$this->name $this->op '$this->value'"; } } php-irods-3.3.0~beta1/prods/src/RodsAPINum.inc.php000066400000000000000000000161351221272161600216630ustar00rootroot00000000000000 '500', 'FILE_OPEN_AN' => '501', 'FILE_WRITE_AN' => '502', 'FILE_CLOSE_AN' => '503', 'FILE_LSEEK_AN' => '504', 'FILE_READ_AN' => '505', 'FILE_UNLINK_AN' => '506', 'FILE_MKDIR_AN' => '507', 'FILE_CHMOD_AN' => '508', 'FILE_RMDIR_AN' => '509', 'FILE_STAT_AN' => '510', 'FILE_FSTAT_AN' => '511', 'FILE_FSYNC_AN' => '512', 'FILE_STAGE_AN' => '513', 'FILE_GET_FS_FREE_SPACE_AN' => '514', 'FILE_OPENDIR_AN' => '515', 'FILE_CLOSEDIR_AN' => '516', 'FILE_READDIR_AN' => '517', 'FILE_PUT_AN' => '518', 'FILE_GET_AN' => '519', 'FILE_CHKSUM_AN' => '520', 'CHK_N_V_PATH_PERM_AN' => '521', 'FILE_RENAME_AN' => '522', 'FILE_TRUNCATE_AN' => '523', 'DATA_OBJ_CREATE_AN' => '601', 'DATA_OBJ_OPEN_AN' => '602', 'DATA_OBJ_READ_AN' => '603', 'DATA_OBJ_WRITE_AN' => '604', 'DATA_OBJ_CLOSE_AN' => '605', 'DATA_OBJ_PUT_AN' => '606', 'DATA_PUT_AN' => '607', 'DATA_OBJ_GET_AN' => '608', 'DATA_GET_AN' => '609', 'DATA_OBJ_REPL_AN' => '610', 'DATA_COPY_AN' => '611', 'DATA_OBJ_LSEEK_AN' => '612', 'DATA_OBJ_COPY_AN' => '613', 'SIMPLE_QUERY_AN' => '614', 'DATA_OBJ_UNLINK_AN' => '615', 'COLL_CREATE_AN' => '616', 'RM_COLL_OLD_AN' => '617', 'REG_COLL_AN' => '618', 'REG_DATA_OBJ_AN' => '619', 'UNREG_DATA_OBJ_AN' => '620', 'REG_REPLICA_AN' => '621', 'MOD_DATA_OBJ_META_AN' => '622', 'RULE_EXEC_SUBMIT_AN' => '623', 'RULE_EXEC_DEL_AN' => '624', 'EXEC_MY_RULE_AN' => '625', 'OPR_COMPLETE_AN' => '626', 'DATA_OBJ_RENAME_AN' => '627', 'DATA_OBJ_RSYNC_AN' => '628', 'DATA_OBJ_CHKSUM_AN' => '629', 'PHY_PATH_REG_AN' => '630', 'DATA_OBJ_PHYMV_AN' => '631', 'DATA_OBJ_TRIM_AN' => '632', 'OBJ_STAT_AN' => '633', 'EXEC_CMD_AN' => '634', 'SUB_STRUCT_FILE_CREATE_AN' => '635', 'SUB_STRUCT_FILE_OPEN_AN' => '636', 'SUB_STRUCT_FILE_READ_AN' => '637', 'SUB_STRUCT_FILE_WRITE_AN' => '638', 'SUB_STRUCT_FILE_CLOSE_AN' => '639', 'SUB_STRUCT_FILE_UNLINK_AN' => '640', 'SUB_STRUCT_FILE_STAT_AN' => '641', 'SUB_STRUCT_FILE_FSTAT_AN' => '642', 'SUB_STRUCT_FILE_LSEEK_AN' => '643', 'SUB_STRUCT_FILE_RENAME_AN' => '644', 'QUERY_SPEC_COLL_AN' => '645', 'MOD_COLL_AN' => '646', 'SUB_STRUCT_FILE_MKDIR_AN' => '647', 'SUB_STRUCT_FILE_RMDIR_AN' => '648', 'SUB_STRUCT_FILE_OPENDIR_AN' => '649', 'SUB_STRUCT_FILE_READDIR_AN' => '650', 'SUB_STRUCT_FILE_CLOSEDIR_AN' => '651', 'DATA_OBJ_TRUNCATE_AN' => '652', 'SUB_STRUCT_FILE_TRUNCATE_AN' => '653', 'GET_XMSG_TICKET_AN' => '654', 'SEND_XMSG_AN' => '655', 'RCV_XMSG_AN' => '656', 'SUB_STRUCT_FILE_GET_AN' => '657', 'SUB_STRUCT_FILE_PUT_AN' => '658', 'SYNC_MOUNTED_COLL_AN' => '659', 'STRUCT_FILE_SYNC_AN' => '660', 'CLOSE_COLLECTION_AN' => '661', 'COLL_REPL_AN' => '662', 'RM_COLL_AN' => '663', 'GET_MISC_SVR_INFO_AN' => '700', 'GENERAL_ADMIN_AN' => '701', 'GEN_QUERY_AN' => '702', 'AUTH_REQUEST_AN' => '703', 'AUTH_RESPONSE_AN' => '704', 'AUTH_CHECK_AN' => '705', 'MOD_AVU_METADATA_AN' => '706', 'MOD_ACCESS_CONTROL_AN' => '707', 'RULE_EXEC_MOD_AN' => '708', 'GET_TEMP_PASSWORD_AN' => '709', 'GENERAL_UPDATE_AN' => '710', 'GSI_AUTH_REQUEST_AN' => '711', 'OPEN_COLLECTION_AN' => '712', 'READ_COLLECTION_AN' => '713', 'PAM_AUTH_REQUEST_AN' => '725', 'SSL_START_AN' => '1100', 'SSL_END_AN' => '1101', ); $GLOBALS['PRODS_API_NUMS_REV'] = array( '500' => 'FILE_CREATE_AN', '501' => 'FILE_OPEN_AN', '502' => 'FILE_WRITE_AN', '503' => 'FILE_CLOSE_AN', '504' => 'FILE_LSEEK_AN', '505' => 'FILE_READ_AN', '506' => 'FILE_UNLINK_AN', '507' => 'FILE_MKDIR_AN', '508' => 'FILE_CHMOD_AN', '509' => 'FILE_RMDIR_AN', '510' => 'FILE_STAT_AN', '511' => 'FILE_FSTAT_AN', '512' => 'FILE_FSYNC_AN', '513' => 'FILE_STAGE_AN', '514' => 'FILE_GET_FS_FREE_SPACE_AN', '515' => 'FILE_OPENDIR_AN', '516' => 'FILE_CLOSEDIR_AN', '517' => 'FILE_READDIR_AN', '518' => 'FILE_PUT_AN', '519' => 'FILE_GET_AN', '520' => 'FILE_CHKSUM_AN', '521' => 'CHK_N_V_PATH_PERM_AN', '522' => 'FILE_RENAME_AN', '523' => 'FILE_TRUNCATE_AN', '601' => 'DATA_OBJ_CREATE_AN', '602' => 'DATA_OBJ_OPEN_AN', '603' => 'DATA_OBJ_READ_AN', '604' => 'DATA_OBJ_WRITE_AN', '605' => 'DATA_OBJ_CLOSE_AN', '606' => 'DATA_OBJ_PUT_AN', '607' => 'DATA_PUT_AN', '608' => 'DATA_OBJ_GET_AN', '609' => 'DATA_GET_AN', '610' => 'DATA_OBJ_REPL_AN', '611' => 'DATA_COPY_AN', '612' => 'DATA_OBJ_LSEEK_AN', '613' => 'DATA_OBJ_COPY_AN', '614' => 'SIMPLE_QUERY_AN', '615' => 'DATA_OBJ_UNLINK_AN', '616' => 'COLL_CREATE_AN', '617' => 'RM_COLL_OLD_AN', '618' => 'REG_COLL_AN', '619' => 'REG_DATA_OBJ_AN', '620' => 'UNREG_DATA_OBJ_AN', '621' => 'REG_REPLICA_AN', '622' => 'MOD_DATA_OBJ_META_AN', '623' => 'RULE_EXEC_SUBMIT_AN', '624' => 'RULE_EXEC_DEL_AN', '625' => 'EXEC_MY_RULE_AN', '626' => 'OPR_COMPLETE_AN', '627' => 'DATA_OBJ_RENAME_AN', '628' => 'DATA_OBJ_RSYNC_AN', '629' => 'DATA_OBJ_CHKSUM_AN', '630' => 'PHY_PATH_REG_AN', '631' => 'DATA_OBJ_PHYMV_AN', '632' => 'DATA_OBJ_TRIM_AN', '633' => 'OBJ_STAT_AN', '634' => 'EXEC_CMD_AN', '635' => 'SUB_STRUCT_FILE_CREATE_AN', '636' => 'SUB_STRUCT_FILE_OPEN_AN', '637' => 'SUB_STRUCT_FILE_READ_AN', '638' => 'SUB_STRUCT_FILE_WRITE_AN', '639' => 'SUB_STRUCT_FILE_CLOSE_AN', '640' => 'SUB_STRUCT_FILE_UNLINK_AN', '641' => 'SUB_STRUCT_FILE_STAT_AN', '642' => 'SUB_STRUCT_FILE_FSTAT_AN', '643' => 'SUB_STRUCT_FILE_LSEEK_AN', '644' => 'SUB_STRUCT_FILE_RENAME_AN', '645' => 'QUERY_SPEC_COLL_AN', '646' => 'MOD_COLL_AN', '647' => 'SUB_STRUCT_FILE_MKDIR_AN', '648' => 'SUB_STRUCT_FILE_RMDIR_AN', '649' => 'SUB_STRUCT_FILE_OPENDIR_AN', '650' => 'SUB_STRUCT_FILE_READDIR_AN', '651' => 'SUB_STRUCT_FILE_CLOSEDIR_AN', '652' => 'DATA_OBJ_TRUNCATE_AN', '653' => 'SUB_STRUCT_FILE_TRUNCATE_AN', '654' => 'GET_XMSG_TICKET_AN', '655' => 'SEND_XMSG_AN', '656' => 'RCV_XMSG_AN', '657' => 'SUB_STRUCT_FILE_GET_AN', '658' => 'SUB_STRUCT_FILE_PUT_AN', '659' => 'SYNC_MOUNTED_COLL_AN', '660' => 'STRUCT_FILE_SYNC_AN', '661' => 'CLOSE_COLLECTION_AN', '662' => 'COLL_REPL_AN', '663' => 'RM_COLL_AN', '700' => 'GET_MISC_SVR_INFO_AN', '701' => 'GENERAL_ADMIN_AN', '702' => 'GEN_QUERY_AN', '703' => 'AUTH_REQUEST_AN', '704' => 'AUTH_RESPONSE_AN', '705' => 'AUTH_CHECK_AN', '706' => 'MOD_AVU_METADATA_AN', '707' => 'MOD_ACCESS_CONTROL_AN', '708' => 'RULE_EXEC_MOD_AN', '709' => 'GET_TEMP_PASSWORD_AN', '710' => 'GENERAL_UPDATE_AN', '711' => 'GSI_AUTH_REQUEST_AN', '712' => 'OPEN_COLLECTION_AN', '713' => 'READ_COLLECTION_AN', '725' => 'PAM_AUTH_REQUEST_AN', '1100' => 'SSL_START_AN', '1101' => 'SSL_END_AN', ); ?> php-irods-3.3.0~beta1/prods/src/RodsConst.inc.php000066400000000000000000000002461221272161600216540ustar00rootroot00000000000000 php-irods-3.3.0~beta1/prods/src/RodsErrorTable.inc.php000066400000000000000000000635261221272161600226410ustar00rootroot00000000000000 '-1000', 'SYS_SOCK_BIND_ERR' => '-2000', 'SYS_SOCK_ACCEPT_ERR' => '-3000', 'SYS_HEADER_READ_LEN_ERR' => '-4000', 'SYS_HEADER_WRITE_LEN_ERR' => '-5000', 'SYS_HEADER_TPYE_LEN_ERR' => '-6000', 'SYS_CAUGHT_SIGNAL' => '-7000', 'SYS_GETSTARTUP_PACK_ERR' => '-8000', 'SYS_EXCEED_CONNECT_CNT' => '-9000', 'SYS_USER_NOT_ALLOWED_TO_CONN' => '-10000', 'SYS_READ_MSG_BODY_INPUT_ERR' => '-11000', 'SYS_UNMATCHED_API_NUM' => '-12000', 'SYS_NO_API_PRIV' => '-13000', 'SYS_API_INPUT_ERR' => '-14000', 'SYS_PACK_INSTRUCT_FORMAT_ERR' => '-15000', 'SYS_MALLOC_ERR' => '-16000', 'SYS_GET_HOSTNAME_ERR' => '-17000', 'SYS_OUT_OF_FILE_DESC' => '-18000', 'SYS_FILE_DESC_OUT_OF_RANGE' => '-19000', 'SYS_UNRECOGNIZED_REMOTE_FLAG' => '-20000', 'SYS_INVALID_SERVER_HOST' => '-21000', 'SYS_SVR_TO_SVR_CONNECT_FAILED' => '-22000', 'SYS_BAD_FILE_DESCRIPTOR' => '-23000', 'SYS_INTERNAL_NULL_INPUT_ERR' => '-24000', 'SYS_CONFIG_FILE_ERR' => '-25000', 'SYS_INVALID_ZONE_NAME' => '-26000', 'SYS_COPY_LEN_ERR' => '-27000', 'SYS_PORT_COOKIE_ERR' => '-28000', 'SYS_KEY_VAL_TABLE_ERR' => '-29000', 'SYS_INVALID_RESC_TYPE' => '-30000', 'SYS_INVALID_FILE_PATH' => '-31000', 'SYS_INVALID_RESC_INPUT' => '-32000', 'SYS_INVALID_PORTAL_OPR' => '-33000', 'SYS_PARA_OPR_NO_SUPPORT' => '-34000', 'SYS_INVALID_OPR_TYPE' => '-35000', 'SYS_NO_PATH_PERMISSION' => '-36000', 'SYS_NO_ICAT_SERVER_ERR' => '-37000', 'SYS_AGENT_INIT_ERR' => '-38000', 'SYS_PROXYUSER_NO_PRIV' => '-39000', 'SYS_NO_DATA_OBJ_PERMISSION' => '-40000', 'SYS_DELETE_DISALLOWED' => '-41000', 'SYS_OPEN_REI_FILE_ERR' => '-42000', 'SYS_NO_RCAT_SERVER_ERR' => '-43000', 'SYS_UNMATCH_PACK_INSTRUCTI_NAME' => '-44000', 'SYS_SVR_TO_CLI_MSI_NO_EXIST' => '-45000', 'SYS_COPY_ALREADY_IN_RESC' => '-46000', 'SYS_RECONN_OPR_MISMATCH' => '-47000', 'SYS_INPUT_PERM_OUT_OF_RANGE' => '-48000', 'SYS_FORK_ERROR' => '-49000', 'SYS_PIPE_ERROR' => '-50000', 'SYS_EXEC_CMD_STATUS_SZ_ERROR' => '-51000', 'SYS_PATH_IS_NOT_A_FILE' => '-52000', 'SYS_UNMATCHED_SPEC_COLL_TYPE' => '-53000', 'SYS_TOO_MANY_QUERY_RESULT' => '-54000', 'USER_AUTH_SCHEME_ERR' => '-300000', 'USER_AUTH_STRING_EMPTY' => '-301000', 'USER_RODS_HOST_EMPTY' => '-302000', 'USER_RODS_HOSTNAME_ERR' => '-303000', 'USER_SOCK_OPEN_ERR' => '-304000', 'USER_SOCK_CONNECT_ERR' => '-305000', 'USER_STRLEN_TOOLONG' => '-306000', 'USER_API_INPUT_ERR' => '-307000', 'USER_PACKSTRUCT_INPUT_ERR' => '-308000', 'USER_NO_SUPPORT_ERR' => '-309000', 'USER_FILE_DOES_NOT_EXIST' => '-310000', 'USER_FILE_TOO_LARGE' => '-311000', 'OVERWITE_WITHOUT_FORCE_FLAG' => '-312000', 'UNMATCHED_KEY_OR_INDEX' => '-313000', 'USER_CHKSUM_MISMATCH' => '-314000', 'USER_BAD_KEYWORD_ERR' => '-315000', 'USER__NULL_INPUT_ERR' => '-316000', 'USER_INPUT_PATH_ERR' => '-317000', 'USER_INPUT_OPTION_ERR' => '-318000', 'USER_INVALID_USERNAME_FORMAT' => '-319000', 'USER_DIRECT_RESC_INPUT_ERR' => '-320000', 'USER_NO_RESC_INPUT_ERR' => '-321000', 'USER_PARAM_LABEL_ERR' => '-322000', 'USER_PARAM_TYPE_ERR' => '-323000', 'BASE64_BUFFER_OVERFLOW' => '-324000', 'BASE64_INVALID_PACKET' => '-325000', 'USER_MSG_TYPE_NO_SUPPORT' => '-326000', 'USER_RSYNC_NO_MODE_INPUT_ERR' => '-337000', 'USER_OPTION_INPUT_ERR' => '-338000', 'SAME_SRC_DEST_PATHS_ERR' => '-339000', 'USER_RESTART_FILE_INPUT_ERR' => '-340000', 'RESTART_OPR_FAILED' => '-341000', 'BAD_EXEC_CMD_PATH' => '-342000', 'EXEC_CMD_OUTPUT_TOO_LARGE' => '-343000', 'EXEC_CMD_ERROR' => '-344000', 'FILE_INDEX_LOOKUP_ERR' => '-500000', 'UNIX_FILE_OPEN_ERR' => '-510000', 'UNIX_FILE_OPEN_ERR_1' => '-510001', 'UNIX_FILE_OPEN_ERR_2' => '-510002', 'UNIX_FILE_CREATE_ERR' => '-511000', 'UNIX_FILE_READ_ERR' => '-512000', 'UNIX_FILE_WRITE_ERR' => '-513000', 'UNIX_FILE_CLOSE_ERR' => '-514000', 'UNIX_FILE_UNLINK_ERR' => '-515000', 'UNIX_FILE_STAT_ERR' => '-516000', 'UNIX_FILE_FSTAT_ERR' => '-517000', 'UNIX_FILE_LSEEK_ERR' => '-518000', 'UNIX_FILE_FSYNC_ERR' => '-519000', 'UNIX_FILE_MKDIR_ERR' => '-520000', 'UNIX_FILE_RMDIR_ERR' => '-521000', 'UNIX_FILE_OPENDIR_ERR' => '-522000', 'UNIX_FILE_CLOSEDIR_ERR' => '-523000', 'UNIX_FILE_READDIR_ERR' => '-524000', 'UNIX_FILE_STAGE_ERR' => '-525000', 'UNIX_FILE_GET_FS_FREESPACE_ERR' => '-526000', 'UNIX_FILE_CHMOD_ERR' => '-527000', 'UNIX_FILE_RENAME_ERR' => '-528000', 'CATALOG_NOT_CONNECTED' => '-801000', 'CAT_ENV_ERR' => '-802000', 'CAT_CONNECT_ERR' => '-803000', 'CAT_DISCONNECT_ERR' => '-804000', 'CAT_CLOSE_ENV_ERR' => '-805000', 'CAT_SQL_ERR' => '-806000', 'CAT_GET_ROW_ERR' => '-807000', 'CAT_NO_ROWS_FOUND' => '-808000', 'CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME' => '-809000', 'CAT_INVALID_RESOURCE_TYPE' => '-810000', 'CAT_INVALID_RESOURCE_CLASS' => '-811000', 'CAT_INVALID_RESOURCE_NET_ADDR' => '-812000', 'CAT_INVALID_RESOURCE_VAULT_PATH' => '-813000', 'CAT_UNKNOWN_COLLECTION' => '-814000', 'CAT_INVALID_DATA_TYPE' => '-815000', 'CAT_INVALID_ARGUMENT' => '-816000', 'CAT_UNKNOWN_FILE' => '-817000', 'CAT_NO_ACCESS_PERMISSION' => '-818000', 'CAT_SUCCESS_BUT_WITH_NO_INFO' => '-819000', 'CAT_INVALID_USER_TYPE' => '-820000', 'CAT_COLLECTION_NOT_EMPTY' => '-821000', 'CAT_TOO_MANY_TABLES' => '-822000', 'CAT_UNKNOWN_TABLE' => '-823000', 'CAT_NOT_OPEN' => '-824000', 'CAT_FAILED_TO_LINK_TABLES' => '-825000', 'CAT_INVALID_AUTHENTICATION' => '-826000', 'CAT_INVALID_USER' => '-827000', 'CAT_INVALID_ZONE' => '-828000', 'CAT_INVALID_GROUP' => '-829000', 'CAT_INSUFFICIENT_PRIVILEGE_LEVEL' => '-830000', 'CAT_INVALID_RESOURCE' => '-831000', 'CAT_INVALID_CLIENT_USER' => '-832000', 'CAT_NAME_EXISTS_AS_COLLECTION' => '-833000', 'CAT_NAME_EXISTS_AS_DATAOBJ' => '-834000', 'CAT_RESOURCE_NOT_EMPTY' => '-835000', 'CAT_NOT_A_DATAOBJ_AND_NOT_A_COLLECTION' => '-836000', 'CAT_RECURSIVE_MOVE' => '-837000', 'CAT_LAST_REPLICA' => '-838000', 'CAT_OCI_ERROR' => '-839000', 'CAT_PASSWORD_EXPIRED' => '-840000', 'FILE_OPEN_ERR' => '-900000', 'FILE_READ_ERR' => '-901000', 'FILE_WRITE_ERR' => '-902000', 'PASSWORD_EXCEEDS_MAX_SIZE' => '-903000', 'ENVIRONMENT_VAR_HOME_NOT_DEFINED' => '-904000', 'UNABLE_TO_STAT_FILE' => '-905000', 'AUTH_FILE_NOT_ENCRYPTED' => '-906000', 'AUTH_FILE_DOES_NOT_EXIST' => '-907000', 'UNLINK_FAILED' => '-908000', 'NO_PASSWORD_ENTERED' => '-909000', 'OBJPATH_EMPTY_IN_STRUCT_ERR' => '-1000000', 'RESCNAME_EMPTY_IN_STRUCT_ERR' => '-1001000', 'DATATYPE_EMPTY_IN_STRUCT_ERR' => '-1002000', 'DATASIZE_EMPTY_IN_STRUCT_ERR' => '-1003000', 'CHKSUM_EMPTY_IN_STRUCT_ERR' => '-1004000', 'VERSION_EMPTY_IN_STRUCT_ERR' => '-1005000', 'FILEPATH_EMPTY_IN_STRUCT_ERR' => '-1006000', 'REPLNUM_EMPTY_IN_STRUCT_ERR' => '-1007000', 'REPLSTATUS_EMPTY_IN_STRUCT_ERR' => '-1008000', 'DATAOWNER_EMPTY_IN_STRUCT_ERR' => '-1009000', 'DATAOWNERZONE_EMPTY_IN_STRUCT_ERR' => '-1010000', 'DATAEXPIRY_EMPTY_IN_STRUCT_ERR' => '-1011000', 'DATACOMMENTS_EMPTY_IN_STRUCT_ERR' => '-1012000', 'DATACREATE_EMPTY_IN_STRUCT_ERR' => '-1013000', 'DATAMODIFY_EMPTY_IN_STRUCT_ERR' => '-1014000', 'DATAACCESS_EMPTY_IN_STRUCT_ERR' => '-1015000', 'DATAACCESSINX_EMPTY_IN_STRUCT_ERR' => '-1016000', 'NO_RULE_FOUND_ERR' => '-1017000', 'NO_MORE_RULES_ERR' => '-1018000', 'UNMATCHED_ACTION_ERR' => '-1019000', 'RULES_FILE_READ_ERROR' => '-1020000', 'ACTION_ARG_COUNT_MISMATCH' => '-1021000', 'MAX_NUM_OF_ARGS_IN_ACTION_EXCEEDED' => '-1022000', 'UNKNOWN_PARAM_IN_RULE_ERR' => '-1023000', 'DESTRESCNAME_EMPTY_IN_STRUCT_ERR' => '-1024000', 'BACKUPRESCNAME_EMPTY_IN_STRUCT_ERR' => '-1025000', 'DATAID_EMPTY_IN_STRUCT_ERR' => '-1026000', 'COLLID_EMPTY_IN_STRUCT_ERR' => '-1027000', 'RESCGROUPNAME_EMPTY_IN_STRUCT_ERR' => '-1028000', 'STATUSSTRING_EMPTY_IN_STRUCT_ERR' => '-1029000', 'DATAMAPID_EMPTY_IN_STRUCT_ERR' => '-1030000', 'USERNAMECLIENT_EMPTY_IN_STRUCT_ERR' => '-1031000', 'RODSZONECLIENT_EMPTY_IN_STRUCT_ERR' => '-1032000', 'USERTYPECLIENT_EMPTY_IN_STRUCT_ERR' => '-1033000', 'HOSTCLIENT_EMPTY_IN_STRUCT_ERR' => '-1034000', 'AUTHSTRCLIENT_EMPTY_IN_STRUCT_ERR' => '-1035000', 'USERAUTHSCHEMECLIENT_EMPTY_IN_STRUCT_ERR' => '-1036000', 'USERINFOCLIENT_EMPTY_IN_STRUCT_ERR' => '-1037000', 'USERCOMMENTCLIENT_EMPTY_IN_STRUCT_ERR' => '-1038000', 'USERCREATECLIENT_EMPTY_IN_STRUCT_ERR' => '-1039000', 'USERMODIFYCLIENT_EMPTY_IN_STRUCT_ERR' => '-1040000', 'USERNAMEPROXY_EMPTY_IN_STRUCT_ERR' => '-1041000', 'RODSZONEPROXY_EMPTY_IN_STRUCT_ERR' => '-1042000', 'USERTYPEPROXY_EMPTY_IN_STRUCT_ERR' => '-1043000', 'HOSTPROXY_EMPTY_IN_STRUCT_ERR' => '-1044000', 'AUTHSTRPROXY_EMPTY_IN_STRUCT_ERR' => '-1045000', 'USERAUTHSCHEMEPROXY_EMPTY_IN_STRUCT_ERR' => '-1046000', 'USERINFOPROXY_EMPTY_IN_STRUCT_ERR' => '-1047000', 'USERCOMMENTPROXY_EMPTY_IN_STRUCT_ERR' => '-1048000', 'USERCREATEPROXY_EMPTY_IN_STRUCT_ERR' => '-1049000', 'USERMODIFYPROXY_EMPTY_IN_STRUCT_ERR' => '-1050000', 'COLLNAME_EMPTY_IN_STRUCT_ERR' => '-1051000', 'COLLPARENTNAME_EMPTY_IN_STRUCT_ERR' => '-1052000', 'COLLOWNERNAME_EMPTY_IN_STRUCT_ERR' => '-1053000', 'COLLOWNERZONE_EMPTY_IN_STRUCT_ERR' => '-1054000', 'COLLEXPIRY_EMPTY_IN_STRUCT_ERR' => '-1055000', 'COLLCOMMENTS_EMPTY_IN_STRUCT_ERR' => '-1056000', 'COLLCREATE_EMPTY_IN_STRUCT_ERR' => '-1057000', 'COLLMODIFY_EMPTY_IN_STRUCT_ERR' => '-1058000', 'COLLACCESS_EMPTY_IN_STRUCT_ERR' => '-1059000', 'COLLACCESSINX_EMPTY_IN_STRUCT_ERR' => '-1060000', 'COLLMAPID_EMPTY_IN_STRUCT_ERR' => '-1062000', 'COLLINHERITANCE_EMPTY_IN_STRUCT_ERR' => '-1063000', 'RESCZONE_EMPTY_IN_STRUCT_ERR' => '-1065000', 'RESCLOC_EMPTY_IN_STRUCT_ERR' => '-1066000', 'RESCTYPE_EMPTY_IN_STRUCT_ERR' => '-1067000', 'RESCTYPEINX_EMPTY_IN_STRUCT_ERR' => '-1068000', 'RESCCLASS_EMPTY_IN_STRUCT_ERR' => '-1069000', 'RESCCLASSINX_EMPTY_IN_STRUCT_ERR' => '-1070000', 'RESCVAULTPATH_EMPTY_IN_STRUCT_ERR' => '-1071000', 'NUMOPEN_ORTS_EMPTY_IN_STRUCT_ERR' => '-1072000', 'PARAOPR_EMPTY_IN_STRUCT_ERR' => '-1073000', 'RESCID_EMPTY_IN_STRUCT_ERR' => '-1074000', 'GATEWAYADDR_EMPTY_IN_STRUCT_ERR' => '-1075000', 'RESCMAX_BJSIZE_EMPTY_IN_STRUCT_ERR' => '-1076000', 'FREESPACE_EMPTY_IN_STRUCT_ERR' => '-1077000', 'FREESPACETIME_EMPTY_IN_STRUCT_ERR' => '-1078000', 'FREESPACETIMESTAMP_EMPTY_IN_STRUCT_ERR' => '-1079000', 'RESCINFO_EMPTY_IN_STRUCT_ERR' => '-1080000', 'RESCCOMMENTS_EMPTY_IN_STRUCT_ERR' => '-1081000', 'RESCCREATE_EMPTY_IN_STRUCT_ERR' => '-1082000', 'RESCMODIFY_EMPTY_IN_STRUCT_ERR' => '-1083000', 'INPUT_ARG_NOT_WELL_FORMED_ERR' => '-1084000', 'INPUT_ARG_OUT_OF_ARGC_RANGE_ERR' => '-1085000', 'INSUFFICIENT_INPUT_ARG_ERR' => '-1086000', 'INPUT_ARG_DOES_NOT_MATCH_ERR' => '-1087000', 'RETRY_WITHOUT_RECOVERY_ERR' => '-1088000', 'CUT_ACTION_PROCESSED_ERR' => '-1089000', 'ACTION_FAILED_ERR' => '-1090000', 'FAIL_ACTION_ENCOUNTERED_ERR' => '-1091000', 'VARIABLE_NAME_TOO_LONG_ERR' => '-1092000', 'UNKNOWN_VARIABLE_MAP_ERR' => '-1093000', 'UNDEFINED_VARIABLE_MAP_ERR' => '-1094000', 'NULL_VALUE_ERR' => '-1095000', 'DVARMAP_FILE_READ_ERROR' => '-1096000', 'NO_RULE_OR_MSI_FUNCTION_FOUND_ERR' => '-1097000', 'FILE_CREATE_ERROR' => '-1098000', 'FMAP_FILE_READ_ERROR' => '-1099000', 'DATE_FORMAT_ERR' => '-1100000', 'RULE_FAILED_ERR' => '-1101000', 'NO_MICROSERVICE_FOUND_ERR' => '-1102000', 'INVALID_REGEXP' => '-1103000', 'INVALID_OBJECT_NAME' => '-1104000', 'INVALID_OBJECT_TYPE' => '-1105000', 'NO_VALUES_FOUND' => '-1106000', 'NO_COLUMN_NAME_FOUND' => '-1107000', 'SYS_NULL_INPUT' => '-99999996', 'SYS_HANDLER_DONE_WITH_ERROR' => '-99999997', 'SYS_HANDLER_DONE_NO_ERROR' => '-99999998', 'SYS_NO_HANDLER_REPLY_MSG' => '-99999999', 'GENERAL_PRODS_ERR' => '-3000000', 'PERR_INTERNAL_ERR' => '-3100000', 'PERR_UNEXPECTED_PACKET_FORMAT' => '-3101000', 'PERR_PATH_DOES_NOT_EXISTS' => '-3102000', 'PERR_UNSUPPORTED_PROTOCOL_SCHEME' => '-3103000', 'PERR_USER_INPUT_ERROR' => '-3104000', 'PERR_USER_INPUT_PATH_ERROR' => '-3105000', 'PERR_CONN_NOT_ACTIVE' => '-3106000', 'SSL_NOT_BUILT_INTO_CLIENT' => '-2100000', 'SSL_NOT_BUILT_INTO_SERVER' => '-2101000', 'SSL_INIT_ERROR' => '-2102000', 'SSL_HANDSHAKE_ERROR' => '-2103000', 'SSL_SHUTDOWN_ERROR' => '-2104000', 'SSL_CERT_ERROR' => '-2105000', 'PAM_AUTH_NOT_BUILT_INTO_CLIENT' => '-991000', 'PAM_AUTH_NOT_BUILT_INTO_SERVER' => '-992000', 'PAM_AUTH_PASSWORD_FAILED' => '-993000', 'PAM_AUTH_PASSWORD_INVALID_TTL' => '-994000', ); $GLOBALS['PRODS_ERR_CODES_REV'] = array( '-1000' => 'SYS_SOCK_OPEN_ERR', '-2000' => 'SYS_SOCK_BIND_ERR', '-3000' => 'SYS_SOCK_ACCEPT_ERR', '-4000' => 'SYS_HEADER_READ_LEN_ERR', '-5000' => 'SYS_HEADER_WRITE_LEN_ERR', '-6000' => 'SYS_HEADER_TPYE_LEN_ERR', '-7000' => 'SYS_CAUGHT_SIGNAL', '-8000' => 'SYS_GETSTARTUP_PACK_ERR', '-9000' => 'SYS_EXCEED_CONNECT_CNT', '-10000' => 'SYS_USER_NOT_ALLOWED_TO_CONN', '-11000' => 'SYS_READ_MSG_BODY_INPUT_ERR', '-12000' => 'SYS_UNMATCHED_API_NUM', '-13000' => 'SYS_NO_API_PRIV', '-14000' => 'SYS_API_INPUT_ERR', '-15000' => 'SYS_PACK_INSTRUCT_FORMAT_ERR', '-16000' => 'SYS_MALLOC_ERR', '-17000' => 'SYS_GET_HOSTNAME_ERR', '-18000' => 'SYS_OUT_OF_FILE_DESC', '-19000' => 'SYS_FILE_DESC_OUT_OF_RANGE', '-20000' => 'SYS_UNRECOGNIZED_REMOTE_FLAG', '-21000' => 'SYS_INVALID_SERVER_HOST', '-22000' => 'SYS_SVR_TO_SVR_CONNECT_FAILED', '-23000' => 'SYS_BAD_FILE_DESCRIPTOR', '-24000' => 'SYS_INTERNAL_NULL_INPUT_ERR', '-25000' => 'SYS_CONFIG_FILE_ERR', '-26000' => 'SYS_INVALID_ZONE_NAME', '-27000' => 'SYS_COPY_LEN_ERR', '-28000' => 'SYS_PORT_COOKIE_ERR', '-29000' => 'SYS_KEY_VAL_TABLE_ERR', '-30000' => 'SYS_INVALID_RESC_TYPE', '-31000' => 'SYS_INVALID_FILE_PATH', '-32000' => 'SYS_INVALID_RESC_INPUT', '-33000' => 'SYS_INVALID_PORTAL_OPR', '-34000' => 'SYS_PARA_OPR_NO_SUPPORT', '-35000' => 'SYS_INVALID_OPR_TYPE', '-36000' => 'SYS_NO_PATH_PERMISSION', '-37000' => 'SYS_NO_ICAT_SERVER_ERR', '-38000' => 'SYS_AGENT_INIT_ERR', '-39000' => 'SYS_PROXYUSER_NO_PRIV', '-40000' => 'SYS_NO_DATA_OBJ_PERMISSION', '-41000' => 'SYS_DELETE_DISALLOWED', '-42000' => 'SYS_OPEN_REI_FILE_ERR', '-43000' => 'SYS_NO_RCAT_SERVER_ERR', '-44000' => 'SYS_UNMATCH_PACK_INSTRUCTI_NAME', '-45000' => 'SYS_SVR_TO_CLI_MSI_NO_EXIST', '-46000' => 'SYS_COPY_ALREADY_IN_RESC', '-47000' => 'SYS_RECONN_OPR_MISMATCH', '-48000' => 'SYS_INPUT_PERM_OUT_OF_RANGE', '-49000' => 'SYS_FORK_ERROR', '-50000' => 'SYS_PIPE_ERROR', '-51000' => 'SYS_EXEC_CMD_STATUS_SZ_ERROR', '-52000' => 'SYS_PATH_IS_NOT_A_FILE', '-53000' => 'SYS_UNMATCHED_SPEC_COLL_TYPE', '-54000' => 'SYS_TOO_MANY_QUERY_RESULT', '-300000' => 'USER_AUTH_SCHEME_ERR', '-301000' => 'USER_AUTH_STRING_EMPTY', '-302000' => 'USER_RODS_HOST_EMPTY', '-303000' => 'USER_RODS_HOSTNAME_ERR', '-304000' => 'USER_SOCK_OPEN_ERR', '-305000' => 'USER_SOCK_CONNECT_ERR', '-306000' => 'USER_STRLEN_TOOLONG', '-307000' => 'USER_API_INPUT_ERR', '-308000' => 'USER_PACKSTRUCT_INPUT_ERR', '-309000' => 'USER_NO_SUPPORT_ERR', '-310000' => 'USER_FILE_DOES_NOT_EXIST', '-311000' => 'USER_FILE_TOO_LARGE', '-312000' => 'OVERWITE_WITHOUT_FORCE_FLAG', '-313000' => 'UNMATCHED_KEY_OR_INDEX', '-314000' => 'USER_CHKSUM_MISMATCH', '-315000' => 'USER_BAD_KEYWORD_ERR', '-316000' => 'USER__NULL_INPUT_ERR', '-317000' => 'USER_INPUT_PATH_ERR', '-318000' => 'USER_INPUT_OPTION_ERR', '-319000' => 'USER_INVALID_USERNAME_FORMAT', '-320000' => 'USER_DIRECT_RESC_INPUT_ERR', '-321000' => 'USER_NO_RESC_INPUT_ERR', '-322000' => 'USER_PARAM_LABEL_ERR', '-323000' => 'USER_PARAM_TYPE_ERR', '-324000' => 'BASE64_BUFFER_OVERFLOW', '-325000' => 'BASE64_INVALID_PACKET', '-326000' => 'USER_MSG_TYPE_NO_SUPPORT', '-337000' => 'USER_RSYNC_NO_MODE_INPUT_ERR', '-338000' => 'USER_OPTION_INPUT_ERR', '-339000' => 'SAME_SRC_DEST_PATHS_ERR', '-340000' => 'USER_RESTART_FILE_INPUT_ERR', '-341000' => 'RESTART_OPR_FAILED', '-342000' => 'BAD_EXEC_CMD_PATH', '-343000' => 'EXEC_CMD_OUTPUT_TOO_LARGE', '-344000' => 'EXEC_CMD_ERROR', '-500000' => 'FILE_INDEX_LOOKUP_ERR', '-510000' => 'UNIX_FILE_OPEN_ERR', '-510001' => 'UNIX_FILE_OPEN_ERR_1', '-510002' => 'UNIX_FILE_OPEN_ERR_2', '-511000' => 'UNIX_FILE_CREATE_ERR', '-512000' => 'UNIX_FILE_READ_ERR', '-513000' => 'UNIX_FILE_WRITE_ERR', '-514000' => 'UNIX_FILE_CLOSE_ERR', '-515000' => 'UNIX_FILE_UNLINK_ERR', '-516000' => 'UNIX_FILE_STAT_ERR', '-517000' => 'UNIX_FILE_FSTAT_ERR', '-518000' => 'UNIX_FILE_LSEEK_ERR', '-519000' => 'UNIX_FILE_FSYNC_ERR', '-520000' => 'UNIX_FILE_MKDIR_ERR', '-521000' => 'UNIX_FILE_RMDIR_ERR', '-522000' => 'UNIX_FILE_OPENDIR_ERR', '-523000' => 'UNIX_FILE_CLOSEDIR_ERR', '-524000' => 'UNIX_FILE_READDIR_ERR', '-525000' => 'UNIX_FILE_STAGE_ERR', '-526000' => 'UNIX_FILE_GET_FS_FREESPACE_ERR', '-527000' => 'UNIX_FILE_CHMOD_ERR', '-528000' => 'UNIX_FILE_RENAME_ERR', '-801000' => 'CATALOG_NOT_CONNECTED', '-802000' => 'CAT_ENV_ERR', '-803000' => 'CAT_CONNECT_ERR', '-804000' => 'CAT_DISCONNECT_ERR', '-805000' => 'CAT_CLOSE_ENV_ERR', '-806000' => 'CAT_SQL_ERR', '-807000' => 'CAT_GET_ROW_ERR', '-808000' => 'CAT_NO_ROWS_FOUND', '-809000' => 'CATALOG_ALREADY_HAS_ITEM_BY_THAT_NAME', '-810000' => 'CAT_INVALID_RESOURCE_TYPE', '-811000' => 'CAT_INVALID_RESOURCE_CLASS', '-812000' => 'CAT_INVALID_RESOURCE_NET_ADDR', '-813000' => 'CAT_INVALID_RESOURCE_VAULT_PATH', '-814000' => 'CAT_UNKNOWN_COLLECTION', '-815000' => 'CAT_INVALID_DATA_TYPE', '-816000' => 'CAT_INVALID_ARGUMENT', '-817000' => 'CAT_UNKNOWN_FILE', '-818000' => 'CAT_NO_ACCESS_PERMISSION', '-819000' => 'CAT_SUCCESS_BUT_WITH_NO_INFO', '-820000' => 'CAT_INVALID_USER_TYPE', '-821000' => 'CAT_COLLECTION_NOT_EMPTY', '-822000' => 'CAT_TOO_MANY_TABLES', '-823000' => 'CAT_UNKNOWN_TABLE', '-824000' => 'CAT_NOT_OPEN', '-825000' => 'CAT_FAILED_TO_LINK_TABLES', '-826000' => 'CAT_INVALID_AUTHENTICATION', '-827000' => 'CAT_INVALID_USER', '-828000' => 'CAT_INVALID_ZONE', '-829000' => 'CAT_INVALID_GROUP', '-830000' => 'CAT_INSUFFICIENT_PRIVILEGE_LEVEL', '-831000' => 'CAT_INVALID_RESOURCE', '-832000' => 'CAT_INVALID_CLIENT_USER', '-833000' => 'CAT_NAME_EXISTS_AS_COLLECTION', '-834000' => 'CAT_NAME_EXISTS_AS_DATAOBJ', '-835000' => 'CAT_RESOURCE_NOT_EMPTY', '-836000' => 'CAT_NOT_A_DATAOBJ_AND_NOT_A_COLLECTION', '-837000' => 'CAT_RECURSIVE_MOVE', '-838000' => 'CAT_LAST_REPLICA', '-839000' => 'CAT_OCI_ERROR', '-840000' => 'CAT_PASSWORD_EXPIRED', '-900000' => 'FILE_OPEN_ERR', '-901000' => 'FILE_READ_ERR', '-902000' => 'FILE_WRITE_ERR', '-903000' => 'PASSWORD_EXCEEDS_MAX_SIZE', '-904000' => 'ENVIRONMENT_VAR_HOME_NOT_DEFINED', '-905000' => 'UNABLE_TO_STAT_FILE', '-906000' => 'AUTH_FILE_NOT_ENCRYPTED', '-907000' => 'AUTH_FILE_DOES_NOT_EXIST', '-908000' => 'UNLINK_FAILED', '-909000' => 'NO_PASSWORD_ENTERED', '-1000000' => 'OBJPATH_EMPTY_IN_STRUCT_ERR', '-1001000' => 'RESCNAME_EMPTY_IN_STRUCT_ERR', '-1002000' => 'DATATYPE_EMPTY_IN_STRUCT_ERR', '-1003000' => 'DATASIZE_EMPTY_IN_STRUCT_ERR', '-1004000' => 'CHKSUM_EMPTY_IN_STRUCT_ERR', '-1005000' => 'VERSION_EMPTY_IN_STRUCT_ERR', '-1006000' => 'FILEPATH_EMPTY_IN_STRUCT_ERR', '-1007000' => 'REPLNUM_EMPTY_IN_STRUCT_ERR', '-1008000' => 'REPLSTATUS_EMPTY_IN_STRUCT_ERR', '-1009000' => 'DATAOWNER_EMPTY_IN_STRUCT_ERR', '-1010000' => 'DATAOWNERZONE_EMPTY_IN_STRUCT_ERR', '-1011000' => 'DATAEXPIRY_EMPTY_IN_STRUCT_ERR', '-1012000' => 'DATACOMMENTS_EMPTY_IN_STRUCT_ERR', '-1013000' => 'DATACREATE_EMPTY_IN_STRUCT_ERR', '-1014000' => 'DATAMODIFY_EMPTY_IN_STRUCT_ERR', '-1015000' => 'DATAACCESS_EMPTY_IN_STRUCT_ERR', '-1016000' => 'DATAACCESSINX_EMPTY_IN_STRUCT_ERR', '-1017000' => 'NO_RULE_FOUND_ERR', '-1018000' => 'NO_MORE_RULES_ERR', '-1019000' => 'UNMATCHED_ACTION_ERR', '-1020000' => 'RULES_FILE_READ_ERROR', '-1021000' => 'ACTION_ARG_COUNT_MISMATCH', '-1022000' => 'MAX_NUM_OF_ARGS_IN_ACTION_EXCEEDED', '-1023000' => 'UNKNOWN_PARAM_IN_RULE_ERR', '-1024000' => 'DESTRESCNAME_EMPTY_IN_STRUCT_ERR', '-1025000' => 'BACKUPRESCNAME_EMPTY_IN_STRUCT_ERR', '-1026000' => 'DATAID_EMPTY_IN_STRUCT_ERR', '-1027000' => 'COLLID_EMPTY_IN_STRUCT_ERR', '-1028000' => 'RESCGROUPNAME_EMPTY_IN_STRUCT_ERR', '-1029000' => 'STATUSSTRING_EMPTY_IN_STRUCT_ERR', '-1030000' => 'DATAMAPID_EMPTY_IN_STRUCT_ERR', '-1031000' => 'USERNAMECLIENT_EMPTY_IN_STRUCT_ERR', '-1032000' => 'RODSZONECLIENT_EMPTY_IN_STRUCT_ERR', '-1033000' => 'USERTYPECLIENT_EMPTY_IN_STRUCT_ERR', '-1034000' => 'HOSTCLIENT_EMPTY_IN_STRUCT_ERR', '-1035000' => 'AUTHSTRCLIENT_EMPTY_IN_STRUCT_ERR', '-1036000' => 'USERAUTHSCHEMECLIENT_EMPTY_IN_STRUCT_ERR', '-1037000' => 'USERINFOCLIENT_EMPTY_IN_STRUCT_ERR', '-1038000' => 'USERCOMMENTCLIENT_EMPTY_IN_STRUCT_ERR', '-1039000' => 'USERCREATECLIENT_EMPTY_IN_STRUCT_ERR', '-1040000' => 'USERMODIFYCLIENT_EMPTY_IN_STRUCT_ERR', '-1041000' => 'USERNAMEPROXY_EMPTY_IN_STRUCT_ERR', '-1042000' => 'RODSZONEPROXY_EMPTY_IN_STRUCT_ERR', '-1043000' => 'USERTYPEPROXY_EMPTY_IN_STRUCT_ERR', '-1044000' => 'HOSTPROXY_EMPTY_IN_STRUCT_ERR', '-1045000' => 'AUTHSTRPROXY_EMPTY_IN_STRUCT_ERR', '-1046000' => 'USERAUTHSCHEMEPROXY_EMPTY_IN_STRUCT_ERR', '-1047000' => 'USERINFOPROXY_EMPTY_IN_STRUCT_ERR', '-1048000' => 'USERCOMMENTPROXY_EMPTY_IN_STRUCT_ERR', '-1049000' => 'USERCREATEPROXY_EMPTY_IN_STRUCT_ERR', '-1050000' => 'USERMODIFYPROXY_EMPTY_IN_STRUCT_ERR', '-1051000' => 'COLLNAME_EMPTY_IN_STRUCT_ERR', '-1052000' => 'COLLPARENTNAME_EMPTY_IN_STRUCT_ERR', '-1053000' => 'COLLOWNERNAME_EMPTY_IN_STRUCT_ERR', '-1054000' => 'COLLOWNERZONE_EMPTY_IN_STRUCT_ERR', '-1055000' => 'COLLEXPIRY_EMPTY_IN_STRUCT_ERR', '-1056000' => 'COLLCOMMENTS_EMPTY_IN_STRUCT_ERR', '-1057000' => 'COLLCREATE_EMPTY_IN_STRUCT_ERR', '-1058000' => 'COLLMODIFY_EMPTY_IN_STRUCT_ERR', '-1059000' => 'COLLACCESS_EMPTY_IN_STRUCT_ERR', '-1060000' => 'COLLACCESSINX_EMPTY_IN_STRUCT_ERR', '-1062000' => 'COLLMAPID_EMPTY_IN_STRUCT_ERR', '-1063000' => 'COLLINHERITANCE_EMPTY_IN_STRUCT_ERR', '-1065000' => 'RESCZONE_EMPTY_IN_STRUCT_ERR', '-1066000' => 'RESCLOC_EMPTY_IN_STRUCT_ERR', '-1067000' => 'RESCTYPE_EMPTY_IN_STRUCT_ERR', '-1068000' => 'RESCTYPEINX_EMPTY_IN_STRUCT_ERR', '-1069000' => 'RESCCLASS_EMPTY_IN_STRUCT_ERR', '-1070000' => 'RESCCLASSINX_EMPTY_IN_STRUCT_ERR', '-1071000' => 'RESCVAULTPATH_EMPTY_IN_STRUCT_ERR', '-1072000' => 'NUMOPEN_ORTS_EMPTY_IN_STRUCT_ERR', '-1073000' => 'PARAOPR_EMPTY_IN_STRUCT_ERR', '-1074000' => 'RESCID_EMPTY_IN_STRUCT_ERR', '-1075000' => 'GATEWAYADDR_EMPTY_IN_STRUCT_ERR', '-1076000' => 'RESCMAX_BJSIZE_EMPTY_IN_STRUCT_ERR', '-1077000' => 'FREESPACE_EMPTY_IN_STRUCT_ERR', '-1078000' => 'FREESPACETIME_EMPTY_IN_STRUCT_ERR', '-1079000' => 'FREESPACETIMESTAMP_EMPTY_IN_STRUCT_ERR', '-1080000' => 'RESCINFO_EMPTY_IN_STRUCT_ERR', '-1081000' => 'RESCCOMMENTS_EMPTY_IN_STRUCT_ERR', '-1082000' => 'RESCCREATE_EMPTY_IN_STRUCT_ERR', '-1083000' => 'RESCMODIFY_EMPTY_IN_STRUCT_ERR', '-1084000' => 'INPUT_ARG_NOT_WELL_FORMED_ERR', '-1085000' => 'INPUT_ARG_OUT_OF_ARGC_RANGE_ERR', '-1086000' => 'INSUFFICIENT_INPUT_ARG_ERR', '-1087000' => 'INPUT_ARG_DOES_NOT_MATCH_ERR', '-1088000' => 'RETRY_WITHOUT_RECOVERY_ERR', '-1089000' => 'CUT_ACTION_PROCESSED_ERR', '-1090000' => 'ACTION_FAILED_ERR', '-1091000' => 'FAIL_ACTION_ENCOUNTERED_ERR', '-1092000' => 'VARIABLE_NAME_TOO_LONG_ERR', '-1093000' => 'UNKNOWN_VARIABLE_MAP_ERR', '-1094000' => 'UNDEFINED_VARIABLE_MAP_ERR', '-1095000' => 'NULL_VALUE_ERR', '-1096000' => 'DVARMAP_FILE_READ_ERROR', '-1097000' => 'NO_RULE_OR_MSI_FUNCTION_FOUND_ERR', '-1098000' => 'FILE_CREATE_ERROR', '-1099000' => 'FMAP_FILE_READ_ERROR', '-1100000' => 'DATE_FORMAT_ERR', '-1101000' => 'RULE_FAILED_ERR', '-1102000' => 'NO_MICROSERVICE_FOUND_ERR', '-1103000' => 'INVALID_REGEXP', '-1104000' => 'INVALID_OBJECT_NAME', '-1105000' => 'INVALID_OBJECT_TYPE', '-1106000' => 'NO_VALUES_FOUND', '-1107000' => 'NO_COLUMN_NAME_FOUND', '-99999996' => 'SYS_NULL_INPUT', '-99999997' => 'SYS_HANDLER_DONE_WITH_ERROR', '-99999998' => 'SYS_HANDLER_DONE_NO_ERROR', '-99999999' => 'SYS_NO_HANDLER_REPLY_MSG', '-3000000' => 'GENERAL_PRODS_ERR', '-3100000' => 'PERR_INTERNAL_ERR', '-3101000' => 'PERR_UNEXPECTED_PACKET_FORMAT', '-3102000' => 'PERR_PATH_DOES_NOT_EXISTS', '-3103000' => 'PERR_UNSUPPORTED_PROTOCOL_SCHEME', '-3104000' => 'PERR_USER_INPUT_ERROR', '-3105000' => 'PERR_USER_INPUT_PATH_ERROR', '-3106000' => 'PERR_CONN_NOT_ACTIVE', '-2100000' => 'SSL_NOT_BUILT_INTO_CLIENT', '-2101000' => 'SSL_NOT_BUILT_INTO_SERVER', '-2102000' => 'SSL_INIT_ERROR', '-2103000' => 'SSL_HANDSHAKE_ERROR', '-2104000' => 'SSL_SHUTDOWN_ERROR', '-2105000' => 'SSL_CERT_ERROR', '-991000' => 'PAM_AUTH_NOT_BUILT_INTO_CLIENT', '-992000' => 'PAM_AUTH_NOT_BUILT_INTO_SERVER', '-993000' => 'PAM_AUTH_PASSWORD_FAILED', '-994000' => 'PAM_AUTH_PASSWORD_INVALID_TTL', ); ?> php-irods-3.3.0~beta1/prods/src/RodsGenQueryKeyWd.inc.php000066400000000000000000000216701221272161600232750ustar00rootroot00000000000000 "all", 'COPIES_KW' => "copies", 'EXEC_LOCALLY_KW' => "execLocally", 'FORCE_FLAG_KW' => "forceFlag", 'CLI_IN_SVR_FIREWALL_KW' => "cliInSvrFirewall", 'REG_CHKSUM_KW' => "regChksum", 'VERIFY_CHKSUM_KW' => "verifyChksum", 'VERIFY_BY_SIZE_KW' => "verifyBySize", 'OBJ_PATH_KW' => "objPath", 'RESC_NAME_KW' => "rescName", 'DEST_RESC_NAME_KW' => "destRescName", 'BACKUP_RESC_NAME_KW' => "backupRescName", 'DATA_TYPE_KW' => "dataType", 'DATA_SIZE_KW' => "dataSize", 'CHKSUM_KW' => "chksum", 'VERSION_KW' => "version", 'FILE_PATH_KW' => "filePath", 'REPL_NUM_KW' => "replNum", 'REPL_STATUS_KW' => "replStatus", 'ALL_REPL_STATUS_KW' => "allReplStatus", 'DATA_INCLUDED_KW' => "dataIncluded", 'DATA_OWNER_KW' => "dataOwner", 'DATA_OWNER_ZONE_KW' => "dataOwnerZone", 'DATA_EXPIRY_KW' => "dataExpiry", 'DATA_COMMENTS_KW' => "dataComments", 'DATA_CREATE_KW' => "dataCreate", 'DATA_MODIFY_KW' => "dataModify", 'DATA_ACCESS_KW' => "dataAccess", 'DATA_ACCESS_INX_KW' => "dataAccessInx", 'NO_OPEN_FLAG_KW' => "noOpenFlag", 'STREAMING_KW' => "streaming", 'DATA_ID_KW' => "dataId", 'COLL_ID_KW' => "collId", 'RESC_GROUP_NAME_KW' => "rescGroupName", 'STATUS_STRING_KW' => "statusString", 'DATA_MAP_ID_KW' => "dataMapId", 'NO_PARA_OP_KW' => "noParaOpr", 'LOCAL_PATH_KW' => "localPath", 'RSYNC_MODE_KW' => "rsyncMode", 'RSYNC_DEST_PATH_KW' => "rsyncDestPath", 'RSYNC_CHKSUM_KW' => "rsyncChksum", 'CHKSUM_ALL_KW' => "ChksumAll", 'FORCE_CHKSUM_KW' => "forceChksum", 'COLLECTION_KW' => "collection", 'IRODS_ADMIN_KW' => "irodsAdmin", 'RESC_ZONE_KW' => "zoneName", 'RESC_LOC_KW' => "rescLoc", 'RESC_TYPE_KW' => "rescType", 'RESC_CLASS_KW' => "rescClass", 'RESC_VAULT_PATH_KW' => "rescVaultPath", 'NUM_OPEN_PORTS_KW' => "numOpenPorts", 'PARA_OPR_KW' => "paraOpr", 'GATEWAY_ADDR_KW' => "gateWayAddr", 'RESC_MAX_OBJ_SIZE_KW' => "rescMaxObjSize", 'FREE_SPACE_KW' => "freeSpace", 'FREE_SPACE_TIME_KW' => "freeSpaceTime", 'FREE_SPACE_TIMESTAMP_KW' => "freeSpaceTimeStamp", 'RESC_TYPE_INX_KW' => "rescTypeInx", 'RESC_CLASS_INX_KW' => "rescClassInx", 'RESC_ID_KW' => "rescId", 'RESC_INFO_KW' => "rescInfo", 'RESC_COMMENTS_KW' => "rescComments", 'RESC_CREATE_KW' => "rescCreate", 'RESC_MODIFY_KW' => "rescModify", 'USER_NAME_CLIENT_KW' => "userNameClient", 'RODS_ZONE_CLIENT_KW' => "rodsZoneClient", 'HOST_CLIENT_KW' => "hostClient", 'USER_TYPE_CLIENT_KW' => "userTypeClient", 'AUTH_STR_CLIENT_KW' => "authStrClient", 'USER_AUTH_SCHEME_CLIENT_KW' => "userAuthSchemeClient", 'USER_INFO_CLIENT_KW' => "userInfoClient", 'USER_COMMENT_CLIENT_KW' => "userCommentClient", 'USER_CREATE_CLIENT_KW' => "userCreateClient", 'USER_MODIFY_CLIENT_KW' => "userModifyClient", 'USER_NAME_PROXY_KW' => "userNameProxy", 'RODS_ZONE_PROXY_KW' => "rodsZoneProxy", 'HOST_PROXY_KW' => "hostProxy", 'USER_TYPE_PROXY_KW' => "userTypeProxy", 'AUTH_STR_PROXY_KW' => "authStrProxy", 'USER_AUTH_SCHEME_PROXY_KW' => "userAuthSchemeProxy", 'USER_INFO_PROXY_KW' => "userInfoProxy", 'USER_COMMENT_PROXY_KW' => "userCommentProxy", 'USER_CREATE_PROXY_KW' => "userCreateProxy", 'USER_MODIFY_PROXY_KW' => "userModifyProxy", 'ACCESS_PERMISSION_KW' => "accessPermission", 'COLL_NAME_KW' => "collName", 'COLL_PARENT_NAME_KW' => "collParentName", 'COLL_OWNER_NAME_KW' => "collOwnername", 'COLL_OWNER_ZONE_KW' => "collOwnerZone", 'COLL_MAP_ID_KW' => "collMapId", 'COLL_INHERITANCE_KW' => "collInheritance", 'COLL_COMMENTS_KW' => "collComments", 'COLL_EXPIRY_KW' => "collExpiry", 'COLL_CREATE_KW' => "collCreate", 'COLL_MODIFY_KW' => "collModify", 'COLL_ACCESS_KW' => "collAccess", 'COLL_ACCESS_INX_KW' => "collAccessInx", 'COLL_ID_KW' => "collId", 'RULE_NAME_KW' => "ruleName", 'RULE_REI_FILE_PATH_KW' => "reiFilePath", 'RULE_USER_NAME_KW' => "userName", 'RULE_EXE_ADDRESS_KW' => "exeAddress", 'RULE_EXE_TIME_KW' => "exeTime", 'RULE_EXE_FREQUENCY_KW' => "exeFrequency", 'RULE_PRIORITY_KW' => "priority", 'RULE_ESTIMATE_EXE_TIME_KW' => "estimateExeTime", 'RULE_NOTIFICATION_ADDR_KW' => "notificationAddr", 'RULE_LAST_EXE_TIME_KW' => "lastExeTime", 'RULE_EXE_STATUS_KW' => "exeStatus", ); $GLOBALS['PRODS_GENQUE_KEYWD_REV'] = array( "all" => 'ALL_KW', "copies" => 'COPIES_KW', "execLocally" => 'EXEC_LOCALLY_KW', "forceFlag" => 'FORCE_FLAG_KW', "cliInSvrFirewall" => 'CLI_IN_SVR_FIREWALL_KW', "regChksum" => 'REG_CHKSUM_KW', "verifyChksum" => 'VERIFY_CHKSUM_KW', "verifyBySize" => 'VERIFY_BY_SIZE_KW', "objPath" => 'OBJ_PATH_KW', "rescName" => 'RESC_NAME_KW', "destRescName" => 'DEST_RESC_NAME_KW', "backupRescName" => 'BACKUP_RESC_NAME_KW', "dataType" => 'DATA_TYPE_KW', "dataSize" => 'DATA_SIZE_KW', "chksum" => 'CHKSUM_KW', "version" => 'VERSION_KW', "filePath" => 'FILE_PATH_KW', "replNum" => 'REPL_NUM_KW', "replStatus" => 'REPL_STATUS_KW', "allReplStatus" => 'ALL_REPL_STATUS_KW', "dataIncluded" => 'DATA_INCLUDED_KW', "dataOwner" => 'DATA_OWNER_KW', "dataOwnerZone" => 'DATA_OWNER_ZONE_KW', "dataExpiry" => 'DATA_EXPIRY_KW', "dataComments" => 'DATA_COMMENTS_KW', "dataCreate" => 'DATA_CREATE_KW', "dataModify" => 'DATA_MODIFY_KW', "dataAccess" => 'DATA_ACCESS_KW', "dataAccessInx" => 'DATA_ACCESS_INX_KW', "noOpenFlag" => 'NO_OPEN_FLAG_KW', "streaming" => 'STREAMING_KW', "dataId" => 'DATA_ID_KW', "collId" => 'COLL_ID_KW', "rescGroupName" => 'RESC_GROUP_NAME_KW', "statusString" => 'STATUS_STRING_KW', "dataMapId" => 'DATA_MAP_ID_KW', "noParaOpr" => 'NO_PARA_OP_KW', "localPath" => 'LOCAL_PATH_KW', "rsyncMode" => 'RSYNC_MODE_KW', "rsyncDestPath" => 'RSYNC_DEST_PATH_KW', "rsyncChksum" => 'RSYNC_CHKSUM_KW', "ChksumAll" => 'CHKSUM_ALL_KW', "forceChksum" => 'FORCE_CHKSUM_KW', "collection" => 'COLLECTION_KW', "irodsAdmin" => 'IRODS_ADMIN_KW', "zoneName" => 'RESC_ZONE_KW', "rescLoc" => 'RESC_LOC_KW', "rescType" => 'RESC_TYPE_KW', "rescClass" => 'RESC_CLASS_KW', "rescVaultPath" => 'RESC_VAULT_PATH_KW', "numOpenPorts" => 'NUM_OPEN_PORTS_KW', "paraOpr" => 'PARA_OPR_KW', "gateWayAddr" => 'GATEWAY_ADDR_KW', "rescMaxObjSize" => 'RESC_MAX_OBJ_SIZE_KW', "freeSpace" => 'FREE_SPACE_KW', "freeSpaceTime" => 'FREE_SPACE_TIME_KW', "freeSpaceTimeStamp" => 'FREE_SPACE_TIMESTAMP_KW', "rescTypeInx" => 'RESC_TYPE_INX_KW', "rescClassInx" => 'RESC_CLASS_INX_KW', "rescId" => 'RESC_ID_KW', "rescInfo" => 'RESC_INFO_KW', "rescComments" => 'RESC_COMMENTS_KW', "rescCreate" => 'RESC_CREATE_KW', "rescModify" => 'RESC_MODIFY_KW', "userNameClient" => 'USER_NAME_CLIENT_KW', "rodsZoneClient" => 'RODS_ZONE_CLIENT_KW', "hostClient" => 'HOST_CLIENT_KW', "userTypeClient" => 'USER_TYPE_CLIENT_KW', "authStrClient" => 'AUTH_STR_CLIENT_KW', "userAuthSchemeClient" => 'USER_AUTH_SCHEME_CLIENT_KW', "userInfoClient" => 'USER_INFO_CLIENT_KW', "userCommentClient" => 'USER_COMMENT_CLIENT_KW', "userCreateClient" => 'USER_CREATE_CLIENT_KW', "userModifyClient" => 'USER_MODIFY_CLIENT_KW', "userNameProxy" => 'USER_NAME_PROXY_KW', "rodsZoneProxy" => 'RODS_ZONE_PROXY_KW', "hostProxy" => 'HOST_PROXY_KW', "userTypeProxy" => 'USER_TYPE_PROXY_KW', "authStrProxy" => 'AUTH_STR_PROXY_KW', "userAuthSchemeProxy" => 'USER_AUTH_SCHEME_PROXY_KW', "userInfoProxy" => 'USER_INFO_PROXY_KW', "userCommentProxy" => 'USER_COMMENT_PROXY_KW', "userCreateProxy" => 'USER_CREATE_PROXY_KW', "userModifyProxy" => 'USER_MODIFY_PROXY_KW', "accessPermission" => 'ACCESS_PERMISSION_KW', "collName" => 'COLL_NAME_KW', "collParentName" => 'COLL_PARENT_NAME_KW', "collOwnername" => 'COLL_OWNER_NAME_KW', "collOwnerZone" => 'COLL_OWNER_ZONE_KW', "collMapId" => 'COLL_MAP_ID_KW', "collInheritance" => 'COLL_INHERITANCE_KW', "collComments" => 'COLL_COMMENTS_KW', "collExpiry" => 'COLL_EXPIRY_KW', "collCreate" => 'COLL_CREATE_KW', "collModify" => 'COLL_MODIFY_KW', "collAccess" => 'COLL_ACCESS_KW', "collAccessInx" => 'COLL_ACCESS_INX_KW', "collId" => 'COLL_ID_KW', "ruleName" => 'RULE_NAME_KW', "reiFilePath" => 'RULE_REI_FILE_PATH_KW', "userName" => 'RULE_USER_NAME_KW', "exeAddress" => 'RULE_EXE_ADDRESS_KW', "exeTime" => 'RULE_EXE_TIME_KW', "exeFrequency" => 'RULE_EXE_FREQUENCY_KW', "priority" => 'RULE_PRIORITY_KW', "estimateExeTime" => 'RULE_ESTIMATE_EXE_TIME_KW', "notificationAddr" => 'RULE_NOTIFICATION_ADDR_KW', "lastExeTime" => 'RULE_LAST_EXE_TIME_KW', "exeStatus" => 'RULE_EXE_STATUS_KW', ); ?> php-irods-3.3.0~beta1/prods/src/RodsGenQueryNum.inc.php000066400000000000000000000177401221272161600230140ustar00rootroot00000000000000 '50', 'MAX_SQL_ROWS' => '500', 'ORDER_BY' => '1024', 'ORDER_BY_DESC' => '2048', 'RETURN_TOTAL_ROW_COUNT' => '32', 'SELECT_MIN' => '2', 'SELECT_MAX' => '3', 'SELECT_SUM' => '4', 'SELECT_AVG' => '5', 'SELECT_COUNT' => '6', 'COL_ZONE_ID' => '101', 'COL_ZONE_NAME' => '102', 'COL_USER_ID' => '201', 'COL_USER_NAME' => '202', 'COL_USER_TYPE' => '203', 'COL_USER_ZONE' => '204', 'COL_USER_DN' => '205', 'COL_USER_INFO' => '206', 'COL_USER_COMMENT' => '207', 'COL_USER_CREATE_TIME' => '208', 'COL_USER_MODIFY_TIME' => '209', 'COL_R_RESC_ID' => '301', 'COL_R_RESC_NAME' => '302', 'COL_R_ZONE_NAME' => '303', 'COL_R_TYPE_NAME' => '304', 'COL_R_CLASS_NAME' => '305', 'COL_R_LOC' => '306', 'COL_R_VAULT_PATH' => '307', 'COL_R_FREE_SPACE' => '308', 'COL_R_RESC_INFO' => '309', 'COL_R_RESC_COMMENT' => '310', 'COL_R_CREATE_TIME' => '311', 'COL_R_MODIFY_TIME' => '312', 'COL_D_DATA_ID' => '401', 'COL_D_COLL_ID' => '402', 'COL_DATA_NAME' => '403', 'COL_DATA_REPL_NUM' => '404', 'COL_DATA_VERSION' => '405', 'COL_DATA_TYPE_NAME' => '406', 'COL_DATA_SIZE' => '407', 'COL_D_RESC_GROUP_NAME' => '408', 'COL_D_RESC_NAME' => '409', 'COL_D_DATA_PATH' => '410', 'COL_D_OWNER_NAME' => '411', 'COL_D_OWNER_ZONE' => '412', 'COL_D_REPL_STATUS' => '413', 'COL_D_DATA_STATUS' => '414', 'COL_D_DATA_CHECKSUM' => '415', 'COL_D_EXPIRY' => '416', 'COL_D_MAP_ID' => '417', 'COL_D_COMMENTS' => '418', 'COL_D_CREATE_TIME' => '419', 'COL_D_MODIFY_TIME' => '420', 'COL_COLL_ID' => '500', 'COL_COLL_NAME' => '501', 'COL_COLL_PARENT_NAME' => '502', 'COL_COLL_OWNER_NAME' => '503', 'COL_COLL_OWNER_ZONE' => '504', 'COL_COLL_MAP_ID' => '505', 'COL_COLL_INHERITANCE' => '506', 'COL_COLL_COMMENTS' => '507', 'COL_COLL_CREATE_TIME' => '508', 'COL_COLL_MODIFY_TIME' => '509', 'COL_COLL_TYPE' => '510', 'COL_COLL_INFO1' => '511', 'COL_COLL_INFO2' => '512', 'COL_META_DATA_ATTR_NAME' => '600', 'COL_META_DATA_ATTR_VALUE' => '601', 'COL_META_DATA_ATTR_UNITS' => '602', 'COL_META_DATA_ATTR_ID' => '603', 'COL_META_COLL_ATTR_NAME' => '610', 'COL_META_COLL_ATTR_VALUE' => '611', 'COL_META_COLL_ATTR_UNITS' => '612', 'COL_META_COLL_ATTR_ID' => '613', 'COL_META_NAMESPACE_COLL' => '620', 'COL_META_NAMESPACE_DATA' => '621', 'COL_META_NAMESPACE_RESC' => '622', 'COL_META_NAMESPACE_USER' => '623', 'COL_META_RESC_ATTR_NAME' => '630', 'COL_META_RESC_ATTR_VALUE' => '631', 'COL_META_RESC_ATTR_UNITS' => '632', 'COL_META_RESC_ATTR_ID' => '633', 'COL_META_USER_ATTR_NAME' => '640', 'COL_META_USER_ATTR_VALUE' => '641', 'COL_META_USER_ATTR_UNITS' => '642', 'COL_META_USER_ATTR_ID' => '643', 'COL_DATA_ACCESS_TYPE' => '700', 'COL_DATA_ACCESS_NAME' => '701', 'COL_DATA_TOKEN_NAMESPACE' => '702', 'COL_DATA_ACCESS_USER_ID' => '703', 'COL_DATA_ACCESS_DATA_ID' => '704', 'COL_RESC_GROUP_RESC_ID' => '800', 'COL_RESC_GROUP_NAME' => '801', 'COL_USER_GROUP_ID' => '900', 'COL_USER_GROUP_NAME' => '901', 'COL_RULE_EXEC_ID' => '1000', 'COL_RULE_EXEC_NAME' => '1001', 'COL_RULE_EXEC_REI_FILE_PATH' => '1002', 'COL_RULE_EXEC_USER_NAME' => '1003', 'COL_RULE_EXEC_ADDRESS' => '1004', 'COL_RULE_EXEC_TIME' => '1005', 'COL_RULE_EXEC_FREQUENCY' => '1006', 'COL_RULE_EXEC_PRIORITY' => '1007', 'COL_RULE_EXEC_ESTIMATED_EXE_TIME' => '1008', 'COL_RULE_EXEC_NOTIFICATION_ADDR' => '1009', 'COL_RULE_EXEC_LAST_EXE_TIME' => '1010', 'COL_RULE_EXEC_STATUS' => '1011', 'COL_TOKEN_NAMESPACE' => '1100', 'COL_TOKEN_ID' => '1101', 'COL_TOKEN_NAME' => '1102', 'COL_TOKEN_VALUE' => '1103', 'COL_TOKEN_VALUE2' => '1104', 'COL_TOKEN_VALUE3' => '1105', 'COL_TOKEN_COMMENT' => '1106', ); $GLOBALS['PRODS_GENQUE_NUMS_REV'] = array( '50' => 'MAX_SQL_ATTR', '500' => 'MAX_SQL_ROWS', '1024' => 'ORDER_BY', '2048' => 'ORDER_BY_DESC', '32' => 'RETURN_TOTAL_ROW_COUNT', '2' => 'SELECT_MIN', '3' => 'SELECT_MAX', '4' => 'SELECT_SUM', '5' => 'SELECT_AVG', '6' => 'SELECT_COUNT', '101' => 'COL_ZONE_ID', '102' => 'COL_ZONE_NAME', '201' => 'COL_USER_ID', '202' => 'COL_USER_NAME', '203' => 'COL_USER_TYPE', '204' => 'COL_USER_ZONE', '205' => 'COL_USER_DN', '206' => 'COL_USER_INFO', '207' => 'COL_USER_COMMENT', '208' => 'COL_USER_CREATE_TIME', '209' => 'COL_USER_MODIFY_TIME', '301' => 'COL_R_RESC_ID', '302' => 'COL_R_RESC_NAME', '303' => 'COL_R_ZONE_NAME', '304' => 'COL_R_TYPE_NAME', '305' => 'COL_R_CLASS_NAME', '306' => 'COL_R_LOC', '307' => 'COL_R_VAULT_PATH', '308' => 'COL_R_FREE_SPACE', '309' => 'COL_R_RESC_INFO', '310' => 'COL_R_RESC_COMMENT', '311' => 'COL_R_CREATE_TIME', '312' => 'COL_R_MODIFY_TIME', '401' => 'COL_D_DATA_ID', '402' => 'COL_D_COLL_ID', '403' => 'COL_DATA_NAME', '404' => 'COL_DATA_REPL_NUM', '405' => 'COL_DATA_VERSION', '406' => 'COL_DATA_TYPE_NAME', '407' => 'COL_DATA_SIZE', '408' => 'COL_D_RESC_GROUP_NAME', '409' => 'COL_D_RESC_NAME', '410' => 'COL_D_DATA_PATH', '411' => 'COL_D_OWNER_NAME', '412' => 'COL_D_OWNER_ZONE', '413' => 'COL_D_REPL_STATUS', '414' => 'COL_D_DATA_STATUS', '415' => 'COL_D_DATA_CHECKSUM', '416' => 'COL_D_EXPIRY', '417' => 'COL_D_MAP_ID', '418' => 'COL_D_COMMENTS', '419' => 'COL_D_CREATE_TIME', '420' => 'COL_D_MODIFY_TIME', '500' => 'COL_COLL_ID', '501' => 'COL_COLL_NAME', '502' => 'COL_COLL_PARENT_NAME', '503' => 'COL_COLL_OWNER_NAME', '504' => 'COL_COLL_OWNER_ZONE', '505' => 'COL_COLL_MAP_ID', '506' => 'COL_COLL_INHERITANCE', '507' => 'COL_COLL_COMMENTS', '508' => 'COL_COLL_CREATE_TIME', '509' => 'COL_COLL_MODIFY_TIME', '510' => 'COL_COLL_TYPE', '511' => 'COL_COLL_INFO1', '512' => 'COL_COLL_INFO2', '600' => 'COL_META_DATA_ATTR_NAME', '601' => 'COL_META_DATA_ATTR_VALUE', '602' => 'COL_META_DATA_ATTR_UNITS', '603' => 'COL_META_DATA_ATTR_ID', '610' => 'COL_META_COLL_ATTR_NAME', '611' => 'COL_META_COLL_ATTR_VALUE', '612' => 'COL_META_COLL_ATTR_UNITS', '613' => 'COL_META_COLL_ATTR_ID', '620' => 'COL_META_NAMESPACE_COLL', '621' => 'COL_META_NAMESPACE_DATA', '622' => 'COL_META_NAMESPACE_RESC', '623' => 'COL_META_NAMESPACE_USER', '630' => 'COL_META_RESC_ATTR_NAME', '631' => 'COL_META_RESC_ATTR_VALUE', '632' => 'COL_META_RESC_ATTR_UNITS', '633' => 'COL_META_RESC_ATTR_ID', '640' => 'COL_META_USER_ATTR_NAME', '641' => 'COL_META_USER_ATTR_VALUE', '642' => 'COL_META_USER_ATTR_UNITS', '643' => 'COL_META_USER_ATTR_ID', '700' => 'COL_DATA_ACCESS_TYPE', '701' => 'COL_DATA_ACCESS_NAME', '702' => 'COL_DATA_TOKEN_NAMESPACE', '703' => 'COL_DATA_ACCESS_USER_ID', '704' => 'COL_DATA_ACCESS_DATA_ID', '800' => 'COL_RESC_GROUP_RESC_ID', '801' => 'COL_RESC_GROUP_NAME', '900' => 'COL_USER_GROUP_ID', '901' => 'COL_USER_GROUP_NAME', '1000' => 'COL_RULE_EXEC_ID', '1001' => 'COL_RULE_EXEC_NAME', '1002' => 'COL_RULE_EXEC_REI_FILE_PATH', '1003' => 'COL_RULE_EXEC_USER_NAME', '1004' => 'COL_RULE_EXEC_ADDRESS', '1005' => 'COL_RULE_EXEC_TIME', '1006' => 'COL_RULE_EXEC_FREQUENCY', '1007' => 'COL_RULE_EXEC_PRIORITY', '1008' => 'COL_RULE_EXEC_ESTIMATED_EXE_TIME', '1009' => 'COL_RULE_EXEC_NOTIFICATION_ADDR', '1010' => 'COL_RULE_EXEC_LAST_EXE_TIME', '1011' => 'COL_RULE_EXEC_STATUS', '1100' => 'COL_TOKEN_NAMESPACE', '1101' => 'COL_TOKEN_ID', '1102' => 'COL_TOKEN_NAME', '1103' => 'COL_TOKEN_VALUE', '1104' => 'COL_TOKEN_VALUE2', '1105' => 'COL_TOKEN_VALUE3', '1106' => 'COL_TOKEN_COMMENT', ); ?> php-irods-3.3.0~beta1/prods/src/autoload.inc.php000066400000000000000000000022071221272161600215450ustar00rootroot00000000000000read())) { if ($folder != "." && $folder != "..") { if (is_dir(CLASS_DIR . $sub . $folder)) { $subFolder = classFolder($className, $sub . $folder . "/"); if ($subFolder) return $subFolder; } } } $dir->close(); return false; } spl_autoload_register('__autoload'); php-irods-3.3.0~beta1/prods/src/packet/000077500000000000000000000000001221272161600177225ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/src/packet/RODSPacket.class.php000066400000000000000000000204771221272161600234500ustar00rootroot00000000000000 array ("type" => NULL, "msgLen" => 0, "errorLen" => 0, "bsLen" => 0, "intInfo" => 0), "StartupPack_PI" => array ("irodsProt" => 1, "connectCnt" => 0, "proxyUser" => NULL, "proxyRcatZone" => NULL, "clientUser" => NULL, "clientRcatZone" => NULL, "relVersion" => NULL, "apiVersion" => NULL, "option" => NULL ), "Version_PI" => array ("status"=>0,"relVersion"=>NULL,"apiVersion"=>NULL), "authResponseInp_PI" => array("response" => NULL, "username" => NULL), "authRequestOut_PI" => array("challenge" => NULL) ); */ class RODSPacket { protected $type; // type of packet protected $packlets; // (array of mixed) main message body public function __construct($type = NULL, array $arr = NULL) { if (!isset($type)) return; $this->type = $type; $this->packlets = $arr; } public function toXML() { if (empty($this->type)) return NULL; $doc = new DOMDocument(); $root = $this->toDOMElement($doc); $doc->appendChild($root); return ($doc->saveXML($root, LIBXML_NOEMPTYTAG)); } /* public function fromXML($str) { try { $xml = new SimpleXMLElement($str); } catch (Exception $e) { throw new RODSException("RODSPacket::fromXML failed. ". "Mal-formated XML: '$str'\n", PERR_INTERNAL_ERR); } if (isset($this->type)&&($this->type!=$xml->getName())) { throw new RODSException("RODSPacket::fromXML failed. ". "Possible type mismatch! expected type:".$this->type." but got: ". $xml->getName()." \n", PERR_INTERNAL_ERR); } $this->type=$xml->getName(); foreach($xml as $key => $val) { if (!array_key_exists($key,$this->msg)) { throw new RODSException("RODSPacket::fromXML failed. ". "Possible type mismatch! expected key '$key' doesn't exists\n", PERR_INTERNAL_ERR); } $this->msg[$key]=(string)$val; } } */ public static function parseXML($xmlstr) { if (false == ($doc = DOMDocument::loadXML($xmlstr))) { throw new RODSException("RODSPacket::parseXML failed. " . "Failed to loadXML(). The xmlstr is: $xmlstr\n", PERR_UNEXPECTED_PACKET_FORMAT); } $rp_classname = "RP_" . substr($doc->tagName, 0, strlen($doc->tagName) - 3); $packet = new $rp_classname(); $packet->fromDOM($doc); } /* public function fromDOM(DOMNode $domnode) { if (!isset($this->packlets)) return; $i=0; $domnode_children=$domnode->childNodes; foreach($this->packlets as $packlet_key => &$packlet_val) { $domnode_child=$domnode_children->item($i++); // check if the tag names are expected if ($domnode_child->tagName!=$packlet_key) { throw new RODSException("RODSPacket::fromDOM failed. ". "Expecting packlet:$packlet_key, but got:".$domnode_child->tagName." \n", PERR_UNEXPECTED_PACKET_FORMAT); } if (is_a($packlet_val, "RODSPacket")) //if expecting sub packet { $packlet_val->fromDOM($domnode_child); } else //if expecting an string { } } } */ public function fromSXE(SimpleXMLElement $sxe) { if (!isset($this->packlets)) return; foreach ($this->packlets as $packlet_key => &$packlet_val) { if ($packlet_val instanceof RODSPacket) //if expecting sub packet { if (!isset($sxe->$packlet_key)) { throw new RODSException("RODSPacket(" . get_class($this) . ")::fromSXE failed. " . "Failed to find expected packlet: '$packlet_key' \n", "PERR_UNEXPECTED_PACKET_FORMAT"); } $packlet_val->fromSXE($sxe->$packlet_key); } else if (is_array($packlet_val)) //if expecting array { if (isset($sxe->$packlet_key)) { $packlet_val = array(); foreach ($sxe->$packlet_key as $sxe_val) { if ((!empty($this->array_rp_type)) && (!empty($this->array_rp_type["$packlet_key"])) ) // if it's an array of packets { $class_name = $this->array_rp_type[$packlet_key]; $sub_array_packet = new $class_name(); $sub_array_packet->fromSXE($sxe_val); $packlet_val[] = $sub_array_packet; } else { $packlet_val[] = (string)$sxe_val; } } } } else { if (isset($sxe->$packlet_key)) { $packlet_val = (string)$sxe->$packlet_key; } } } /* foreach($sxe->children() as $child) { $tagname=$child->getName(); if(substr($tagname,-3,3)=="_PI") { $rp_classname="RP_".substr($name,0,strlen($name)-3); $child_rp=new $rp_classname(); $child_rp->fromSXE($child); } else { $this->packlets[$child->getName()]=(string)$child; } } */ } public function toDOMElement(DOMDocument $doc) { if (empty($this->type)) return NULL; $node = $doc->createElement($this->type); foreach ($this->packlets as $name => $packlet) { if ($packlet instanceof RODSPacket) //if node is a packet { $child_node = $packlet->toDOMElement($doc); if (isset($child_node)) $node->appendChild($packlet->toDOMElement($doc)); } else if (is_array($packlet)) //if node is an array { if (isset($packlet)) { foreach ($packlet as $sub_packlet) { if ($sub_packlet instanceof RODSPacket) //if sub_node is a packet { $child_node = $sub_packlet->toDOMElement($doc); if (isset($child_node)) $node->appendChild($sub_packlet->toDOMElement($doc)); } else { //echo "sub_packlet = $sub_packlet
\n"; $node->appendChild($doc->createElement($name, htmlspecialchars($sub_packlet))); } } } } else //if node holds a string { //echo "packlet = $packlet
\n"; $node->appendChild($doc->createElement($name, htmlspecialchars($packlet))); } } return $node; } public function __get($name) { if (array_key_exists($name, $this->packlets)) return $this->packlets[$name]; else { debug_print_backtrace(); throw new RODSException("RODSPacket::__get() failed. Trying to access field '$name' that doesn't exist!", "PERR_INTERNAL_ERR"); } } public function __set($name, $val) { if (array_key_exists($name, $this->packlets)) $this->packlets[$name] = $val; else throw new RODSException("RODSPacket::__set() failed. Trying to access field '$name' that doesn't exist!", "PERR_INTERNAL_ERR"); } /* public static function makeStartupPack($user,$zone) { $msg=array(1,0,$user,$zone,$user,$zone,'rods0.5','a',NULL); return (new RODSPacket("StartupPack_PI",$msg)); } */ } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_BinBytesBuf.class.php000066400000000000000000000004571221272161600243220ustar00rootroot00000000000000 $buflen, "buf" => $buf); parent::__construct("BinBytesBuf_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_CollInp.class.php000066400000000000000000000007451221272161600235060ustar00rootroot00000000000000 $collName, 'KeyValPair_PI' => $KeyValPair_PI); parent::__construct("CollInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_CollOprStat.class.php000066400000000000000000000007611221272161600243520ustar00rootroot00000000000000 $filesCnt, "totalFileCnt" => $totalFileCnt, 'bytesWritten' => $bytesWritten, 'lastObjPath' => $lastObjPath); parent::__construct("CollOprStat_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_DataObjCopyInp.class.php000066400000000000000000000007611221272161600247520ustar00rootroot00000000000000 $src, 'dest' => $dest); parent::__construct("DataObjCopyInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_DataObjInp.class.php000066400000000000000000000014321221272161600241130ustar00rootroot00000000000000 $objPath, 'createMode' => $createMode, 'openFlags' => $openFlags, 'offset' => $offset, "dataSize" => $dataSize, "numThreads" => $numThreads, "oprType" => $oprType, 'KeyValPair_PI' => $KeyValPair_PI); parent::__construct("DataObjInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_ExecCmdOut.class.php000066400000000000000000000026631221272161600241470ustar00rootroot00000000000000 $buf); parent::__construct("ExecCmdOut_PI", $packlets); } public function fromSXE(SimpleXMLElement $sxe) { $binbytes = "BinBytesBuf_PI"; $name = "buf"; if (!isset($this->packlets)) return; $packlet_value = ""; try { foreach ($sxe->$binbytes as $binpacket) { if (strlen($binpacket->$name) > 0) { $decoded_value = base64_decode($binpacket->$name); $packlet_value .= $decoded_value; } } // can't find a better way yet to get rid of the garbage on the end of the string ... $len = strlen($packlet_value); $cleaned_value = ""; for ($i = 0; $i < $len; $i++) { if (ord($packlet_value{$i}) <= 0) break; $cleaned_value .= $packlet_value{$i}; } $this->packlets[$name] = $cleaned_value; $this->packlets["buflen"] = $i; } catch (Exception $ex) { $this->packlets[$name] = ""; } } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_ExecMyRuleInp.class.php000066400000000000000000000015441221272161600246350ustar00rootroot00000000000000 $myRule, "RHostAddr_PI" => $RHostAddr_PI, "KeyValPair_PI" => $KeyValPair_PI, "outParamDesc" => $outParamDesc, "MsParamArray_PI" => $MsParamArray_PI); parent::__construct("ExecMyRuleInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_GenQueryInp.class.php000066400000000000000000000020541221272161600243470ustar00rootroot00000000000000 $maxRows, 'continueInx' => $continueInx, 'partialStartIndex' => $partialStartIndex, 'options' => $options, 'KeyValPair_PI' => $KeyValPair_PI, 'InxIvalPair_PI' => $InxIvalPair_PI, 'InxValPair_PI' => $InxValPair_PI); parent::__construct("GenQueryInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_GenQueryOut.class.php000066400000000000000000000013361221272161600243720ustar00rootroot00000000000000array_rp_type = array("SqlResult_PI" => "RP_SqlResult"); $packlets = array("rowCnt" => $rowCnt, 'attriCnt' => $attriCnt, 'continueInx' => $continueInx, 'totalRowCount' => $totalRowCount, 'SqlResult_PI' => $SqlResult_PI); parent::__construct("GenQueryOut_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_InxIvalPair.class.php000066400000000000000000000014451221272161600243320ustar00rootroot00000000000000 $iiLen, 'inx' => $inx, 'ivalue' => $ivalue); parent::__construct("InxIvalPair_PI", $packlets); } public function fromAssocArray($array) { if (!empty($array)) { $this->packlets["iiLen"] = count($array); $this->packlets["inx"] = array_keys($array); $this->packlets["ivalue"] = array_values($array); } else { $this->packlets["iiLen"] = 0; $this->packlets["inx"] = array(); $this->packlets["ivalue"] = array(); } } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_InxValPair.class.php000066400000000000000000000025631221272161600241630ustar00rootroot00000000000000 $isLen, 'inx' => $inx, 'svalue' => $svalue); parent::__construct("InxValPair_PI", $packlets); } public function fromAssocArray($array) { if (!empty($array)) { $this->packlets["isLen"] = count($array); $this->packlets["inx"] = array_keys($array); $this->packlets["svalue"] = array_values($array); } else { $this->packlets["isLen"] = 0; $this->packlets["inx"] = array(); $this->packlets["svalue"] = array(); } } public function fromRODSQueryConditionArray($array) { $this->packlets["isLen"] = 0; $this->packlets["inx"] = array(); $this->packlets["svalue"] = array(); if (!isset($array)) return; $this->packlets["isLen"] = count($array); foreach ($array as $cond) { $this->packlets["inx"][] = $cond->name; $this->packlets["svalue"][] = "$cond->op '$cond->value'"; //echo "
 $cond->op '$cond->value' 
"; } } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_KeyValPair.class.php000066400000000000000000000026041221272161600241510ustar00rootroot00000000000000 $ssLen, 'keyWord' => $keyWord, 'svalue' => $svalue); parent::__construct("KeyValPair_PI", $packlets); } public function fromAssocArray(array $array) { if (!empty($array)) { $this->packlets["ssLen"] = count($array); $this->packlets["keyWord"] = array_keys($array); $this->packlets["svalue"] = array_values($array); } else { $this->packlets["ssLen"] = 0; $this->packlets["keyWord"] = array(); $this->packlets["svalue"] = array(); } } public function fromRODSQueryConditionArray($array) { $this->packlets["ssLen"] = 0; $this->packlets["keyWord"] = array(); $this->packlets["svalue"] = array(); if (!isset($array)) return; $this->packlets["ssLen"] = count($array); foreach ($array as $cond) { $this->packlets["keyWord"][] = $cond->name; $this->packlets["svalue"][] = "$cond->op '$cond->value'"; } } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_MiscSvrInfo.class.php000066400000000000000000000007421221272161600243450ustar00rootroot00000000000000 $serverType, 'relVersion' => $relVersion, 'apiVersion' => $apiVersion, 'rodsZone' => $rodsZone); parent::__construct("MiscSvrInfo_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_ModAVUMetadataInp.class.php000066400000000000000000000012351221272161600253440ustar00rootroot00000000000000 $arg0, "arg1" => $arg1, "arg2" => $arg2, "arg3" => $arg3, "arg4" => $arg4, "arg5" => $arg5, "arg6" => $arg6, "arg7" => $arg7, "arg8" => $arg8, "arg9" => $arg9); parent::__construct("ModAVUMetadataInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_MsParam.class.php000066400000000000000000000033171221272161600235040ustar00rootroot00000000000000 $label, "type" => $inOutStruct->type, $inOutStruct->type => $inOutStruct, "BinBytesBuf_PI" => $BinBytesBuf_PI); parent::__construct("MsParam_PI", $packlets); } // need to overwrite it's parent function here, since $inOutStruct->type // can be undefined, when it's parent packet class was defined. public function fromSXE(SimpleXMLElement $sxe) { if (!isset($this->packlets)) return; $this->packlets["label"] = (string)$sxe->label; $this->packlets["type"] = (string)$sxe->type; $typename = $this->packlets["type"]; //type of the expected packet if (substr($typename, -3, 3) != "_PI") { throw new RODSException("RP_MsParam::fromSXE " . "The XML node's type is unexpected: '$typename' " . " expecting some thing like xxx_PI", "SYS_PACK_INSTRUCT_FORMAT_ERR"); } $rp_classname = "RP_" . substr($typename, 0, strlen($typename) - 3); $inOutStruct = new $rp_classname(); $inOutStruct->fromSXE($sxe->$typename); $this->packlets["$typename"] = $inOutStruct; $this->packlets['BinBytesBuf_PI'] = new RP_BinBytesBuf(); $this->packlets['BinBytesBuf_PI']->fromSXE($sxe->BinBytesBuf_PI); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_MsParamArray.class.php000066400000000000000000000011121221272161600244720ustar00rootroot00000000000000array_rp_type = array("MsParam_PI" => "RP_MsParam"); $packlets = array("paramLen" => count($MsParam_PI), "oprType" => $oprType, "MsParam_PI" => $MsParam_PI); parent::__construct("MsParamArray_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_MsgHeader.class.php000066400000000000000000000007321221272161600240010ustar00rootroot00000000000000 $type, "msgLen" => $msgLen, "errorLen" => $errorLen, "bsLen" => $bsLen, "intInfo" => $intInfo); parent::__construct("MsgHeader_PI", $packlets); } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_RHostAddr.class.php000066400000000000000000000005501221272161600237720ustar00rootroot00000000000000 $hostAddr, "rodsZone" => $rodsZone, "port" => $port); parent::__construct("RHostAddr_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_RodsObjStat.class.php000066400000000000000000000013451221272161600243410ustar00rootroot00000000000000 $objSize, 'objType' => $objType, 'numCopies' => $numCopies, 'dataId' => $dataId, "chksum" => $chksum, "ownerName" => $ownerName, "ownerZone" => $ownerZone, 'createTime' => $createTime, 'modifyTime' => $modifyTime); parent::__construct("RodsObjStat_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_STR.class.php000066400000000000000000000004021221272161600226040ustar00rootroot00000000000000 $myStr); parent::__construct("STR_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_SqlResult.class.php000066400000000000000000000005621221272161600241010ustar00rootroot00000000000000 $attriInx, 'reslen' => $reslen, 'value' => $value); parent::__construct("SqlResult_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_StartupPack.class.php000066400000000000000000000012051221272161600243770ustar00rootroot00000000000000 1, "connectCnt" => 0, "proxyUser" => $user, "proxyRcatZone" => $zone, "clientUser" => $user, "clientRcatZone" => $zone, "relVersion" => $relVersion, "apiVersion" => $apiVersion, "option" => $option); parent::__construct("StartupPack_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_TransStat.class.php000066400000000000000000000005541221272161600240670ustar00rootroot00000000000000 $numThreads, 'bytesWritten' => $bytesWritten); parent::__construct("TransStat_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_Version.class.php000066400000000000000000000006551221272161600235730ustar00rootroot00000000000000 $status, "relVersion" => $relVersion, "apiVersion" => $apiVersion); parent::__construct("Version_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_authRequestOut.class.php000066400000000000000000000004611221272161600251430ustar00rootroot00000000000000 $challenge); parent::__construct("authRequestOut_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_authResponseInp.class.php000066400000000000000000000005311221272161600252660ustar00rootroot00000000000000 $response, "username" => $username); parent::__construct("authResponseInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_dataObjCloseInp.class.php000066400000000000000000000005661221272161600251500ustar00rootroot00000000000000 $l1descInx, 'bytesWritten' => $bytesWritten); parent::__construct("dataObjCloseInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_dataObjReadInp.class.php000066400000000000000000000005311221272161600247460ustar00rootroot00000000000000 $l1descInx, 'len' => $len); parent::__construct("dataObjReadInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_dataObjWriteInp.class.php000066400000000000000000000005361221272161600251720ustar00rootroot00000000000000 $dataObjInx, 'len' => $len); parent::__construct("dataObjWriteInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_fileLseekInp.class.php000066400000000000000000000005721221272161600245160ustar00rootroot00000000000000 $fileInx, "offset" => $offset, 'whence' => $whence); parent::__construct("fileLseekInp_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_fileLseekOut.class.php000066400000000000000000000004451221272161600245360ustar00rootroot00000000000000 $offset); parent::__construct("fileLseekOut_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_getTempPasswordOut.class.php000066400000000000000000000005161221272161600257620ustar00rootroot00000000000000 $stringToHashWith); parent::__construct("getTempPasswordOut_PI", $packlets); } } ?>php-irods-3.3.0~beta1/prods/src/packet/RP_pamAuthRequestInp.class.php000066400000000000000000000006001221272161600255530ustar00rootroot00000000000000 $pamUser, "pamPassword" => $pamPassword, "timeToLive" => $timeToLive); parent::__construct("pamAuthRequestInp_PI",$packlets); } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_pamAuthRequestOut.class.php000066400000000000000000000004761221272161600256070ustar00rootroot00000000000000 $irodsPamPassword); parent::__construct("pamAuthRequestOut_PI",$packlets); } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_sslEndInp.class.php000066400000000000000000000004121221272161600240340ustar00rootroot00000000000000 $arg0); parent::__construct("sslEndInp_PI",$packlets); } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_sslStartInp.class.php000066400000000000000000000004161221272161600244270ustar00rootroot00000000000000 $arg0); parent::__construct("sslStartInp_PI",$packlets); } } ?> php-irods-3.3.0~beta1/prods/src/packet/RP_ticketAdminInp.class.php000066400000000000000000000017451221272161600250520ustar00rootroot00000000000000 to use it, create -> to... create!, $arg2 = '', // the actual ticket $arg3 = '', // "read" or "write" -> in case of "create" above $arg4 = '', // full path to the resource, e.g.: /tempZone/home/rods/as $arg5 = '', $arg6 = '') { $packlets = array( 'arg1' => $arg1, 'arg2' => $arg2, 'arg3' => $arg3, 'arg4' => $arg4, 'arg5' => $arg5, 'arg6' => $arg6, ); parent::__construct('ticketAdminInp_PI', $packlets); } }php-irods-3.3.0~beta1/prods/src/prods.ini000066400000000000000000000012401221272161600203000ustar00rootroot00000000000000; Configuration file for the Prods API [ssl] ; Require verification of SSL certificate used. Default "false". ;verify_peer = "true" ; Allow self-signed certificates. Requires verify_peer. Default "false". ;allow_self_signed = "true" ; Location of Certificate Authority file on local filesystem which ; should be used with verify_peer equal "true" to authenticate ; the identity of the remote peer. ;cafile = "/path/to/cert.pem" ; If cafile is not specified or if the certificate is not found there, ; the directory pointed to by capath is searched for a suitable ; certificate. capath must be a correctly hashed certificate directory. ;capath = "/path/to/certfiles" php-irods-3.3.0~beta1/prods/src/release_notes.txt000066400000000000000000000030741221272161600220500ustar00rootroot00000000000000 *'''Project''': iRODS PHP Library PRODS and PRODS Web Browser *'''Date''': 11/26/2012 *'''Release Version''': 3.2.0 Release *'''git tag''': 3.2.0 ==News== This is the consolidated and updated release of the PRODS PHP library for iRODS. This library provides a pure-PHP interface to the iRODS system. This library is suitable for simple and quick interfaces to the iRODS data grid, and will be maintained for stability and compatibility. If advanced or higher-performance interfaces are desired, the Jargon Java API should be considered. Note that PHP, Jython, JRuby, Groovy, and other JVM dynamic languages can be used with Jarogn. The PRODS PHP Web Browser is also included in this project, and remains supported. Note that the PHP Web Browser functionality has been subsumed by the idrop-web browser and idrop-swing client. Please go to [[https://code.renci.org/gf/project/irodsphp/] for the latest news and info. Note that the git repository is now the canonical version of the PHP code. The code in the iRODS SVN server is deprecated and will be taken down at the 3.0.0 release point. There may be other versions in Google Code and other places, but these should be considered obsolete. ==Requirements== ==Libraries== ==Features== *[#1076] irods 3.2 release activities **Added a LICENSE.txt file at the top project level ==Bug Fixes== *[#1071] php uses self-closing tags for empty HTML tags **Added patch suggested by community Changing line 41 in RODSPacket.class.php (in PRods) from return ($doc->saveXML($root)); to return ($doc->saveXML($root, LIBXML_NOEMPTYTAG));php-irods-3.3.0~beta1/prods/src/setRodsAPINum.php000066400000000000000000000044621221272161600216270ustar00rootroot00000000000000 1) { if (empty($val1)) $val1 = trim($token); else $val2 = trim($token); } } if ((!empty($val1)) && (!empty($val2))) { array_push($value_pairs, array($val1, $val2)); } } } var_dump($value_pairs); foreach ($new_api_nums as $new_code_pair) { if ((!is_array($new_code_pair)) || (count($new_code_pair) != 2)) die("unexpected new_code_pair:$new_code_pair\n"); array_push($value_pairs, $new_code_pair); } $outputstr = " '$val2',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . '$GLOBALS[\'PRODS_API_NUMS_REV\']=array(' . "\n"; foreach ($value_pairs as $value_pair) { $val1 = $value_pair[0]; $val2 = $value_pair[1]; $outputstr = $outputstr . " '$val2' => '$val1',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . "?>\n"; file_put_contents($prods_api_num_file, $outputstr); ?> php-irods-3.3.0~beta1/prods/src/setRodsErrorCodes.php000066400000000000000000000051471221272161600226060ustar00rootroot00000000000000 3) { if (empty($val1)) $val1 = trim($token); else $val2 = trim($token); } } if ((!empty($val1)) && (!empty($val2))) { array_push($value_pairs, array($val1, $val2)); } } } foreach ($new_error_codes as $new_code_pair) { if ((!is_array($new_code_pair)) || (count($new_code_pair) != 2)) die("unexpected new_code_pair:$new_code_pair\n"); array_push($value_pairs, $new_code_pair); } $outputstr = " '$val2',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . '$GLOBALS[\'PRODS_ERR_CODES_REV\']=array(' . "\n"; foreach ($value_pairs as $value_pair) { $val1 = $value_pair[0]; $val2 = $value_pair[1]; $outputstr = $outputstr . " '$val2' => '$val1',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . "?>\n"; file_put_contents($prods_error_table_file, $outputstr); ?> php-irods-3.3.0~beta1/prods/src/setRodsGenQueryKeyWd.php000066400000000000000000000047301221272161600232370ustar00rootroot00000000000000 1) { if (empty($val1)) $val1 = trim($token); else { if (($token{0} == '"') /*&&($token{strlen($token)-1}=='"')*/) { if (empty($val2)) $val2 = trim($token); } } } } if ((!empty($val1)) && (!empty($val2))) { array_push($value_pairs, array($val1, $val2)); } } } foreach ($new_genque_keywds as $new_code_pair) { if ((!is_array($new_code_pair)) || (count($new_code_pair) != 2)) die("unexpected new_code_pair:$new_code_pair\n"); array_push($value_pairs, $new_code_pair); } $outputstr = " $val2,\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . '$GLOBALS[\'PRODS_GENQUE_KEYWD_REV\']=array(' . "\n"; foreach ($value_pairs as $value_pair) { $val1 = $value_pair[0]; $val2 = $value_pair[1]; $outputstr = $outputstr . " $val2 => '$val1',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . "?>\n"; file_put_contents($prods_genque_keywd_file, $outputstr); ?> php-irods-3.3.0~beta1/prods/src/setRodsGenQueryNum.php000066400000000000000000000041501221272161600227470ustar00rootroot00000000000000 '$val2',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . '$GLOBALS[\'PRODS_GENQUE_NUMS_REV\']=array(' . "\n"; foreach ($value_pairs as $value_pair) { $val1 = $value_pair[0]; $val2 = $value_pair[1]; $outputstr = $outputstr . " '$val2' => '$val1',\n"; } $outputstr = $outputstr . ");\n"; $outputstr = $outputstr . "?>\n"; file_put_contents($prods_genque_num_file, $outputstr); ?> php-irods-3.3.0~beta1/prods/test.php000066400000000000000000000055361221272161600173650ustar00rootroot00000000000000\n"; $conn = RODSConnManager::getConn($account); $que_result = $conn->dirExists($home_dir_str); if ($que_result === true) { echo "$home_dir_str exists!
\n"; } else { echo "$home_dir_str doesn't exists!
\n"; } $que_result = $conn->dirExists($home_dir_str . "/blah"); if ($que_result === true) { echo "$home_dir_str/blah exists!
\n"; } else { echo "$home_dir_str/blah doesn't exists!
\n"; } RODSConnManager::releaseConn($conn); $dir = new ProdsDir($account, "/tempZone/home/rods"); $childdirs = $dir->getChildDirs(); echo "Child dirs:
\n"; foreach ($childdirs as $childdir) { echo $childdir . "
\n"; } $childfiles = $dir->getChildFiles(); echo "Child files:
\n"; foreach ($childfiles as $childfile) { echo $childfile . "
\n"; /* $childfile->open("r"); echo "desc=".$childfile->getL1desc()."
\n"; echo "
".$childfile->read($childfile->stats->size)."

\n"; $cur_offset=$childfile->seek(3); echo "offsetted '$cur_offset' bytes
\n"; echo "
".$childfile->read($childfile->stats->size)."

\n"; */ //$childfile->close(); } $myfile = new ProdsFile($account, "/tempZone/home/rods/test1"); $myfile->open("w+", "demoResc"); $bytes = $myfile->write("Hello world from Sifang!\n"); echo "$bytes bytes written
\n"; $myfile->close(); $myfile->open("r", "demoResc", true); $str = $myfile->read(200); echo "the file reads:
$str
"; $myfile->close(); $file_src = new ProdsFile($account, "/tempZone/home/rods/test.php"); $file_dest = new ProdsFile($account, "/tempZone/home/rods/test.sifang.txt"); //$file_src->cpMeta($file_dest); foreach ($file_dest->getMeta() as $meta) { echo "$file_dest->path_str: $meta->name; $meta->value; $meta->units
\n"; } $meta = array(new RODSMeta("test1", "1")); $files = ProdsPath::queryMeta($account, $meta); foreach ($files as $file) echo "$file
\n"; echo "
"; $dirs = ProdsPath::queryMeta($account, $meta, 1); foreach ($dirs as $dir) echo "$dir
\n"; $file = new ProdsFile($account, "/tempZone/home/rods/test.php"); var_dump($file->getStats()); echo "
--- connection successful! #2--- " . microtime() . "
\n"; } catch (RODSException $e) { echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/000077500000000000000000000000001221272161600166435ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/test/execCmdOutUserRule.php000066400000000000000000000015711221272161600231070ustar00rootroot00000000000000connect(); $results = $conn->execUserRule($rule_body, $input_params, $out_params); var_dump($results); $conn->disconnect(); $rule = new ProdsRule($account, $rule_body, $input_params, $out_params); $results = $rule->execute(); var_dump($results); $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?> php-irods-3.3.0~beta1/prods/test/execUserRule.php000066400000000000000000000023571221272161600217760ustar00rootroot000000000000001m,' . 'msiReplColl(*desc_coll1,*desc_resc,backupMode,*outbuf)' . '##msiReplColl(*desc_coll2,*desc_resc,backupMode,*outbuf),' . 'nop)|nop'; $input_params = array('*desc_coll1' => '/tempZone/home/rods/repl_test3', '*desc_coll2' => '/tempZone/home/rods/repl_test4', '*desc_resc' => 'demoResc2'); $out_params = array('*desc_coll1', '*desc_coll2'); try { $start_time = microtime(true); $conn = new RODSConn($account); $conn->connect(); $results = $conn->execUserRule($rule_body, $input_params, $out_params); var_dump($results); $conn->disconnect(); $rule = new ProdsRule($account, $rule_body, $input_params, $out_params); $results = $rule->execute(); var_dump($results); $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/getFile.php000066400000000000000000000022461221272161600207370ustar00rootroot00000000000000open("r"); //while($str=$myfile->read(4096)) //$str=file_get_contents("rods://rods:rods@localhost:1247/tempZone/home/rods/testphoto.png"); $str = file_get_contents("rods+ticket://a#RpO7kyGvh40egRz:a@localhost:1247/tempZone/home/rods/phrases.html"); echo $str; //close the file pointer $myfile->close(); } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); }php-irods-3.3.0~beta1/prods/test/getReplInfo.php000066400000000000000000000011731221272161600215740ustar00rootroot00000000000000getReplInfo(); var_dump($replinfo); $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/metadata.php000066400000000000000000000016451221272161600211420ustar00rootroot00000000000000rmMetaByID(11053); $metas=$dir->getMeta(); var_dump($metas); */ echo "--- getting all possible metadata names ---
\n"; $que = new ProdsQuery($account); $metanames = $que->getMetadataNamesForAllFiles(); var_dump($metanames); $metanames2 = $que->getMetadataNamesForAllDirs(); var_dump($metanames2); $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/query.php000066400000000000000000000014541221272161600205250ustar00rootroot00000000000000 true, 'recursive' => true); $total_count = 0; $results = $dir->findFiles($terms, $total_count); foreach ($results as $file) { echo $file->path_str . "\n"; } echo "Total: $total_count files"; $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/repl.php000066400000000000000000000013031221272161600203130ustar00rootroot00000000000000repl('resc2', array('backupMode' => true)); echo "Replication successful! $numbytes bytes written
\n"; $end_time = microtime(true); $exec_time = $end_time - $start_time; echo "--- test successful! in ($exec_time sec) ---
\n"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/tempPassword.php000066400000000000000000000027741221272161600220560ustar00rootroot00000000000000\n"; $conn = RODSConnManager::getConn($account); echo "--- trying temp password #1 --- " . microtime() . "
\n"; $key = $conn->connect(); $key = $conn->getKeyForTempPassword(); echo "key = $key
\n"; $temppass = $conn->getTempPassword($key); echo "temppass = $temppass
\n"; $account2 = clone $account; $account2->pass = $temppass; echo "--- trying to connect with temp password--- " . microtime() . "
\n"; $conn2 = new RODSConn($account2); $conn2->connect(); echo "--- temp password #1 passed --- " . microtime() . "
\n"; echo "--- trying temp password #2 --- " . microtime() . "
\n"; $temppass = $account->getTempPassword(); echo "temppass#2 = $temppass
\n"; $account2 = clone $account; $account2->pass = $temppass; echo "--- trying to connect with temp password #2 --- " . microtime() . "
\n"; $conn2 = new RODSConn($account2); $conn2->connect(); echo "--- temp password #2 passed --- " . microtime() . "
\n"; echo "--- test successful! --- " . microtime() . "
\n"; } catch (RODSException $e) { echo "--- test failed! --- " . microtime() . "
\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/test/testTickets.php000066400000000000000000000022521221272161600216630ustar00rootroot00000000000000 * Date: 14.12.12 * Time: 13:40 */ require_once("../src/Prods.inc.php"); require_once("../src/ProdsStreamer.class.php"); error_reporting(-1); try { // make an iRODS account object for connection, assuming: // username: demouser, password: demopass, server: srbbrick15.sdsc.edu, port: 1247 // $host, $port, $user, $pass, $zone = "", $default_resc = "", $ticket = '' $account = new RODSAccount('localhost', 1247, 'rods', 'rods'); //$account = new RODSAccount('localhost', 1247, 'a', 'a', '', '', 'RpO7kyGvh40egRz'); $ProdsTicket = new ProdsTicket($account); // public function createTicket( $object, $permission = 'read', $ticket = '' ) $ticket = $ProdsTicket->createTicket('/tempZone/home/rods/as'); echo 'Created ticket '.$ticket.'
'; // public function deleteTicket( $ticket ) $ProdsTicket->deleteTicket($ticket); echo 'Deleted ticket '.$ticket.'
'; echo "You have to trust this test since the ticket doesn't exist anymore and you can't check it!"; } catch (RODSException $e) { echo "--- test failed! ---
\n"; echo ($e); echo $e->showStackTrace(); }php-irods-3.3.0~beta1/prods/test_streamer.php000066400000000000000000000004361221272161600212610ustar00rootroot00000000000000 php-irods-3.3.0~beta1/prods/tutorials/000077500000000000000000000000001221272161600177125ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/000077500000000000000000000000001221272161600210015ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/.svn/000077500000000000000000000000001221272161600216655ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/.svn/text-base/000077500000000000000000000000001221272161600235615ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/.svn/text-base/gettingstarted.php.netbeans-base000066400000000000000000000001311221272161600320230ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/Prods.pkg000066400000000000000000000061751221272161600226040ustar00rootroot00000000000000 User Guide for PRODS - PHP iRODS client API To demonstrate the various tasks available in PRODS Sifang Lu {@toc} Introduction PRODS is a PHP client API for iRODS (http://www.irods.org). It does not depend on any external library, and talk to iRODS server directly via sockets with native iRODS XML protocol. Download PRODS package PRODS can be {@link http://code.google.com/p/extrods/downloads/list downloaded as the release tar ball}. Or you can use public SVN to check out latest code: svn checkout http://extrods.googlecode.com/svn/trunk/ extrods-read-only Getting Started PRODS requirs PHP 5.2 or higher. It does not depend on any external library. To install the API, just get the source pakage, and include the file "Prods.inc.php" in your PHP code, and nothing else! {@example tutorials/Prods/gettingstarted.php} Connect to server and file IO {@example tutorials/Prods/fileio.php} Directory/Collection manipulation iRODS "collection" is equvilant to directory in normal file system. They can be accessed and manipulated in simular fashions. {@example tutorials/Prods/dir.php} Access iRODS file structure with native PHP functions PRODS provides a streamer class for native PHP funtions to access iRODS file structure. Many native PHP functions support streamer class, including fopen(), fwrite(), file_get_contents(), scandir() and many more. It offers an extremly simple way for application developers to access iRODS file structures. {@example tutorials/Prods/streamer.php} Get/Set User-defined metadata Any iRODS file or directory can have user-defined metadata. User-defined metadata is a list of name/value/unit triplets. {@example tutorials/Prods/meta.php} Find files/dirs by User-defined metadata Files and directories can be searched by User-defined metadata {@example tutorials/Prods/meta_search.php} Exception Handling Prods classes/methods could throw an exception, when it encounters an error. see {@link RODSException} for details {@example tutorials/Prods/exception.php} php-irods-3.3.0~beta1/prods/tutorials/Prods/dir.php000066400000000000000000000012441221272161600222710ustar00rootroot00000000000000mkdir("mydir"); //list home directory $children = $home->getAllChildren(); //print each child's name echo "children are: \n"; foreach ($children as $child) echo $child->getName() . "\n"; ?>php-irods-3.3.0~beta1/prods/tutorials/Prods/exception.php000066400000000000000000000010511221272161600235050ustar00rootroot00000000000000\n"; echo ($e); echo $e->showStackTrace(); } ?>php-irods-3.3.0~beta1/prods/tutorials/Prods/fileio.php000066400000000000000000000022131221272161600227570ustar00rootroot00000000000000open("r"); echo "the file reads:
";
while ($str = $myfile->read(4096))
    echo $str;
echo "
"; //close the file pointer $myfile->close(); //create an file object for write, assuming the path is "/tempZone/home/demouser/test_write.txt" $myfile = new ProdsFile($account, "/tempZone/home/demouser/test_write.txt"); //write hello world to the file, onto "demoResc" as resource. Note that resource name is //required here by method open(), because iRODS needs to know which resource to write to. $myfile->open("w+", "demoResc"); $bytes = $myfile->write("Hello world!\n"); //print the number of bytes writen echo "$bytes bytes written
\n"; $myfile->close(); ?>php-irods-3.3.0~beta1/prods/tutorials/Prods/gettingstarted.php000066400000000000000000000001331221272161600245370ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/tutorials/Prods/meta.php000066400000000000000000000014601221272161600224410ustar00rootroot00000000000000addMeta($meta); //get all metadata of the file, and print them //the output should look like "Name: Myname | Value: myvalue" $metadatas = $myfile->getMeta(); foreach ($metadatas as $meta) echo 'Name: ' . $meta->name . " | " . $meta->value . "\n"; ?>php-irods-3.3.0~beta1/prods/tutorials/Prods/meta_search.php000066400000000000000000000016421221272161600237700ustar00rootroot00000000000000findFiles( array( 'descendantOnly' => true, //only search under this dir 'recursive' => true, //search through all child dir as well 'metadata' => array($meta) ) ); // print the found files foreach ($files as $file) { echo "Found file: " . $file->getPath() . "\n"; } ?>php-irods-3.3.0~beta1/prods/tutorials/Prods/streamer.php000066400000000000000000000012541221272161600233360ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/utilities/000077500000000000000000000000001221272161600176775ustar00rootroot00000000000000php-irods-3.3.0~beta1/prods/utilities/exif2meta.php000066400000000000000000000120661221272161600223010ustar00rootroot00000000000000getMeta(); $metaalreadyset = false; foreach ($metas as $meta) { if ($meta->name == 'EXIF.ExifVersion') { $metaalreadyset = true; break; } } if ($metaalreadyset === true) { $time = '[' . date('c') . ']'; echo "$time 0: metadata already set for '$target_file'\n"; exit(0); } // download file from irods to tmp $localfile = '/tmp/' . basename($target_file); if (file_exists($localfile)) unlink($localfile); $irodsfile->open("r"); $str = ''; while ((($buffer = $irodsfile->read(1024 * 1024)) != NULL) && (connection_status() == 0)) { $str = $str . $buffer; } $irodsfile->close(); file_put_contents($localfile, $str); extactExif($localfile, $irodsfile); if (file_exists($localfile)) unlink($localfile); $time = '[' . date('c') . ']'; echo "$time 0: '$target_file' processed!\n"; exit(0); } catch (Exception $e) { if (file_exists($localfile)) unlink($localfile); $time = '[' . date('c') . ']'; echo "$time " . $e->getCode() . ": " . "$e"; exit(-1); } function extactExif($localfile, $remoteRODSfile) { $exif = exif_read_data($localfile, 'EXIF'); if ($exif === false) return; foreach ($exif as $name => $val) { // replace ascii char that can't be displayed, which causes problem in irods if ((!is_array($val)) && (is_string($val)) && ((ord($val[0]) < 32) || (ord($val[0]) > 126)) && ($name != 'UserComment') ) { $val = '__undefined__'; } if ($name == 'THUMBNAIL') { foreach ($val as $tname => $tval) $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.THUMBNAIL.' . $tname, $tval, '')); } else if ($name == 'COMPUTED') { foreach ($val as $cname => $cval) { if ($cname == 'html') { //skip html tag, because there is a irods server bug that corrupting string with //double quotes: 'COMPUTED.html: width="3264" height="2448"' } else $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.COMPUTED.' . $cname, $cval, '')); } } else if ($name == 'MakerNote') { //skip makernote } else if ($name == 'ComponentsConfiguration') { //skip ComponentsConfiguration, because there is a irods server bug that corrupting string with } else if ($name == 'UserComment') { if (($start = strpos($val, 'GCM_TAG')) !== false) { $str = substr($val, $start + strlen('GCM_TAG')); $gcm_tokens = explode(chr(0), $str); $gcm_counter = 0; foreach ($gcm_tokens as $gcm_tag) { if ((strlen($gcm_tag) > 0) && (preg_match('/^[' . chr(32) . '-' . chr(126) . ']+$/', $gcm_tag))) { $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.UserComment' . $gcm_counter++, $gcm_tag, '')); } } } else { if (strlen($val) < 1) $str = ' '; //replace no displable char $str = preg_replace('/[^' . chr(32) . '-' . chr(126) . ']+/', ' ', $val); $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.UserComment', $str, '')); } } else if (is_array($val)) { foreach ($val as $cname => $cval) { $remoteRODSfile->addMeta(new RODSMeta( "EXIF.$name." . $cname, $cval, '')); } } else $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.' . $name, $val, '')); } } ?> php-irods-3.3.0~beta1/release_notes.txt000066400000000000000000000014201221272161600201230ustar00rootroot00000000000000*'''Project''': iRODS PHP Library PRODS and PRODS Web Browser *'''Date''': 06/04/2013 *'''Release Version''': 3.3.0-beta1 *'''git tag''': 3.3.0-beta1 ==News== The PRODS PHP Web Browser is also included in this project, and remains supported. Note that the PHP Web Browser functionality has been subsumed by the idrop-web browser and idrop-swing client. Please go to [[https://code.renci.org/gf/project/irodsphp/] for the latest news and info. Note that the git repository is now the canonical version of the PHP code. The code in the iRODS SVN server is deprecated and will be taken down at the 3.0.0 release point. There may be other versions in Google Code and other places, but these should be considered obsolete. Please review release notes in sub projects for details php-irods-3.3.0~beta1/web/000077500000000000000000000000001221272161600153125ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/.htaccess000066400000000000000000000003251221272161600171100ustar00rootroot00000000000000# Enable mod_rewrite, start rewrite engine RewriteEngine on # # Internally rewrite search engine friendly static url to dynamic filepath and query RewriteRule ^rodsproxy/(.*)$ services/download.php?ruri=$1 [L]php-irods-3.3.0~beta1/web/README.setup000066400000000000000000000016661221272161600173420ustar00rootroot000000000000001. Install Apache 1.x.x (mod_ssl highly recommended) and PHP 5.2.1 or newer 2. make a simbalic link under Apache's htdocs directory pointing to this web directory. For example: cd /APACHE_ROOT/SOME_DIR ln -s /RODS_CVS/clients/web rodsweb 3. make sure the htaccess-per-directory and symbalic-link is allowed in Apache's config file. For example, Here is a partical Apache's httpd.config file, used for development. ... Options Indexes FollowSymLinks MultiViews ... AllowOverride All ... 4. Download the file "http://extjs.com/deploy/ext-1.1.zip", and extract it in this directory. (This zip file: extjs.zip is also included in RODS cvs for convinience only. It's subject to be removed if there is any licensing dispute.) 5. Rename the extracted directory from "ext-1.1" to "extjs" php-irods-3.3.0~beta1/web/RODSAcctManager.class.php000066400000000000000000000031161221272161600217650ustar00rootroot00000000000000accts=array(); $this->cur_acct=NULL; } public function add(RODSAccount $newacct) { foreach($this->accts as &$acct) { if ($newacct->equals($acct)) { $acct=$newacct; $this->cur_acct=$newacct; return; } } $this->accts[]=$newacct; $this->cur_acct=$newacct; } public function getCurAcct() { return $this->cur_acct; } public function findAcct(RODSAccount $newacct) { $index=$this->findAcctIndex($newacct); //echo ("index=$index\n"); if ($index<0) return NULL; else { return $this->accts[$index]; } } public function findAcctIndex(RODSAccount $newacct) { for($i=0; $iaccts); $i++ ) { $acct=$this->accts[$i]; if (true==$newacct->equals($acct)) { $this->cur_acct=$acct; return $i; } } return -1; } // update account information. public function updateAcct(RODSAccount $newacct) { $oldacct_index=$this->findAcctIndex($newacct); if ($oldacct_index>=0) { if (!empty($newacct->pass)) { $this->accts[$oldacct_index]->pass=$newacct->pass; } if (!empty($newacct->zone)) { $this->accts[$oldacct_index]->zone=$newacct->zone; } } else { $this->add($newacct); } } } ?>php-irods-3.3.0~beta1/web/RODSTreeLoader.js000066400000000000000000000101231221272161600203630ustar00rootroot00000000000000/* * Ext JS Library 1.0 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ /** * @class Ext.tree.TreeLoader */ Ext.tree.RODSTreeLoader = function(config){ this.baseParams = {}; this.requestMethod = "POST"; Ext.apply(this, config); this.events = { "beforeload" : true, "load" : true, "loadexception" : true }; }; Ext.extend(Ext.tree.RODSTreeLoader, Ext.util.Observable, { uiProviders : {}, clearOnLoad : true, load : function(node, callback){ if(this.clearOnLoad){ while(node.firstChild){ node.removeChild(node.firstChild); } } if(node.attributes.children){ // preloaded json children var cs = node.attributes.children; for(var i = 0, len = cs.length; i < len; i++){ node.appendChild(this.createNode(cs[i])); } if(typeof callback == "function"){ callback(); } }else if(this.dataUrl){ this.requestData(node, callback); } }, getParams: function(node){ var buf = [], bp = this.baseParams; for(var key in bp){ if(typeof bp[key] != "function"){ buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&"); } } if (node.getDepth()==0) buf.push("recursive=", encodeURIComponent(1), "&"); buf.push("node=", encodeURIComponent(node.getPath())); return buf.join(""); }, requestData : function(node, callback){ if(this.fireEvent("beforeload", this, node, callback) !== false){ var params = this.getParams(node); var cb = { success: this.handleResponse, failure: this.handleFailure, scope: this, argument: {callback: callback, node: node} }; this.transId = Ext.lib.Ajax.request(this.requestMethod, this.dataUrl, cb, params); }else{ // if the load is cancelled, make sure we notify // the node that we are done if(typeof callback == "function"){ callback(); } } }, isLoading : function(){ return this.transId ? true : false; }, abort : function(){ if(this.isLoading()){ Ext.lib.Ajax.abort(this.transId); } }, /** * Override this function for custom TreeNode node implementation */ createNode : function(attr){ if(this.applyLoader !== false){ attr.loader = this; } if(typeof attr.uiProvider == 'string'){ attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider); } return(attr.leaf ? new Ext.tree.TreeNode(attr) : new Ext.tree.AsyncTreeNode(attr)); }, processResponse : function(response, node, callback){ var json = response.responseText; try { var o = eval("("+json+")"); for(var i = 0, len = o.length; i < len; i++){ var n = this.createNode(o[i]); if(n){ node.appendChild(n); } } if(typeof callback == "function"){ callback(this, node); } }catch(e){ this.handleFailure(response); } }, handleResponse : function(response){ this.transId = false; var a = response.argument; this.processResponse(response, a.node, a.callback); this.fireEvent("load", this, a.node, response); }, handleFailure : function(response){ this.transId = false; var a = response.argument; this.fireEvent("loadexception", this, a.node, response); if(typeof a.callback == "function"){ a.callback(this, a.node); } } });php-irods-3.3.0~beta1/web/applets/000077500000000000000000000000001221272161600167625ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/UploadApplet.html000066400000000000000000000004711221272161600222440ustar00rootroot00000000000000 Upload Applet php-irods-3.3.0~beta1/web/applets/edu/000077500000000000000000000000001221272161600175375ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/edu/sdsc/000077500000000000000000000000001221272161600204735ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/000077500000000000000000000000001221272161600214205ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/000077500000000000000000000000001221272161600222045ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/000077500000000000000000000000001221272161600234715ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/Account.java000066400000000000000000000231501221272161600257310ustar00rootroot00000000000000// Copyright (c) 2008, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // Account.java - edu.sdsc.grid.gui.applet.Account // // CLASS HIERARCHY // java.lang.Object // | // +-.Account // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // package edu.sdsc.grid.gui.applet; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import org.json.JSONObject; //temp import edu.sdsc.grid.io.RemoteFileSystem; //TOD should use remote instead. import edu.sdsc.grid.io.irods.IRODSFileSystem; import edu.sdsc.grid.io.FileFactory; import edu.sdsc.grid.io.GeneralFile; import edu.sdsc.grid.io.GeneralFileSystem; import edu.sdsc.grid.io.GeneralMetaData; import edu.sdsc.grid.io.MetaDataSet; import edu.sdsc.grid.io.MetaDataCondition; import edu.sdsc.grid.io.MetaDataRecordList; import edu.sdsc.grid.io.MetaDataSelect; import edu.sdsc.grid.io.ResourceMetaData; import edu.sdsc.grid.io.UserMetaData; import java.net.URI; import java.net.URISyntaxException; /** * The account information of a remote filesystem. */ class Account { // Logger static AppletLogger logger = AppletLogger.getInstance(); private URI uri; private GeneralFileSystem fileSystem; private GeneralFile destination, destinationFolder; private String zone = "tempZone"; // assign default value static String defaultResource = "demoResc"; // assign default value private int port; private String sessionId; // web session id passed to this class by UploadApplet /** * Remote file system resource list */ private List resourceList = new ArrayList(); /** * Used for parsing uri */ // private static String USERINFO_DELIMITER = ":"; /** * Used for parsing uri */ private static String SCHEME_DELIMITER = "://"; /** * Web url for requesting a password for the given uri */ static String TEMP_PASSWORD_SERVICE_URL = "http://www.irods.org/web"; /** * Used by the applet at initialization */ Account( String tempPasswordServiceUrl, URI uri, String sessionId ) throws IOException { if (uri == null) { throw new NullPointerException("iRODS URI cannot be null"); } else { this.uri = uri; } TEMP_PASSWORD_SERVICE_URL = tempPasswordServiceUrl; parseURI(uri, true); setSessionId(sessionId); //TODO Jargon will figure this out? setDefaultResource(); setResourceList(); }//Account /** * Queries the irods filesystem for available resources * saves resources to a List */ private void setResourceList( ) { try { MetaDataRecordList[] rl = fileSystem.query( null, new MetaDataSelect[]{ MetaDataSet.newSelection(ResourceMetaData.RESOURCE_NAME) } ); for (int i=0; i < rl.length; i++) { String rsc = rl[i].getStringValue(0); resourceList.add(rsc); // add to database // applet queries database for a list of resources when // reloading files that have not been uploaded //TODO change database to accept uri's DBUtil.getInstance().addResource( ((RemoteFileSystem)fileSystem).getHost(), ((RemoteFileSystem)fileSystem).getPort(), rsc); } } catch (Exception e) { logger.log("Account.class. Problem querying for resource list. " + e); } }//setResourceList List getResourceList( ) { return resourceList; } public void parseURI( URI uri, boolean isInit ) throws IOException { // Possible URI formats: // URI_PARAM = irods://user:pass@host:port/destination // URI_PARAM = irods://user@host:port/destination if (uri == null) return; if (isInit) { // destination value during upload process could be the file name destinationFolder = FileFactory.newFile(uri, getPassword(uri)); fileSystem = destinationFolder.getFileSystem(); } else { fileSystem = FileFactory.newFile(uri, getPassword(uri)).getFileSystem(); } } /** * In case of need to change upload destination after applet start */ void setURI( URI uri ) throws IOException { parseURI(uri, true); } URI getURI( ) { return uri; } void setSessionId( String sessionId ) { if (sessionId != null && !sessionId.trim().equals("")) this.sessionId = sessionId; } String getSessionId( ) { return sessionId; } GeneralFile getDestinationFolder( ) { return destinationFolder; } void setDefaultResource( ) { //TODO add getDefaultStorageResource to RemoteFileSystem? defaultResource = ((IRODSFileSystem)fileSystem).getDefaultStorageResource(); } String getDefaultResource( ) { return defaultResource; } public String _getPassword( URI uri ) { String result = uri.getUserInfo(); int index = result.indexOf(":"); if (index >= 0) { return result.substring(index+1); } else { //logger.log("No key in passwordMap."); return null; } } public String getPassword( URI uri ) { // look first to see if password can be found if (_getPassword(uri) != null) return _getPassword(uri); // will need to get temporary password if not found // use sessionId to get temporary password // use session id to get temporary password String result = null; try { // temp password service does not accept "irods://user@host:port" // but accepts "user@host:port" for authentication String sUri = scrubURI(uri); //TODO? php uses ruri URL url = new URL(TEMP_PASSWORD_SERVICE_URL + "?SID=" + sessionId + "&ruri=" + URLEncoder.encode(sUri, "UTF-8") ); // // possible returned value from temp password service // {"success":false,"error":"Authentication Required"} // {"success":true,"temppass":"78d49f10ff73889ba9ee3bbf978c093a"} // JSONObject jsonObject = null; URLConnection conn = url.openConnection(); InputStream istream = conn.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(istream)); if ((result = in.readLine()) != null) { jsonObject = new JSONObject(result); } if (jsonObject.has("success")) { // true or false if (jsonObject.get("success").toString().equals("false")) { // get the error message first if (jsonObject.has("error")) { // a String message logger.log("Returned error message from temporary password service is: " + jsonObject.get("error")); } return null; } }//if // should be able to retrieve password at this point if (jsonObject.has("temppass")) { // a String message result = (String) jsonObject.get("temppass"); } } catch (java.io.FileNotFoundException fe) { logger.log("Could not find temporary password service. " + fe); fe.printStackTrace(); } catch (Exception e) { logger.log("Exception getting temporary password. " + e); e.printStackTrace(); } if (result == null) return null; return result; } public String scrubURI( URI realURI ) { String result = realURI.toString(); // sample uri // irods://rods:1580a833c4618453a3bd53fafd81db9f@saltwater.sdsc.edu:1247/tempZone/home/rods/include //remove the uri scheme (TODO for some reason?) int i = result.indexOf(SCHEME_DELIMITER); try { if (i >= 0) { return result.substring(i+SCHEME_DELIMITER.length()); } } catch (StringIndexOutOfBoundsException e) { logger.log("Problem scrubbing uri. " + e); } return result; } }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/AppletConstant.java000066400000000000000000000056141221272161600273010ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // AppletConstant.java - edu.sdsc.grid.gui.applet.AppletConstant // // CLASS HIERARCHY // java.lang.Object // | // +-.AppletConstant // // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; public interface AppletConstant { static String USER_HOME = System.getProperty("user.home"); static String FILE_SEPARATOR = System.getProperty("file.separator"); static String IRODS_DIR = USER_HOME + FILE_SEPARATOR + ".irods"; static String UPLOADED_LOG = IRODS_DIR + FILE_SEPARATOR + "uploaded.txt"; static String QUEUE_LOG = IRODS_DIR + FILE_SEPARATOR + "queue.txt"; static String APPLET_LOG = IRODS_DIR + FILE_SEPARATOR + "log.txt"; /* Column index for table */ // will need to change these when table model changes // find a way to set these as columns are set by the table model static int ICON_COLUMN = 0; static int LOCAL_COLUMN = 1; static int REMOTE_COLUMN = 2; static int FILE_SIZE_COLUMN = 3; static int STATUS_COLUMN = 3; static String IN_PROGRESS_STATUS = "In Progress"; static String DONE_STATUS = "Done"; static String FAILED_STATUS = "Failed"; } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/AppletLogger.java000066400000000000000000000072671221272161600267350ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // AppletLogger.java - edu.sdsc.grid.gui.applet.AppletLogger // // CLASS HIERARCHY // java.lang.Object // | // +-.AppletLogger // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; import java.text.DateFormat; // Class for logging debug messages to text file class AppletLogger { static { init(); } protected AppletLogger() {} private static AppletLogger instance = null; public static AppletLogger getInstance() { if (instance == null) instance = new AppletLogger(); return instance; } private static void init() { File file = new File(UploadApplet.IRODS_DIR); if (! file.exists()) file.mkdir(); file = new File(UploadApplet.APPLET_LOG); if (file.exists()) { // rename file and append current timestamp file.renameTo(new File(UploadApplet.APPLET_LOG + "-" + System.currentTimeMillis())); } }//init public synchronized static void log(String s) { File log = new File(UploadApplet.APPLET_LOG); FileOutputStream fos = null; Date date = new Date(); try { fos = new FileOutputStream(log, true); fos.write((date.toString() + " ").getBytes()); fos.write(s.getBytes()); fos.write("\n".getBytes()); // write to UploadApplet.textArea DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); } catch (IOException ioe) { System.out.println("log(): " + ioe); } finally { try { fos.close(); } catch (IOException ioe) { } }//try-catch-finally }//log }//classphp-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/DBServer.java000066400000000000000000000071151221272161600260140ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // DBServer.java - edu.sdsc.grid.gui.applet.DBServer // // CLASS HIERARCHY // java.lang.Object // | // +-.DBServer // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import org.hsqldb.Server; // This class handles the starting/stopping of the database server class DBServer { private static DBServer instance; private static Server server; static AppletLogger logger = AppletLogger.getInstance(); private DBServer() { } static DBServer getInstance() { if (instance == null) instance = new DBServer(); return instance; }//getInstance public static void start() { if (server == null) { PrintWriter writer = null; try { writer = new PrintWriter(UploadApplet.APPLET_LOG); } catch (FileNotFoundException e) { // no log }//try-catch server = new org.hsqldb.Server(); server.setLogWriter(writer); // write to log file instead server.setErrWriter(writer); server.putPropertiesFromString("database.0=file:" + DBUtil.DB_FILE + ";dbname.0=mydb"); }//if if (server.getState() == 16) { // server is not running try { server.start(); } catch (Exception e) { logger.log("server.start() exception : " + e); }//try-catch } }//start public static void shutdown() { if (server != null) { server.shutdown(); File lockFile = new File(DBUtil.DB_LOCK_FILE); // delete lock file so other JVMs can access the database if (lockFile.exists()) lockFile.delete(); }//if }//shutdown } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/DBUtil.java000066400000000000000000000433121221272161600254620ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // DBUtil.java - edu.sdsc.grid.gui.applet.DBUtil // // CLASS HIERARCHY // java.lang.Object // | // +-.DBUtil // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.io.IOException; import java.net.URISyntaxException; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; // This class handles the interaction with the database // contains SQL statements public class DBUtil { static String DB_FILE = UploadApplet.IRODS_DIR + UploadApplet.FILE_SEPARATOR + "mydb"; static String DB_LOCK_FILE = DB_FILE + ".lck"; static String DB_SERVER_URL = "jdbc:hsqldb:hsql://localhost/mydb"; static String DB_USER = "sa"; static String DB_PASSWORD = ""; static String DB_SCRIPT_FILE = UploadApplet.IRODS_DIR + UploadApplet.FILE_SEPARATOR + "db.script"; private static DBUtil instance; private static Connection c; private static Statement stmt; private static AppletLogger logger = AppletLogger.getInstance(); private DBUtil() { } public static DBUtil getInstance() { if (instance == null) { instance = new DBUtil(); instance.init(); }//if return instance; }//getInstance private static void init() { if (! tableExists()) { createTables(); } }//init // checks to see if the tables have be created private static boolean tableExists() { beginTransaction(); String sql = "SELECT count(*) FROM queue"; ResultSet rs = null; try { rs = stmt.executeQuery(sql); if (rs.next()) { return true; } } catch (SQLException ex) { ex.printStackTrace(); } finally { try { if (rs != null) rs.close(); } catch (SQLException e) { // no log } endTransaction(); }//try-catch-finally return false; }//tableExists // creates the tables private static void createTables() { beginTransaction(); String sql = "CREATE TABLE queue (" + "source VARCHAR," + "destination VARCHAR," + "resource VARCHAR," + "status VARCHAR," + "type VARCHAR," + "assigned BOOLEAN," + "PRIMARY KEY(source, destination)" + ")"; try { stmt.execute(sql); sql = "CREATE TABLE resource (" + "host VARCHAR," + "port INTEGER," + "name VARCHAR," + "PRIMARY KEY (host, port, name)" + ")"; stmt.execute(sql); } catch (SQLException ex) { ex.printStackTrace(); } finally { endTransaction(); }//try-catch-finally }//createTable // first check to see if the UploadItem already exists, if not then // inserts data into the table // UploadItem contains information about the file/folder to be uploaded // and where it will be uploaded public synchronized static boolean insert(UploadItem item) { /* beginTransaction(); boolean rowExist = false; String sql = "SELECT COUNT(*) FROM queue WHERE source = ? AND destination = ?"; ResultSet rs = null; try { PreparedStatement p = c.prepareStatement(sql); p.setString(1, item.getSource()); p.setString(2, item.getDestination()); rs = p.executeQuery(); if (rs.next()) if (rs.getInt(1) > 0) rowExist = true; } catch (SQLException ex) { ex.printStackTrace(); }//try-catch sql = "INSERT INTO queue (source, destination, resource, status, type, assigned) " + "VALUES(?, ?, ?, ?, ?, ?) "; try { if (!rowExist) { PreparedStatement p = c.prepareStatement(sql); p.setString(1, item.getSource()); p.setString(2, item.getDestination()); p.setString(3, item.getSelectedResource()); p.setString(4, item.getStatus()); p.setString(5, item.getType()); p.setBoolean(6, true); p.execute(); stmt.executeQuery("CHECKPOINT"); return true; } } catch (SQLException ex) { ex.printStackTrace(); return false; } finally { try { if (rs != null) rs.close(); } catch (SQLException e) { // no log } endTransaction(); }//try-catch-finally return false;*/return true; }//insert // returns a list of files/folders that have not been uploaded (assigned == false) // there will be items that have not been uploaded if the applet // closes while there are still items not uploaded successfully public synchronized static List getUnassigned() { beginTransaction(); List itemList = new ArrayList(); String sql = "SELECT source, destination, resource FROM queue WHERE assigned = false AND status != '" + UploadItem.STATUS_UPLOADED + "'"; ResultSet rs = null; try { rs = stmt.executeQuery(sql); // returns one row ONLY while (rs.next()) { UploadItem item = new UploadItem(rs.getString(1), rs.getString(2), rs.getString(3)); itemList.add(item); } } catch (SQLException ex) { ex.printStackTrace(); logger.log("getUnassigned: " + ex); } catch (URISyntaxException ex) { ex.printStackTrace(); logger.log("URISyntaxException: " + ex); } catch (IOException ex) { ex.printStackTrace(); logger.log("IOException: " + ex); } finally { try { if (rs != null) rs.close(); } catch (SQLException e) { // no log } endTransaction(); }//try-catch-finally return itemList; }//getUnassigned // updates the table and sets the value for assigned to true // this is to prevent multiple applets from loading // the same items for uploading public synchronized static void setAssigned(List itemList) { beginTransaction(); String sql = "UPDATE queue SET assigned = true WHERE source = ? AND destination = ?"; // TODO: batch sql update PreparedStatement pstmt = null; try { pstmt = c.prepareStatement(sql); for (int i=0; i 15000) { // if uploaded destination uri is same as current uri // then call JavaScript to reload grid page if ( uploadItem.getDestinationParent().getPath().equals( applet.getRuri().getPath()) ) { callJavaScript("refreshGrid()"); } // refresh folder view if (uploadItem.getType().equals(UploadItem.TYPE_FOLDER)) { String s = "refreshTreeNodeByRURI('" + account.getURI() + "')"; callJavaScript(s); }//if }//if }//try-catch-finally } }//UploadThread private void upload() { new Thread() { public void run() { cancelUpload = false; // reset int rowCount = model.getRowCount(); URI remoteURI = null; clearCompletedButton.setEnabled(false); uploadButton.setEnabled(false); removeButton.setEnabled(false); try { for (int row = 0; row < rowCount; row++) { // first check if file has been uploaded successfully // 1. check for ProgressBar // 2. check string of ProgressBar // 3. if DONE, don't upload again // 4. else, upload // // TODO: check against Database instead // JProgressBar bar = (model.getValueAt(row, UploadTableModel.STATUS_COLUMN) == null) ? new JProgressBar(0,100) : (JProgressBar) model.getValueAt(row, UploadTableModel.STATUS_COLUMN); if (bar.getString().equalsIgnoreCase(UploadItem.DONE_STATUS)) continue; // file already uploaded successfully, skip and continue to next file if (System.currentTimeMillis() - lastUploadTime > 15000) lastUploadTime = System.currentTimeMillis(); if (row+1 == rowCount) // last row, make sure refresh happens lastUploadTime = 0; Thread uploadThread = new Thread(new UploadThread(row)); uploadThread.setPriority(Thread.MIN_PRIORITY); uploadThread.start(); uploadThread.join(15000); // wait 15 seconds for this thread to finish while (uploadThread.isAlive()) { // check to see if user has clicked on button // to cancel upload process if (uploadThread.isAlive() && cancelUpload == true) { uploadThread.interrupt(); uploadThread.join(); // wait until current upload finishes } else uploadThread.join(15000); // wait another 15 seconds for this thread to finish }//while // user clicked on button to cancel upload // stop upload process if (cancelUpload == true) break; Thread.yield(); // be nice }//for } catch (Exception e) { logger.log("Upload for loop exeception. " + e); } finally { clearCompletedButton.setEnabled(true); uploadButton.setEnabled(true); removeButton.setEnabled(true); }//try-catch-finally }//run }.start(); }//upload // changes the color of items for the row to indicate upload is complete // also disables the items for the row private void dimTableRow(int row) { JComponent c = (JComponent) table.getValueAt(row, UploadTableModel.SOURCE_COLUMN); c.setForeground(Color.GRAY); c.setEnabled(false); c = (JComponent) table.getValueAt(row, UploadTableModel.DESTINATION_COLUMN); c.setForeground(Color.GRAY); c.setEnabled(false); c = (JComponent) table.getValueAt(row, UploadTableModel.RESOURCE_COLUMN); c.setForeground(Color.GRAY); c.setEnabled(false); c = (JComponent) table.getValueAt(row, UploadTableModel.STATUS_COLUMN); c.setForeground(Color.GRAY); } public void focusGained(FocusEvent e) { } public void focusLost(FocusEvent e) { } // sets the background color of components in the selected row // also, sets the values for the detail panel when one row is selected class SelectionListener implements ListSelectionListener { JTable table; // It is necessary to keep the table since it is not possible // to determine the table from the event's source SelectionListener(JTable table) { this.table = table; this.table.setSelectionBackground(new MyColor()); } public void valueChanged(ListSelectionEvent e) { // If cell selection is enabled, both row and column change events are fired if (e.getSource() == table.getSelectionModel() && table.getRowSelectionAllowed()) { // first clear all background for (int i=0; i < table.getRowCount(); i++) { // change background color JTextField tf = (JTextField) table.getValueAt(i, UploadTableModel.SOURCE_COLUMN); tf.setBackground(Color.WHITE); tf = (JTextField) table.getValueAt(i, UploadTableModel.DESTINATION_COLUMN); tf.setBackground(Color.WHITE); }//for int[] rows = table.getSelectedRows(); for (int i=0; i < rows.length; i++) { // change background color JTextField tf = (JTextField) table.getValueAt(rows[i], UploadTableModel.SOURCE_COLUMN); tf.setBackground(new MyColor()); tf = (JTextField) table.getValueAt(rows[i], UploadTableModel.DESTINATION_COLUMN); tf.setBackground(new MyColor()); }//for // display detail of row selected, ONLY if one row selected if (rows.length == 1) { tfSource.setText(((JTextField) table.getValueAt(rows[0], UploadTableModel.SOURCE_COLUMN)).getText()); String destinationText = ((JTextField) table.getValueAt(rows[0], UploadTableModel.DESTINATION_COLUMN)).getText(); tfDestination.setText(destinationText); // TODO: find a better way File f = new File(tfSource.getText()); if (f.isFile()) { fileSizeLabel.setText(f.length() + " bytes"); } else { fileSizeLabel.setText(""); }//if-else try { URI uri = new URI(destinationText); userLabel.setText(uri.getUserInfo()); hostLabel.setText(uri.getHost()); portLabel.setText("" + uri.getPort()); } catch (URISyntaxException ex) { ex.printStackTrace(); } } else { tfSource.setText(""); tfDestination.setText(""); fileSizeLabel.setText(""); userLabel.setText(""); hostLabel.setText(""); portLabel.setText(""); } }//if if (e.getValueIsAdjusting()) { // The mouse button has not yet been released } }//valueChanged }//SelectionListener }//DragDropPanel php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JComboBoxEditor.java000066400000000000000000000071351221272161600273330ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JComboBoxEditor.java - edu.sdsc.grid.gui.applet.JComboBoxEditor // // CLASS HIERARCHY // java.lang.Object // | // +-.JComboBoxEditor // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.Component; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.EventObject; import javax.swing.JComboBox; import javax.swing.JTable; import javax.swing.event.CellEditorListener; import javax.swing.table.TableCellEditor; /** * * @author awu */ // TODO: Add listener for selection change // will need to update DB with new selection class JComboBoxEditor implements TableCellEditor, ActionListener { static AppletLogger logger = AppletLogger.getInstance(); public Component getTableCellEditorComponent ( JTable table, Object value, boolean isSelected, int row, int column ) { JComboBox box = (JComboBox) value; if (isSelected) box.setBackground(new MyColor()); // RGB of #c4d2e3; light blue) else box.setBackground(Color.WHITE); box.removeActionListener(this); box.addActionListener(this); return box; }//getTableCellEditorComponent public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String resource = (String)cb.getSelectedItem(); } public void removeCellEditorListener(CellEditorListener l) { } public void addCellEditorListener(CellEditorListener l) { } public void cancelCellEditing() { } public boolean stopCellEditing() { return true; } public boolean shouldSelectCell(EventObject anEvent) { return true; } public boolean isCellEditable(EventObject e) { return true; } public Object getCellEditorValue() { return null; } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JComboBoxRenderer.java000066400000000000000000000057011221272161600276500ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JComboBoxRenderer.java - edu.sdsc.grid.gui.applet.JComboBoxRenderer // // CLASS HIERARCHY // java.lang.Object // | // +-.JComboBoxRenderer // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.Component; import java.awt.Color; import java.awt.event.ActionEvent; import javax.swing.table.TableCellRenderer; import javax.swing.JComboBox; import javax.swing.JTable; class JComboBoxRenderer extends JComboBox implements TableCellRenderer { static AppletLogger logger = AppletLogger.getInstance(); private Color bgColor = new Color(196, 210, 227); // RGB of #c4d2e3; light blue JComboBoxRenderer () { super(); } public Component getTableCellRendererComponent ( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { JComboBox box = (JComboBox) value; if (isSelected) box.setBackground(new MyColor()); else box.setBackground(Color.WHITE); return box; }//getTableCellRendererComponent public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String resource = (String)cb.getSelectedItem(); } }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JTextFieldEditor.java000066400000000000000000000063341221272161600275130ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JTextFieldEditor.java - edu.sdsc.grid.gui.applet.JTextFieldEditor // // CLASS HIERARCHY // java.lang.Object // | // +-.JTextFieldEditor // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.Component; import java.awt.event.MouseEvent; import javax.swing.table.TableCellEditor; import javax.swing.JTextField; import javax.swing.JTable; import javax.swing.event.CellEditorListener; import java.util.EventObject; class JTextFieldEditor implements TableCellEditor { static AppletLogger logger = AppletLogger.getInstance(); public Component getTableCellEditorComponent ( JTable table, Object value, boolean isSelected, int row, int column ) { return (JTextField) value; } public void removeCellEditorListener(CellEditorListener l) { } public void addCellEditorListener(CellEditorListener l) { } public void cancelCellEditing() { } public boolean stopCellEditing() { return true; } public boolean shouldSelectCell(EventObject anEvent) { return true; } public boolean isCellEditable(EventObject e) { if (e instanceof MouseEvent) { MouseEvent mouseEvent = (MouseEvent) e; if (mouseEvent.getClickCount() > 1) return true; } return false; } public Object getCellEditorValue() { return null; } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JTextFieldListener.java000066400000000000000000000061411221272161600300460ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JTextFieldListener.java - edu.sdsc.grid.gui.applet.JTextFieldListener // // CLASS HIERARCHY // java.lang.Object // | // +-.JTextFieldListener // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.event.FocusListener; import java.awt.event.FocusEvent; import java.awt.Component; import javax.swing.JTextField; import javax.swing.JTable; import javax.swing.border.EtchedBorder; import javax.swing.border.EmptyBorder; class JTextFieldListener implements FocusListener { static AppletLogger logger = AppletLogger.getInstance(); private static EtchedBorder etchedBorder = new EtchedBorder(EtchedBorder.LOWERED); private static EmptyBorder emptyBorder = new EmptyBorder(0, 8, 0, 8); // top, left, bottom, right public void focusGained(FocusEvent e) { JTextField tf = (JTextField) e.getComponent(); tf.setBorder(etchedBorder); tf.selectAll(); }//focusGained public void focusLost(FocusEvent e) { JTextField tf = (JTextField) e.getComponent(); tf.setBorder(emptyBorder); Component c = (Component) tf.getParent(); // JTextField is not calling the JTextFieldEditor.removeCellEditor // calling this results in JTextFieldEditor.removeCellEditor being called if (c instanceof JTable) ((JTable) c).removeEditor(); }//focusLost } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JTextFieldMouseListener.java000066400000000000000000000045231221272161600310610ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JTextFieldMouseListener.java - edu.sdsc.grid.gui.applet.JTextFieldMouseListener // // CLASS HIERARCHY // java.lang.Object // | // +-.JTextFieldMouseListener // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; class JTextFieldMouseListener extends MouseAdapter { static AppletLogger logger = AppletLogger.getInstance(); public void mouseClicked(MouseEvent e) { // if not double click, don't pass on event if (e.getClickCount() < 2) e.consume(); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/JTextFieldRenderer.java000066400000000000000000000052041221272161600300260ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // JTextFieldRenderer.java - edu.sdsc.grid.gui.applet.JTextFieldRenderer // // CLASS HIERARCHY // java.lang.Object // | // +-.JTextFieldRenderer // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.Component; import java.awt.Font; import java.awt.FontMetrics; import javax.swing.table.TableCellRenderer; import javax.swing.JTextField; import javax.swing.JTable; class JTextFieldRenderer implements TableCellRenderer { public Component getTableCellRendererComponent ( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { JTextField tf = (JTextField) value; FontMetrics fm = tf.getFontMetrics(new Font("Default", Font.PLAIN, 11)); int offset = fm.stringWidth(tf.getText()); tf.setScrollOffset(offset); tf.setToolTipText(tf.getText()); return tf; } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/LogPanel.java000066400000000000000000000062771221272161600260510ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // LogPanel.java - edu.sdsc.grid.gui.applet.LogPanel // // CLASS HIERARCHY // java.lang.Object // | // +-.JPanel // | // +-.LogPanel // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JPanel; public class LogPanel extends JPanel { //private static LogPanel instance = null; private JTextArea textArea; public LogPanel() { init(); } /* public static LogPanel getInstance() { if(instance == null) instance = new LogPanel(); return instance; } */ /** * Creates a scrollable text area and add to this JPanel **/ public void init() { //static JTextArea textArea = new JTextArea(15, 48); // row, col textArea = new JTextArea(15, 50); // row, col textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEditable(false); //Create the scroll pane and add the textarea to it. JScrollPane textScrollPane = new JScrollPane(textArea); this.add(textScrollPane); }//init /** * Add a line of string to the text area **/ public void append(String s) { try { textArea.append(s); } catch (Exception e) { // may be null if panel is not set up yet // ignore exception } } }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/Manager.java000066400000000000000000000063411221272161600257120ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // Manager.java - edu.sdsc.grid.gui.applet.Manager // // CLASS HIERARCHY // java.lang.Object // | // +-.Manager // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.util.List; public class Manager implements AppletConstant { protected Manager() {} private static Manager instance; private static int appletCount; // how many applet instances are active // Logger static AppletLogger logger = AppletLogger.getInstance(); public static Manager getInstance() { if (instance == null) instance = new Manager(); return instance; } public static void registerApplet() { appletCount++; logger.log("applet count is now: " + appletCount); } public static void unregisterApplet() { if (appletCount > 0) // should never be negative appletCount--; logger.log("applet count is now: " + appletCount); } public static int getAppletCount() { return appletCount; } /* Log files methods */ public static List recoverQueue() { // if queue log differs from completed log, then // some files were not uploaded // once recovered, both log files should be cleared // AND the queue log be rewritten if (appletCount != 1) return null; AppletLogger logger = AppletLogger.getInstance(); return logger.recoverQueue(); } }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyButton.java000066400000000000000000000042761221272161600261260ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyButton.java - edu.sdsc.grid.gui.applet.MyButton // // CLASS HIERARCHY // java.lang.Object // | // +-.MyButton // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JButton; class MyButton extends JButton { MyButton() { super(); this.setBackground(new MyColor()); } MyButton(String text) { super(text); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyColor.java000066400000000000000000000041161221272161600257220ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyColor.java - edu.sdsc.grid.gui.applet.MyColor // // CLASS HIERARCHY // java.lang.Object // | // +-.MyColor // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.Color; class MyColor extends Color { MyColor() { super(196, 210, 227); // RGB of #c4d2e3; light blue); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyPanel.java000066400000000000000000000043371221272161600257100ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyPanel.java - edu.sdsc.grid.gui.applet.MyPanel // // CLASS HIERARCHY // java.lang.Object // | // +-.MyPanel // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JPanel; import java.awt.LayoutManager; class MyPanel extends JPanel { MyPanel() { super(); this.setBackground(new MyColor()); } MyPanel(LayoutManager layout) { super(layout); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyRadioButton.java000066400000000000000000000042501221272161600270750ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyRadioButton.java - edu.sdsc.grid.gui.applet.MyRadioButton // // CLASS HIERARCHY // java.lang.Object // | // +-.MyRadioButton // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JRadioButton; class MyRadioButton extends JRadioButton { MyRadioButton(String text, boolean selected) { super(text, selected); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyTabbedPane.java000066400000000000000000000041641221272161600266340ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyTabbedPane.java - edu.sdsc.grid.gui.applet.MyTabbedPane // // CLASS HIERARCHY // java.lang.Object // | // +-.MyTabbedPane // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JTabbedPane; class MyTabbedPane extends JTabbedPane { MyTabbedPane() { super(); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyTextArea.java000066400000000000000000000042351221272161600263630ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyTextArea.java - edu.sdsc.grid.gui.applet.MyTextArea // // CLASS HIERARCHY // java.lang.Object // | // +-.MyTextArea // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JTextArea; class MyTextArea extends JTextArea { MyTextArea (String text, int rows, int columns) { super(text, rows, columns); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/MyTextField.java000066400000000000000000000041571221272161600265410ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // MyTextField.java - edu.sdsc.grid.gui.applet.MyTextField // // CLASS HIERARCHY // java.lang.Object // | // +-.MyTextField // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.JTextField; class MyTextField extends JTextField { MyTextField() { super(); this.setBackground(new MyColor()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/OptionsPanel.java000066400000000000000000000125321221272161600267520ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // OptionsPanel.java - edu.sdsc.grid.gui.applet.OptionsPanel // // CLASS HIERARCHY // java.lang.Object // | // +-.JPanel // | // +-.OptionsPanel // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JLabel; import javax.swing.JCheckBox; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; class OptionsPanel extends MyPanel implements ActionListener { private MyRadioButton overwriteRadio; private MyRadioButton checksumRadio; private MyRadioButton fileSizeRadio; private JCheckBox checksumCheckBox; /* Upload options set by user */ public static boolean OVERWRITE_FORCED = true; // upload overwrites remote file; default behavior public static boolean OVERWRITE_IF_CHECKSUM; // overwrite if checksum is different public static boolean OVERWRITE_IF_FILE_SIZE; // overwrite if file size is different public static boolean VERIFY_UPLOAD_WITH_CHECKSUM; // verify upload with checksum comparison; default behavior private String STR_VERIFY_UPLOAD_WITH_CHECKSUM = "VERIFY_UPLOAD_WITH_CHECKSUM"; private String STR_RADIO_GROUP = "RADIO_GROUP"; OptionsPanel() { init(); } public void init() { // options panel MyPanel p = new MyPanel(); p.add(new JLabel("Overwrite Options")); this.add(p); overwriteRadio = new MyRadioButton("Forced overwrite", OVERWRITE_FORCED); checksumRadio = new MyRadioButton("Compare checksum", OVERWRITE_IF_CHECKSUM); fileSizeRadio = new MyRadioButton("Compare file size", OVERWRITE_IF_FILE_SIZE); // disable checksum and file size radio button for now checksumRadio.setEnabled(false); fileSizeRadio.setEnabled(false); overwriteRadio.setActionCommand(STR_RADIO_GROUP); checksumRadio.setActionCommand(STR_RADIO_GROUP); fileSizeRadio.setActionCommand(STR_RADIO_GROUP); overwriteRadio.addActionListener(this); checksumRadio.addActionListener(this); fileSizeRadio.addActionListener(this); ButtonGroup fileButtonGroup = new ButtonGroup(); fileButtonGroup.add(overwriteRadio); fileButtonGroup.add(checksumRadio); fileButtonGroup.add(fileSizeRadio); p = new MyPanel(); p.add(overwriteRadio); p.add(checksumRadio); p.add(fileSizeRadio); this.add(p); // Dir overwrite option selection /* ButtonGroup dirButtonGroup = new ButtonGroup(); JRadioButton dirOverwriteRadio = new JRadioButton("Forced overwrite", OVERWRITE_FORCED); dirButtonGroup.add(dirOverwriteRadio); */ /* p = new JPanel(); p.add(new JLabel("Directory Overwrite Options")); p.add(dirOverwriteRadio); this.add(p); */ /* p = new JPanel(); checksumCheckBox = new JCheckBox("Verify upload with checksum"); checksumCheckBox.setActionCommand(STR_VERIFY_UPLOAD_WITH_CHECKSUM); checksumCheckBox.addActionListener(this); p.add(checksumCheckBox); optionPanel.add(p); */ }//init private void updateUploadOption(Object obj) { if (obj.getClass() != new JRadioButton().getClass()) return; OVERWRITE_FORCED = overwriteRadio.isSelected(); OVERWRITE_IF_CHECKSUM = checksumRadio.isSelected(); OVERWRITE_IF_FILE_SIZE = fileSizeRadio.isSelected(); } public void actionPerformed(ActionEvent e) { updateUploadOption(e.getSource()); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/PasswordMapper.java000066400000000000000000000053611221272161600273100ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // PasswordMapper.java - edu.sdsc.grid.gui.applet.PasswordMapper // // CLASS HIERARCHY // java.lang.Object // | // +-.PasswordMapper // // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.util.Map; import java.util.HashMap; class PasswordMapper { private static Map map = new HashMap(); public static void setPassword(String ruri, char[] password) { map.put(parseRuri(ruri), password); } public static char[] getPassword(String ruri) { return (char[]) map.get(parseRuri(ruri)); } public static void removePassword(String ruri) { map.remove(ruri); } public static void clearMap() { map.clear(); } public static String parseRuri(String ruri) { // take out the destination and return the rest int i = ruri.indexOf("/", 8); // segment 'irods://' has eight characters return ruri.substring(0, i); } }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/ProgressBarRenderer.java000066400000000000000000000045501221272161600302600ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // ProgressBarRenderer.java - edu.sdsc.grid.gui.applet.ProgressBarRenderer // // CLASS HIERARCHY // java.lang.Object // | // +-.ProgressBarRenderer // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import javax.swing.table.TableCellRenderer; import java.awt.Component; import javax.swing.JProgressBar; import javax.swing.JTable; class ProgressBarRenderer implements TableCellRenderer { public Component getTableCellRendererComponent ( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column ) { return ( JProgressBar ) value; } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/SpringUtilities.java000066400000000000000000000243401221272161600274750ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // SpringUtilities.java - edu.sdsc.grid.gui.applet.SpringUtilities // // CLASS HIERARCHY // java.lang.Object // | // +-.SpringUtilities // // // PRINCIPAL AUTHOR // Code Reference at http://java.sun.com/docs/books/tutorial/uiswing/layout/spring.html // // package edu.sdsc.grid.gui.applet; import javax.swing.*; import javax.swing.SpringLayout; import java.awt.*; /** * A 1.4 file that provides utility methods for * creating form- or grid-style layouts with SpringLayout. * These utilities are used by several programs, such as * SpringBox and SpringCompactGrid. */ class SpringUtilities { // Logger static AppletLogger logger = AppletLogger.getInstance(); /** * A debugging utility that prints to stdout the component's * minimum, preferred, and maximum sizes. */ public static void printSizes(Component c) { /* System.out.println("minimumSize = " + c.getMinimumSize()); System.out.println("preferredSize = " + c.getPreferredSize()); System.out.println("maximumSize = " + c.getMaximumSize()); */ } /** * Aligns the first rows * cols * components of parent in * a grid. Each component is as big as the maximum * preferred width and height of the components. * The parent is made just big enough to fit them all. * * @param rows number of rows * @param cols number of columns * @param initialX x location to start the grid at * @param initialY y location to start the grid at * @param xPad x padding between cells * @param yPad y padding between cells */ public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } catch (ClassCastException exc) { //System.err.println("The first argument to makeGrid must use SpringLayout."); logger.log("The first argument to makeGrid must use SpringLayout." + exc); return; } Spring xPadSpring = Spring.constant(xPad); Spring yPadSpring = Spring.constant(yPad); Spring initialXSpring = Spring.constant(initialX); Spring initialYSpring = Spring.constant(initialY); int max = rows * cols; //Calculate Springs that are the max of the width/height so that all //cells have the same size. Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)). getWidth(); Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)). getWidth(); for (int i = 1; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints( parent.getComponent(i)); maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth()); maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight()); } //Apply the new width/height Spring. This forces all the //components to have the same size. for (int i = 0; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints( parent.getComponent(i)); cons.setWidth(maxWidthSpring); cons.setHeight(maxHeightSpring); } //Then adjust the x/y constraints of all the cells so that they //are aligned in a grid. SpringLayout.Constraints lastCons = null; SpringLayout.Constraints lastRowCons = null; for (int i = 0; i < max; i++) { SpringLayout.Constraints cons = layout.getConstraints( parent.getComponent(i)); if (i % cols == 0) { //start of new row lastRowCons = lastCons; cons.setX(initialXSpring); } else { //x position depends on previous component cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST), xPadSpring)); } if (i / cols == 0) { //first row cons.setY(initialYSpring); } else { //y position depends on previous row cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH), yPadSpring)); } lastCons = cons; } //Set the parent's size. SpringLayout.Constraints pCons = layout.getConstraints(parent); pCons.setConstraint(SpringLayout.SOUTH, Spring.sum( Spring.constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH))); pCons.setConstraint(SpringLayout.EAST, Spring.sum( Spring.constant(xPad), lastCons.getConstraint(SpringLayout.EAST))); } /* Used by makeCompactGrid. */ private static SpringLayout.Constraints getConstraintsForCell( int row, int col, Container parent, int cols) { SpringLayout layout = (SpringLayout) parent.getLayout(); Component c = parent.getComponent(row * cols + col); return layout.getConstraints(c); } /** * Aligns the first rows * cols * components of parent in * a grid. Each component in a column is as wide as the maximum * preferred width of the components in that column; * height is similarly determined for each row. * The parent is made just big enough to fit them all. * * @param rows number of rows * @param cols number of columns * @param initialX x location to start the grid at * @param initialY y location to start the grid at * @param xPad x padding between cells * @param yPad y padding between cells */ public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } catch (ClassCastException exc) { //System.err.println("The first argument to makeCompactGrid must use SpringLayout."); logger.log("The first argument to makeCompactGrid must use SpringLayout." + exc); return; } //Align all cells in each column and make them the same width. Spring x = Spring.constant(initialX); for (int c = 0; c < cols; c++) { Spring width = Spring.constant(0); for (int r = 0; r < rows; r++) { width = Spring.max(width, getConstraintsForCell(r, c, parent, cols). getWidth()); } for (int r = 0; r < rows; r++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setX(x); constraints.setWidth(width); } x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad))); } //Align all cells in each row and make them the same height. Spring y = Spring.constant(initialY); for (int r = 0; r < rows; r++) { Spring height = Spring.constant(0); for (int c = 0; c < cols; c++) { height = Spring.max(height, getConstraintsForCell(r, c, parent, cols). getHeight()); } for (int c = 0; c < cols; c++) { SpringLayout.Constraints constraints = getConstraintsForCell(r, c, parent, cols); constraints.setY(y); constraints.setHeight(height); } y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad))); } //Set the parent's size. SpringLayout.Constraints pCons = layout.getConstraints(parent); pCons.setConstraint(SpringLayout.SOUTH, y); pCons.setConstraint(SpringLayout.EAST, x); } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/UploadApplet.java000066400000000000000000000363731221272161600267420ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // UploadApplet.java - edu.sdsc.grid.gui.applet.UploadApplet // // CLASS HIERARCHY // java.lang.Object // | // +-.JApplet // | // +-.UploadApplet // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.io.IOException; import java.io.File; import java.util.List; import java.util.ArrayList; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.MalformedURLException; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JCheckBox; import javax.swing.JRadioButton; import javax.swing.JTextArea; import javax.swing.JFrame; import java.awt.Dimension; import java.awt.Container; import java.awt.BorderLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import com.sun.java.browser.dom.*; import javax.swing.JComboBox; import javax.swing.JTextField; import javax.swing.ToolTipManager; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.SwingUtilities; import org.w3c.dom.*; import org.w3c.dom.css.*; import org.w3c.dom.events.*; import org.w3c.dom.html.*; import org.w3c.dom.stylesheets.*; import org.w3c.dom.views.*; import edu.sdsc.grid.io.GeneralFile; import edu.sdsc.grid.io.FileFactory; /** * Main Applet window. Creates and adds other JPanels to the main Container. * **/ public class UploadApplet extends JApplet implements ActionListener { static String USER_HOME = System.getProperty("user.home"); static String FILE_SEPARATOR = System.getProperty("file.separator"); static String IRODS_DIR = USER_HOME + FILE_SEPARATOR + ".irods"; static String UPLOADED_LOG = IRODS_DIR + FILE_SEPARATOR + "uploaded.txt"; static String QUEUE_LOG = IRODS_DIR + FILE_SEPARATOR + "queue.txt"; static String APPLET_LOG = IRODS_DIR + FILE_SEPARATOR + "log.txt"; static String ACTIVE_APPLETS_LOG = IRODS_DIR + FILE_SEPARATOR + "active_applets.txt"; static String INACTIVE_APPLETS_LOG = IRODS_DIR + FILE_SEPARATOR + "inactive_applets.txt"; static String RECOVERY_LOCK_DIR = IRODS_DIR + FILE_SEPARATOR + ".lock" + FILE_SEPARATOR; static String PROMPTED_FILE = IRODS_DIR + FILE_SEPARATOR + ".prompted"; private Container content; private UploadTableModel model; private JButton removeButton; private JButton uploadButton; private JRadioButton overwriteRadio; private JRadioButton checksumRadio; private JRadioButton fileSizeRadio; private JCheckBox checksumCheckBox; // log console public static JTextArea textArea; /* Upload options set by user */ private boolean OVERWRITE_FORCED = true; // upload overwrites remote file; default behavior private boolean OVERWRITE_IF_CHECKSUM; // overwrite if checksum is different private boolean OVERWRITE_IF_FILE_SIZE; // overwrite if file size is different private boolean VERIFY_UPLOAD_WITH_CHECKSUM; // verify upload with checksum comparison; default behavior private String STR_VERIFY_UPLOAD_WITH_CHECKSUM = "VERIFY_UPLOAD_WITH_CHECKSUM"; private String STR_RADIO_GROUP = "RADIO_GROUP"; private String STR_REMOVE = "REMOVE"; private String STR_UPLOAD = "UPLOAD"; private String STR_REMOVE_TOOLTIP = "Remove selected files from list"; private String STR_UPLOAD_TOOLTIP = "Start upload"; // Logger static AppletLogger logger = AppletLogger.getInstance(); DragDropPanel dragDropPanel; OptionsPanel optionsPanel; private long id; // applet id for logging purpose private URI uri; /** * Initiation method. * Reads in parameters sent to the applet. * Try and set native look and feel. * Creates and add panels to the main Container. * Add listener for tab focus change event. * **/ public void init() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(this); } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundException e) { // handle exception } catch (InstantiationException e) { // handle exception } catch (IllegalAccessException e) { // handle exception } // prompt user for permission to create iRODS directory and log files in the user's home directory // // 1. check if /.prompted file exists // 2. if yes, create applet panels // 3. if no, prompt user for permission // 3.a. if user says no, stay on permission screen with a message // 3.b. if user says yes // - create /.prompted file // - create applet panels // File promptedFile = new File(PROMPTED_FILE); if (promptedFile.exists()) { createDisplay(); // set the behavior for tool tips ToolTipManager toolTipManager = ToolTipManager.sharedInstance(); toolTipManager.setDismissDelay(60000); // show tip for 1 minute toolTipManager.setInitialDelay(0); // show tip immediately } else { showPrompt(); } }//init private void showPrompt() { JPanel panel = new JPanel(new BorderLayout()); MyTextArea ta = new MyTextArea("This applet requires some files to be written to your home directory. " + "These files are used for logging and recovery, and can be viewed by a text editor. " + "To use this applet, you must click Allow.", 4, 15); ta.setLineWrap(true); ta.setWrapStyleWord(true); MyButton allowButton = new MyButton("Allow"); MyButton denyButton = new MyButton("Deny"); allowButton.setActionCommand("Allow"); denyButton.setActionCommand("Deny"); allowButton.addActionListener(this); denyButton.addActionListener(this); MyPanel buttonPanel = new MyPanel(); buttonPanel.add(allowButton); buttonPanel.add(denyButton); panel.add(ta, BorderLayout.CENTER); panel.add(buttonPanel, BorderLayout.PAGE_END); content = getContentPane(); content.setBackground(new MyColor()); content.setLayout(new BorderLayout()); content.setSize(new Dimension(200, 100)); content.add(panel); }//showPrompt public void actionPerformed(ActionEvent e) { String action = e.getActionCommand().toUpperCase(); if (action.equals("ALLOW")) { //clear components and add table content.removeAll(); createDisplay(); try { File promptedFile = new File(PROMPTED_FILE); promptedFile.createNewFile(); } catch (IOException ex) { ex.printStackTrace(); }//try-catch } else if (action.equals("DENY")) { // do nothing }//if-else }//actionPerformed private void createDisplay() { // Get the base web host url which will be used to get the temporary password String documentBase = getDocumentBase().toString(); // attempt parsing of document base to construct where temporary password service is String TEMP_PASSWORD_SERVICE_URL = null; try { URL url = new URL(documentBase); TEMP_PASSWORD_SERVICE_URL = url.getProtocol() + "://" + url.getHost(); if (url.getPort() != -1) TEMP_PASSWORD_SERVICE_URL += ":" + url.getPort(); // Split the url path // then catenate all except the last one, which will be a file reference // the result is a folder where the service/getTempPassword.php file is located String urlPath = url.getPath(); String[] p = urlPath.split("/"); urlPath = ""; for (int i = 0; i < p.length -1; i++) { if (i == 0) urlPath = p[i]; else urlPath += "/" + p[i]; } TEMP_PASSWORD_SERVICE_URL += urlPath + "/services/getTempPassword.php"; // maybe put the string literal outside of class file } catch (MalformedURLException me) { logger.log("Problem while getting URL parts. " + me); me.printStackTrace(); } // Sample URI_PARAM = irods://user:pass@host:port/destination String ruri = getParameter("ruri"); // passed to applet in html code String sessionId = getParameter("ssid"); // web session id passed to applet in html code if (ruri == null || ruri.trim().equals("")) { // TODO what to do? }//if //TODO try { uri = new java.net.URI( ruri ); } catch( java.net.URISyntaxException e ) { } // go ahead and set the account instance, even if values are null // will prompt for user input at end of init method Account account = null; try { account = new Account(TEMP_PASSWORD_SERVICE_URL, uri, sessionId); } catch (IOException e) { //TODO do something... throw new RuntimeException("IO failure"); } // create GUI content = getContentPane(); content.setBackground(new MyColor()); content.setLayout(new BorderLayout()); content.setSize(new Dimension(300, 400)); model = new UploadTableModel(); dragDropPanel = new DragDropPanel(this, model, account); optionsPanel = new OptionsPanel(); MyTabbedPane tabbedPane = new MyTabbedPane(); tabbedPane.add("File Upload Table", dragDropPanel); // DragDrop Panel tabbedPane.add("Options", optionsPanel); // UploadOptions Panel content.add(tabbedPane); tabbedPane.updateUI(); /** * Compare queue and uploaded log files to determine if any files were not uploaded from last session. * 1. Check if both log files exist * 2. Compare the two files * 3. If content matches, then clear content of both files * 4. Else, determine which files need to be added to the table for uploading * **/ List queueList = DBUtil.getInstance().getUnassigned(); if (queueList != null) { model.addFile(queueList); } // set queueList to assigned DBUtil.getInstance().setAssigned(queueList); }//createDisplay long getId() { return id; } public void start() { } public void stop() { } public void destroy() { DBUtil.getInstance().removeUploaded(); int rowCount = model.getRowCount(); /* List itemList = new ArrayList(); for (int k = 0; k < rowCount; k++) { String s = ((JTextField) model.getValueAt(k, UploadTableModel.SOURCE_COLUMN)).getText(); String d = ((JTextField) model.getValueAt(k, UploadTableModel.DESTINATION_COLUMN)).getText(); String resource = (String) ((JComboBox) model.getValueAt(k, UploadTableModel.RESOURCE_COLUMN)).getSelectedItem(); //TODO Shouldn't need to login again just to remove a file from the database... try { UploadItem item = new UploadItem(FileFactory.newFile(new URI(s)), FileFactory.newFile(new URI(d)), resource); itemList.add(item); } catch (IOException e) { //TODO ? RuntimeException x = new RuntimeException(); x.initCause(e); } catch (URISyntaxException e) { //TODO ? RuntimeException x = new RuntimeException(); x.initCause(e); } } DBUtil.getInstance().updateAssigned(itemList, false); */ DBServer.shutdown(); }//destroy /** * Update the upload options as true/false. * OVERWRITE_FORCED = if true, upload will overwrite file on remote server * OVERWRITE_IF_CHECKSUM = if true, upload will overwrite file on remote server if the local and remote file checksum do NOT match * OVERWRITE_IF_FILE_SIZE = if true, upload will overwrite file on remote server if the local and remote file size do NOT match * **/ private void updateUploadOption(Object obj) { if (obj.getClass() != new JRadioButton().getClass()) return; OVERWRITE_FORCED = overwriteRadio.isSelected(); OVERWRITE_IF_CHECKSUM = checksumRadio.isSelected(); OVERWRITE_IF_FILE_SIZE = fileSizeRadio.isSelected(); } URI getRuri() { return uri; } void setRuri( URI uri ) { this.uri = uri; } /* public static void main(String[] args) { //Testing JApplet uploadApplet = new UploadApplet(); uploadApplet.init(); uploadApplet.start(); JFrame window = new JFrame("DataGrid UploadApplet"); window.setContentPane(uploadApplet); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.pack(); // Arrange the components. //System.out.println(theApplet.getSize()); window.setVisible(true); // Make the window visible. } */ }//UploadApplet php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/UploadItem.java000066400000000000000000000144521221272161600264050ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // UploadItem.java - edu.sdsc.grid.gui.applet.UploadItem // // CLASS HIERARCHY // java.lang.Object // | // +-.UploadItem // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.io.File; import java.io.IOException; import edu.sdsc.grid.io.FileFactory; import edu.sdsc.grid.io.GeneralFile; //TODO temp? import edu.sdsc.grid.io.RemoteFile; import edu.sdsc.grid.io.RemoteFileSystem; class UploadItem { /* Begin static variables */ static String STATUS_QUEUED = "queued"; static String STATUS_UPLOADED = "uploaded"; static String STATUS_IN_PROGRESS = "in progress"; static String STATUS_REQUIRES_AUTHENTICATION = "requires authentication"; static String STATUS_SERVER_UNAVAILABLE = "server unavailable"; static String STATUS_FAILED = "failed"; static String TYPE_FILE = "File"; static String TYPE_FOLDER = "Folder"; static String IN_PROGRESS_STATUS = "In Progress"; static String DONE_STATUS = "Done"; static String FAILED_STATUS = "Failed"; /* End static variables */ private GeneralFile source, destination; private String selectedResource; /** * type has value FILE or FOLDER */ private String type; /** * queued, uploaded, in progress, requires authentication, * server unavailable, failed */ private String status = STATUS_QUEUED; private boolean assigned = false; private List resourceList; static AppletLogger logger = AppletLogger.getInstance(); UploadItem(String s, String d, String resource) throws IOException, URISyntaxException { this.source = FileFactory.newFile(new URI(s)); //TODO only needed for DB, won't connect without password. this.destination = FileFactory.newFile(new URI(d)); if (resource == null) this.selectedResource = Account.defaultResource; else this.selectedResource = resource; resourceList = DBUtil.getInstance().getResourceList( ((RemoteFileSystem)destination.getFileSystem()).getHost(), ((RemoteFileSystem)destination.getFileSystem()).getPort()); // find out if this is a file or folder if (source.exists()) { if (source.isFile()) type = TYPE_FILE; else type = TYPE_FOLDER; } // else // TODO: Handle case when file no longer exists } UploadItem(GeneralFile source, GeneralFile destination, String resource) throws IOException { this.source = source; this.destination = destination; if (resource == null) this.selectedResource = Account.defaultResource; else this.selectedResource = resource; resourceList = DBUtil.getInstance().getResourceList( ((RemoteFileSystem)destination.getFileSystem()).getHost(), ((RemoteFileSystem)destination.getFileSystem()).getPort()); // find out if this is a file or folder if (source.exists()) { if (source.isFile()) type = TYPE_FILE; else type = TYPE_FOLDER; } // else // TODO: Handle case when file no longer exists }//UploadItem UploadItem(GeneralFile source, GeneralFile destination, List resourceList) { this.source = source; this.destination = destination; this.resourceList = resourceList; if (resourceList != null && resourceList.size() > 0) this.selectedResource = (String) resourceList.get(0); else this.selectedResource = Account.defaultResource; // should never come here // find out if this is a file or folder if (source.exists()) { if (source.isFile()) type = TYPE_FILE; else type = TYPE_FOLDER; } // else // TODO: Handle case when file no longer exists }//UploadItem public String getSource() { return source.toString(); } public String getDestination() { return destination.toString(); } public GeneralFile getSourceFile() { return source; } public GeneralFile getDestinationFile() { return destination; } public GeneralFile getDestinationParent() { // returns the parent folder of the upload item return destination.getParentFile(); } public String getSelectedResource() { return selectedResource; } public List getResourceList() { return resourceList; } public String getType() { return type; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public boolean isAssigned() { return assigned; } public void setAssigned(boolean assigned) { this.assigned = assigned; } } php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/UploadProgressThread.java000066400000000000000000000063041221272161600304400ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // UploadProgressThread.java - edu.sdsc.grid.gui.applet.UploadProgressThread // // CLASS HIERARCHY // java.lang.Object // | // +-.Thread // | // +-.UploadProgressThread // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import edu.sdsc.grid.io.GeneralFile; import javax.swing.JProgressBar; import javax.swing.JTable; import java.io.File; class UploadProgressThread extends Thread { GeneralFile remoteFile; JProgressBar progressBar; JTable table; int row; long fileSize; boolean complete = false; UploadProgressThread(File localFile, GeneralFile remoteFile, JProgressBar progressBar, JTable table, int row) { this.fileSize = localFile.length(); this.remoteFile = remoteFile; this.progressBar = progressBar; this.table = table; this.row = row; this.start(); } public void run() { try { long bytesTransferred = 0; int percentage = 0; while (!complete) { //bytesTransferred = remoteFile.fileCopyStatus(); bytesTransferred = 0; percentage = (int) (((float) bytesTransferred) / ((float) fileSize) * 100); progressBar.setValue(percentage); this.sleep(3000); } } catch (InterruptedException ie) { System.out.println("thread interrupted. " + ie); } }//run }php-irods-3.3.0~beta1/web/applets/edu/sdsc/grid/gui/applet/UploadTableModel.java000066400000000000000000000172371221272161600275230ustar00rootroot00000000000000// Copyright (c) 2005, Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of the University of California, San Diego (UCSD) nor // the names of its contributors may be used to endorse or promote products // derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // // FILE // UploadTableModel.java - edu.sdsc.grid.gui.applet.UploadTableModel // // CLASS HIERARCHY // java.lang.Object // | // +-.DefaultTableModel // | // +-.UploadTableModel // // PRINCIPAL AUTHOR // Alex Wu, SDSC/UCSD // // package edu.sdsc.grid.gui.applet; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.util.List; import java.util.ArrayList; import javax.swing.table.DefaultTableModel; import javax.swing.ImageIcon; import javax.swing.JProgressBar; import javax.swing.Icon; import javax.swing.JComboBox; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; class UploadTableModel extends DefaultTableModel { /* Column index for table */ static int ICON_COLUMN = 0; static int SOURCE_COLUMN = 1; static int DESTINATION_COLUMN = 2; static int RESOURCE_COLUMN = 3; static int STATUS_COLUMN = 4; private int directoryFileCount; //private int currentRow; // row just added private static String fileIconPath = "/image/file.png"; private static String folderIconPath = "/image/folder.png"; private ImageIcon fileIcon; private ImageIcon folderIcon; // Logger static AppletLogger logger = AppletLogger.getInstance(); UploadTableModel() { this.addColumn("");// empty for file/folder icon this.addColumn("Source"); // local file or folder this.addColumn("Destination"); // local file or folder this.addColumn("Resource"); // local file or folder this.addColumn("Status"); // Progress bar try { fileIcon = new ImageIcon(this.getClass().getResource(fileIconPath)); folderIcon = new ImageIcon(this.getClass().getResource(folderIconPath)); } catch (Exception e) { logger.log("file icon exception. " + e); }//try-catch }//UpdateTableModel public boolean isCellEditable(int row, int col) { if (col == SOURCE_COLUMN || col == DESTINATION_COLUMN || col == RESOURCE_COLUMN) return true; return false; }//isCellEditable // implement function below to display Checkbox public Class getColumnClass(int c) { Object obj = getValueAt(0, c); if (obj == null){ return new Object().getClass(); }else if (c == ICON_COLUMN) { // folder or file icon enclosed in JLabel return Icon.class; } else if (c == STATUS_COLUMN) { return JProgressBar.class; } else if (c == SOURCE_COLUMN) { return JTextField.class; } else if (c == DESTINATION_COLUMN) { return JTextField.class; } else if (c == RESOURCE_COLUMN) { return JComboBox.class; } else { return this.getValueAt(0, c).getClass(); } }//getColumnClass // param: List fileList is a List of UploadItem objects public void addFile(List fileList) { int rowCount = this.getRowCount(); UploadItem item = null; for (int k=0; k= 0; k--) { String source = ((JTextField) this.getValueAt(selectedRows[k], SOURCE_COLUMN)).getText(); String destination = ((JTextField) this.getValueAt(selectedRows[k], DESTINATION_COLUMN)).getText(); String resource = (String) ((JComboBox) this.getValueAt(selectedRows[k], RESOURCE_COLUMN)).getSelectedItem(); UploadItem item = new UploadItem(source, destination, resource); itemList.add(item); this.removeRow(selectedRows[k]); }//for } catch (IOException e) { logger.log("file grid exception. " + e); } catch (URISyntaxException e) { logger.log("file name/uri exception. " + e); } DBUtil.getInstance().delete(itemList); }//removeFile private JTextFieldListener tfListener = new JTextFieldListener(); private JTextFieldMouseListener tfMouseListener = new JTextFieldMouseListener(); private void addToTable(UploadItem item) { JTextField tfSource = new JTextField(item.getSource()); JTextField tfDestination = new JTextField(item.getDestination()); JComboBox comboBox = new JComboBox(item.getResourceList().toArray()); comboBox.setSelectedItem(item.getSelectedResource()); tfSource.addFocusListener(tfListener); tfDestination.addFocusListener(tfListener); tfSource.setBorder(new EmptyBorder(0, 8, 0, 8)); tfDestination.setBorder(new EmptyBorder(0, 8, 0, 8)); tfSource.setDragEnabled(false); tfDestination.setDragEnabled(false); ImageIcon icon = null; if (item.getType().equals(UploadItem.TYPE_FILE)) icon = fileIcon; else icon = folderIcon; this.addRow(new Object[] { icon, tfSource, tfDestination, comboBox, null}); }//addToTable private void calculateFileCount(File file, int row, String folderName) { // recursive function to calculate total file count // includes subfolders File[] fileList = file.listFiles(); int len = fileList.length; for (int i=0; i < len; i++) { if (fileList[i].isFile()) { directoryFileCount++; } else if (fileList[i].isDirectory()) { calculateFileCount(fileList[i], row, folderName); // recurse } }//for }//calculateFileCount }//UploadTableModel php-irods-3.3.0~beta1/web/applets/image/000077500000000000000000000000001221272161600200445ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/applets/image/file.png000066400000000000000000000011731221272161600214730ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< IDATÁ¿¯žsàëþ>Ï{ÚÓSG•ˆ3ñ;1Ј„….“Åbc#61Ùl’ŽIÿ£AKD"$‚X$ ÚTDÏyÏóÜ×UI¼ðÞ¥×w÷O¼6Ê9œDBŠ´¥û×›×óYý}ãËÎo*‰—>øòò'o{tŒ:& ¸öﱋßÜôÇoGÿýôÃÏg¿¸pþfS=¼3Og~¼jUiÖ´e‰[Ç«ç¼ÍÓ;îk§ÒÜxîÍOïøü£—TÕé$ÓÎ4ls1 ¦¢Š¡ÐöwœêÀ}œØ÷÷>†¡``£Ê¨2ªŒ*c*¿ÿu˽§=v¶¼ñ̦Íô*Ì óD)©ÒkežØÉðËõØö¢{ëÙûO¨y,0CB0×Ô(…4™;Œ.Ý“Ô3*J ‚4› PC­%# 0C/$4 IÀè2O!Eˆ²6k3tGB€¥T˜“Ö%`†µYCšÐam‚)6Ó°l0C/щ÷¿Û*ÑER4©€„\¼gãø¨Á ˲ZWö7ž¼{è°†µè$$|u‘ŽãÃ̰u/ÝÙ®ê«+«®ˆJtÈ(£Ë/g,">"); //replace > with > return(strInput); } function renderName(value, p, record){ if (record.data['type']==0) return String.format( '{0}', value); else if (record.data['type']==1) return String.format( '{0}', value); else return value; } function renderFmtSize(value,p,record){ if ( (!value)||(value<0) ) return ''; var rawSize=value; if (rawSize / 1099511627776 > 1) return Math.round(rawSize*100/1099511627776)/100 + ' TB'; else if (rawSize / 1073741824 > 1) return Math.round(rawSize*100/1073741824)/100 + ' GB'; else if (rawSize / 1048576 > 1) return Math.round(rawSize*100/1048576)/100 + ' MB'; else if (rawSize / 1024 > 1) return Math.round(rawSize*100/1024)/100 + ' KB'; else return rawSize + ' B '; } function renderTime(value){ try { return value.dateFormat('F j, Y, g:i a'); } catch (e) { return 'Invalid Time'; } } function jsonErrorResponseHandler(conn, r, options) { try { var response = Ext.util.JSON.decode(r.responseText); if (response && response.success == false) { Ext.Msg.alert("Error", response.errmsg); } } catch (e) { alert("Invalid server response:"+r.responseText+'
Exception:'+e); } } function generalRODSHttpRequestHandler(options,success,response) { if (options.first_calback) options.first_calback(); if (success!=true) { alert("HTTP error ("+response.status+"): "+response.statusText); } else { try { var response = Ext.util.JSON.decode(response.responseText); } catch (e) { alert("Invalid server response:"+response.responseText+'
Exception:'+e); return; } if (response && response.success == false) { Ext.Msg.alert("Error "+response.errcode+" :", response.errmsg); } else { if (options.success_calback) { Ext.callback(options.success_calback, options.scope); } } } } function RODSResourceBox() { return { init: function(init_ruri) { this.resources = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/serverQuery.php?action=resources' }), // create reader that reads the Topic records reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount', id: 'id' }, [ {name: 'id', mapping: 'id'}, {name: 'name', mapping: 'name'}, {name: 'type', mapping: 'type'}, {name: 'zone', mapping: 'zone'}, {name: 'class', mapping: 'class'}, {name: 'loc', mapping: 'loc'}, {name: 'info', mapping: 'info'}, {name: 'comment', mapping: 'comment'}, {name: 'vault_path', mapping: 'vault_path'}, {name: 'free_space', mapping: 'free_space'}, {name: 'ctime', mapping: 'ctime', type: 'date', dateFormat: 'timestamp'}, {name: 'mtime', mapping: 'mtime', type: 'date', dateFormat: 'timestamp'} ]), // turn off remote sorting remoteSort: false }); this.ruri=init_ruri.substring(0,init_ruri.indexOf('/')); this.resources.on('beforeload', function() { this.resources.baseParams = {'ruri': this.ruri}; }, this); this.resources.proxy.getConnection(). on('requestcomplete', jsonErrorResponseHandler); this.box = new Ext.form.ComboBox({ fieldLabel: 'Resource', store: this.resources, displayField:'name', valueFiled: 'name', emptyText:'Select a Resource...', selectOnFocus:true, allowBlank:false, hiddenName: 'resource', triggerAction: 'all', forceSelection:true }); this.box.store.on("load",function(store){ this.clearValue(); this.setValue(store.getAt(0).data.name); },this.box); this.box.store.load(); }, //end of function init // update RURI, and reload, if needed. updateRURI: function (new_ruri) { var newacct=new_ruri.substring(0,new_ruri.indexOf('/')); if (this.ruri!=newacct) // if acct has changed { this.ruri=newacct; this.resources.load(); } } } } function RODSFileSearchDialog() { var adv_search_dlg, file_viewer, adv_search_form, adv_search_flds, result_dlg, gridpanel, grid, grid_view, ds, num_newrows, ruri, descendantOnly, partial_name, metaname_store; function jsonErrorResponseHandler(conn, r, options) { try { var response = Ext.util.JSON.decode(r.responseText); if (response && response.success == false) { Ext.Msg.alert("Error", response.errmsg); } } catch (e) { alert("Invalid server response:"+r.responseText+'
Exception:'+e); } } return { init : function(adv_search_dlg_container, result_dlg_container, result_grid_container, file_viewer) { this.file_viewer=file_viewer; this.descendantOnly=false; // the column model has information about grid columns // dataIndex maps the column to the specific data field in // the data store (created below) var cm = new Ext.grid.ColumnModel([{ id: "dir_grid_col_name", header: "Name", dataIndex: 'name', width: 100, renderer: renderName, //renderer: renderTopic, //locked: true, //lock the column css: 'white-space:normal;' },{ header: "Collection", dataIndex: 'dirname', width: 400, align: 'left' },{ header: "Owner", dataIndex: 'owner', width: 100, hidden: true },{ header: "Resource", dataIndex: 'rescname', width: 100, hidden: false },{ header: "Type", dataIndex: 'typename', width: 100, hidden: true },{ header: "Size", dataIndex: 'size', width: 50, renderer: renderFmtSize, align: 'right' },{ header: "Date Created", dataIndex: 'ctime', width: 150, renderer: renderTime, align: 'right', hidden: true },{ header: "Date Modified", dataIndex: 'mtime', width: 200, renderer: renderTime, align: 'right' }]); // by default columns are sortable cm.defaultSortable = true; // create the Data Store this.ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/search.php' }), // create reader that reads the Topic records reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount' }, [ {name: 'name', mapping: 'name'}, {name: 'dirname', mapping: 'dirname'}, {name: 'ruri', mapping: 'ruri'}, {name: 'owner', mapping: 'owner'}, {name: 'rescname', mapping: 'rescname'}, {name: 'size', mapping: 'size', type: 'int'}, {name: 'fmtsize', mapping: 'fmtsize'}, {name: 'type', mapping: 'type'}, {name: 'typename', mapping: 'typename'}, {name: 'ctime', mapping: 'ctime', type: 'date', dateFormat: 'timestamp'}, {name: 'mtime', mapping: 'mtime', type: 'date', dateFormat: 'timestamp'} ]), // turn on remote sorting remoteSort: true }); this.ds.setDefaultSort('name', 'desc'); this.ds.proxy.getConnection().on('requestcomplete', jsonErrorResponseHandler); // create the search result grid this.grid = new Ext.grid.Grid(result_grid_container, { ds: this.ds, cm: cm, selModel: new Ext.grid.RowSelectionModel({singleSelect:true}), enableColLock:false, autoWidth:true, autoExpandColumn:'dir_grid_col_name' }); this.grid.addListener("rowdblclick",function (grid, rowIndex, e) { var sm = grid.getSelectionModel(); var record = sm.getSelected(); this.file_viewer.view(record, e.getTarget()); },this); // render it this.grid.render(); // configure footer paging bar var gridFoot = this.grid.getView().getFooterPanel(true); // add a paging toolbar to the grid's footer var paging = new Ext.PagingToolbar(gridFoot, this.ds, { pageSize: 100, displayInfo: true, displayMsg: 'Displaying Files {0} - {1} of {2}', emptyMsg: "No file found" }); this.gridpanel = new Ext.GridPanel(this.grid, {autoCreate: true, fitToFrame: true, autoScroll: true, title: 'Search Results'} ); this.result_dlg= new Ext.LayoutDialog(result_dlg_container, { width:800, height:600, shadow:true, minButtonWidth:10, minWidth:300, minHeight:300, proxyDrag: true, modal: true, center: { autoScroll:true, //tabPosition: 'top', closeOnTab: true, alwaysShowTabs: false, titlebar: false } }); var layout = this.result_dlg.getLayout(); layout.beginUpdate(); layout.add("center", this.gridpanel); layout.endUpdate(); this.result_dlg.addKeyListener(27, this.result_dlg.hide, this.result_dlg); // ESC can also close the dialog this.adv_search_form=new Ext.form.Form(); this.adv_search_flds={}; this.adv_search_flds['name']=new Ext.form.TextField({ width:400, name: 'name', fieldLabel: 'Name', emptyText: 'Name or Partial Name, case sensitive' }); this.adv_search_flds['mtime_since_now']=new Ext.form.ComboBox({ width:200, name: 'mtime_since_now', fieldLabel: 'Modified Within', emptyText: 'Any Time', forceSelection:true, store: new Ext.data.SimpleStore({ fields: ['name', 'val'], data : [ ['24 hours', 24*3600], ['7 days', 7*24*3600], ['30 days', 30*24*3600], ['3 month', 3*30*24*3600], ['6 month', 6*30*24*3600], ['One Year', 365*24*3600] ] }), displayField: 'name', valueField: 'val', mode: 'local', triggerAction: 'all', editable: false }); this.adv_search_flds['owner']=new Ext.form.TextField({ width:200, name: 'owner', fieldLabel: 'Owner', emptyText: 'Owner of the file' }); this.adv_search_flds['rsrc']=new Ext.form.TextField({ width:200, name: 'rsrc', fieldLabel: 'Resource', emptyText: 'Resource of the file' }); this.adv_search_flds['descendentOnly']= new Ext.form.Checkbox ({ fieldLabel: 'Only', checked: false, boxLabel: 'Under Current Collection'}); this.adv_search_flds['cwd']= new Ext.form.TextField({ width:400, name: 'cwd', fieldLabel: 'Current Collection', disabled: true }); this.adv_search_form.fieldset( {legend:'Attributes', labelWidth:120}, this.adv_search_flds['name'], this.adv_search_flds['mtime_since_now'], this.adv_search_flds['owner'], this.adv_search_flds['rsrc'], this.adv_search_flds['descendentOnly'], this.adv_search_flds['cwd'] ); //Create meta data fields this.metaname_store= new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/serverQuery.php' }), // create reader that reads the Topic records reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount' }, [ {name: 'metaname', mapping: 'name'} ]), // turn off remote sorting remoteSort: false }); this.metaname_store.on('beforeload', function() { this.metaname_store.baseParams = {'ruri': this.ruri, 'action':'metadataname_for_files'}; }, this); this.metaname_store.proxy.getConnection(). on('requestcomplete', jsonErrorResponseHandler); this.metaop_store = new Ext.data.SimpleStore({ fields: ['opname', 'opval'], data : [ ['=', '='], ['>', '>'], ['>=', '>='], ['<', '<'], ['<=', '<='], ['like', 'like'] ] }); this.adv_search_flds['metaname']=Array(); this.adv_search_flds['metaop']=Array(); this.adv_search_flds['metaval']=Array(); for (var i=0; i<5; i++) { this.adv_search_flds['metaname'][i]=new Ext.form.ComboBox({ width:150, name: 'metaname'+i, fieldLabel: 'Name', emptyText: 'Name', store: this.metaname_store, displayField: 'metaname', valueFiled: 'metaname', triggerAction: 'all' }); this.adv_search_flds['metaop'][i]=new Ext.form.ComboBox({ width:80, name: 'metaop'+i, fieldLabel: 'Operator', emptyText: 'Op', store: this.metaop_store, displayField: 'opname', valueFiled: 'opname', triggerAction: 'all' }); this.adv_search_flds['metaval'][i]=new Ext.form.TextField({ width:150, name: 'metaval'+i, fieldLabel: 'Value', emptyText: 'Value' }); } this.adv_search_form.fieldset({legend:'Metadata', hideLabels:true}); // open filedset container for metadata this.adv_search_form.column({width:170, hideLabels:true}, this.adv_search_flds['metaname'][0], this.adv_search_flds['metaname'][1], this.adv_search_flds['metaname'][2], this.adv_search_flds['metaname'][3], this.adv_search_flds['metaname'][4] ); this.adv_search_form.column({width:100, hideLabels:true}, this.adv_search_flds['metaop'][0], this.adv_search_flds['metaop'][1], this.adv_search_flds['metaop'][2], this.adv_search_flds['metaop'][3], this.adv_search_flds['metaop'][4] ); this.adv_search_form.column({width:170, hideLabels:true}, this.adv_search_flds['metaval'][0], this.adv_search_flds['metaval'][1], this.adv_search_flds['metaval'][2], this.adv_search_flds['metaval'][3], this.adv_search_flds['metaval'][4] ); this.adv_search_form.end(); // close filedset container for metadata this.adv_search_dlg= new Ext.BasicDialog(adv_search_dlg_container, { width:600, height:500, shadow:true, minButtonWidth:10, minWidth:300, minHeight:300, proxyDrag: true, modal: true, autoScroll:true, closeOnTab: true, alwaysShowTabs: false, titlebar: false }); this.adv_search_dlg.addButton("Search",function(){ this.shwoAdvSearchResult(null, this.ruri); }, this); this.adv_search_dlg.addKeyListener(27, this.result_dlg.hide, this.result_dlg); // ESC can also close the dialog // make sure metadata store get reload when account changes this.adv_search_dlg.on('beforeshow',function(){ var cur_acct=this.ruri.substring(0,this.ruri.indexOf('/')); if (!this.ruri_acct) this.ruri_acct=cur_acct; else if (this.ruri_acct!=cur_acct) // if acct has changed { this.metaname_store.reload(); this.ruri_acct=cur_acct; } else { //do nothing if acct hasn't changed } return true; }, this); this.adv_search_form.render(this.adv_search_dlg.body) }, // end of RODSFileSearchDialog::init() shwoQuickSearchResult: function (html_elem, _ruri) { this.ruri=_ruri; this.result_dlg.show(html_elem); this.ds.baseParams = {ruri:_ruri, 'descendantOnly': this.descendantOnly, 'recursive': this.descendantOnly, 'name': this.partial_name}; this.ds.load({params:{start:0, limit:100}}); }, showAdvSearchDialog: function (html_elem, _ruri, _partial_name, _descendantOnly) { this.ruri=_ruri; this.adv_search_flds['cwd'].setValue( _ruri.substr(_ruri.indexOf('/'))); this.adv_search_flds['name'].setValue(_partial_name); this.adv_search_flds['descendentOnly'].setValue(_descendantOnly); this.adv_search_dlg.show(html_elem); }, shwoAdvSearchResult: function (html_elem, _ruri) { var has_option=false; this.ruri=_ruri; this.partial_name=Ext.util.Format.trim(this.adv_search_flds['name'].getValue()); if (this.partial_name.length > 0) { this.ds.baseParams.name=this.partial_name; has_option=true; } if (this.adv_search_flds['mtime_since_now'].getValue()) { var now_date=new Date(); var now=now_date.getTime()/1000; this.ds.baseParams.smtime= now-this.adv_search_flds['mtime_since_now'].getValue(); this.ds.baseParams.emtime= now; has_option=true; } var owner=Ext.util.Format.trim(this.adv_search_flds['owner'].getValue()); if (owner.length > 0) { this.ds.baseParams.owner=owner; has_option=true; } var rsrc=Ext.util.Format.trim(this.adv_search_flds['rsrc'].getValue()); if (rsrc.length > 0) { this.ds.baseParams.rsrcname=rsrc; has_option=true; } if (this.adv_search_flds['descendentOnly'].getValue()===true) { this.ds.baseParams.recursive=true; this.ds.baseParams.descendantOnly=true; has_option=true; } var metadatas=new Array(); for (var i=0; i0) && (meta['op'].length>0) && (meta['val'].length>0) ) { metadatas.push(meta); } } if (metadatas.length>0) { this.ds.baseParams.metadata=escape(Ext.util.JSON.encode(metadatas)); has_option=true; } if (has_option!=false) { this.result_dlg.show(html_elem); this.ds.baseParams.ruri=_ruri; this.ds.load({params:{start:0, limit:100}}); } }, refresh: function() { this.ds.reload(); } } } // end of RODSFileSearchDialog function RODSMetadataGrid() { var gridpanel, grid, grid_view, ds, num_newrows; return { init : function(grid_container) { this.num_newrows=0; // shorthand alias var fm = Ext.form, Ed = Ext.grid.GridEditor; // the column model has information about grid columns // dataIndex maps the column to the specific data field in // the data store (created below) var cm = new Ext.grid.ColumnModel([{ header: "Name", dataIndex: 'name', renderer: escapeXMLChar, width: 200, editor: new Ed(new fm.TextField({ allowBlank: false, emptyText: 'Name', emptyClass: 'x-form-empty-field' })) },{ header: "Value", id: 'meta_grid_col_value', dataIndex: 'value', renderer: escapeXMLChar, width: 200, editor: new Ed(new fm.TextField({ allowBlank: false })) },{ header: "Unit", dataIndex: 'unit', width: 100, editor: new Ed(new fm.TextField({ allowBlank: true })) } ]); // by default columns are sortable cm.defaultSortable = true; // this could be inline, but we want to define the metadata record // type so we can add records dynamically var MetadataRecord = Ext.data.Record.create([ // the "name" below matches the tag name to read {name: 'id', type: 'string'}, {name: 'name', type: 'string'}, {name: 'value', type: 'string'}, {name: 'unit', type: 'string'}, {name: 'isnew', type: 'bool'}, {name: 'isremoved',type: 'bool'} ]); // create the Data Store this.ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/metadata.php' }), reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount' }, MetadataRecord), // turn off remote sorting remoteSort: false }); this.ds.setDefaultSort('name', 'desc'); this.ds.on('loadexception', function(a,conn,resp) { if (resp.status != 200) Ext.Msg.alert('load exception', resp.status+':'+resp.statusText); }); this.ds.proxy.getConnection().on('requestcomplete', jsonErrorResponseHandler); // create the editor grid //this.grid = new Ext.grid.EditorGrid('metadata-grid', { this.grid = new Ext.grid.EditorGrid(grid_container, { ds: this.ds, cm: cm, autoHeight: true, loadMask: true, selModel: new Ext.grid.RowSelectionModel(), enableColLock:false, autoExpandColumn:'meta_grid_col_value' }); // if a cell is edited add the record as 'isedited' this.grid.on("beforeedit", function(evnt) { if (evnt.record.get('isremoved')==true) // cancel edit if row is removed evnt.cancel=true; }, this ); // if a cell is edited add the record as 'isedited' this.grid.on("afteredit", function(evnt) { if (evnt.record.get('isnew')==true) return; else { if (evnt.value != evnt.originalValue) { evnt.record.set('isedited',true); } } }, this ); // render it this.grid.render(); this.grid_view=this.grid.getView(); this.grid_view.on('refresh', function(){ // re-apply line-through style to delted records for (var i=0; i= 0) { var rowel=this.grid_view.getRow(index); rowel.style.textDecoration='line-through'; } } else // if already removed, un-remove it { selected_rec.set('isremoved',false); var index=this.ds.indexOf(selected_rec); if (index >= 0) { var rowel=this.grid_view.getRow(index); rowel.style.textDecoration=''; } } } else // if it's a new row { this.ds.remove(selected_rec); } } } }, '-', { icon: "images/arrow_refresh_small.png", text: "Reload", tooltip: 'Reload and discard all changes', cls: 'x-btn-text-icon', scope: this, handler: this.refresh }, '-', { icon: "images/disk.png", text: "Save", tooltip: 'Save all changes', cls: 'x-btn-text-icon', scope: this, handler : function(){ var rec_report=''; var row_ops=Array(); var del_queue=Array(); //array of id's (string) to be deleted var add_queue=Array(); //array of records (record) to be added for (var i=0; i0) { Ext.MessageBox.wait('Saving metadata changes. Please wait...'); var batch=escape(Ext.util.JSON.encode(row_ops)); var conn=new Ext.data.Connection(); var myparams={ruri: this.ruri,'type': this.type, action:'mod', batch:batch}; conn.request({url: 'services/metadata.php', params: myparams, callback: function(options,success,r) { Ext.MessageBox.hide(); if (success!=true) { alert("HTTP Request Failed ("+ r.statusText+'): '+r.responseText); } else { try { var response = Ext.util.JSON.decode(r.responseText); if (response && response.success == false) { Ext.MessageBox.alert("Error", response.errmsg); } else { this.ds.reload(); } } catch (e) { alert("Invalid server response:"+r.responseText+'
Exception:'+e); } } }, // end of HTTP conn callback scope: this }); } } //end of metadata save handler } ); this.gridpanel = new Ext.GridPanel(this.grid, /*'metadata-grid-center',*/ {autoCreate: true, fitToFrame: true, autoScroll: true, title: 'metadata'} ); }, // end of RODSMetadataViewer::init() load: function (_ruri, _type) { this.ruri=_ruri; this.type=_type; this.num_newrows=0; this.ds.load({params:{ruri:_ruri, 'type':_type, action:'get'}}); }, refresh: function() { this.ds.reload(); } } } // end of RODSMetadataViewer function RODSFileViewer() { var file_dlg, layout, panels, tab_main, tab_meta, ruri, record, permalink, isImage, metagrid; return { init : function (){ //Ext.QuickTips.init(); this.metagrid=new RODSMetadataGrid(); this.metagrid.init('fileviewer-tab-meta-grid'); this.file_dlg = new Ext.LayoutDialog("file-dlg", { width:600, height:400, shadow:true, minButtonWidth:10, minWidth:300, minHeight:300, autoTabs:true, proxyDrag: true, center: { autoScroll:true, tabPosition: 'bottom', titlebar: true, title: 'File Details' } }); this.layout = this.file_dlg.getLayout(); this.layout.beginUpdate(); var main_tb=new Ext.Toolbar(this.file_dlg.getLayout().getRegion('center').titleEl); main_tb.add({ icon: 'images/application_double.png', cls: 'x-btn-text-icon bmenu', // icon and text class text:'Open', tooltip: 'View file in a new browser window', cls: 'x-btn-text-icon', scope: this, handler: this.openFile }); this.createReplGridPanel(); this.tab_main=this.layout.add('center', new Ext.ContentPanel('fileviewer-tab-main', {title: 'overview'})); // generate some other tabs //this.metagrid.gridpanel.setTitle('metadata'); this.tab_meta=this.layout.add('center', this.metagrid.gridpanel); this.tab_meta.on('activate', function() { this.metagrid.load(this.ruri,1); }, this); this.tab_repl=this.layout.add('center', this.replGridpanel); this.tab_repl.on('activate', function() { this.repl_ds.load({params:{ruri:this.ruri}}); }, this); this.tab_more=this.layout.add('center', new Ext.ContentPanel('fileviewer-tab-more', {title: 'More'})); this.layout.endUpdate(); //permalink_textarea.setDisabled(true); }, view : function(_record, html_el){ this.record=_record; this.ruri=this.record.data['ruri']; this.permalink=this.getPermaLink(); this.isImage=this.isFileImage(); this.file_dlg.setTitle(this.record.data['name']); this.setTabMain(); this.layout.getRegion("center").showPanel("fileviewer-tab-main"); this.file_dlg.show(html_el); this.file_dlg.toFront(); }, isFileImage : function () { var splitname= (this.record.data['name']).split("."); var file_ext=splitname.pop(); if (file_ext.length<1) return false; file_ext=file_ext.toLowerCase(); return (file_ext=='gif' || file_ext == 'jpg' || file_ext == 'jpeg' || file_ext=='png' || file_ext=='bmp'); }, setTabMain : function () { var html= ''; if (this.isImage==true) { html=html+'
  generating preview...

'; } html=html+'Force Download
'+ ''+ this.record.data['fmtsize'] + ' ('+this.record.data['size'] + ' Bytes)
' + ''+ this.ruri + '
' + ''+ this.record.data['rescname'] + '
' + ''+ this.record.data['typename'] + '
' + ''+ this.record.data['mtime'] + '
' + ''+ this.record.data['ctime'] + '
' + ''+ ''; this.tab_main.setContent(html); if (this.isImage==true) { var current_image=new Image(); function previewImage() { var this_image=current_image; var preview_div=Ext.get('file-image-preview'); var new_height=this_image.height > 150 ? 150:this_image.height; var new_width= Math.round(this_image.width*(new_height/(this_image.height))); preview_div.dom.innerHTML=''; var wrapped = new Ext.Resizable('resized-image', { wrap:true, //dynamic:true, adjustments: 'auto', pinned:true, preserveRatio: true }); } function imageError() { Ext.get('file-image-preview').dom.innerHTML='Unable to generate preview'; } function imageAbort() { Ext.get('file-image-preview').dom.innerHTML='preview canceled'; } current_image.onload=previewImage; current_image.onerror=imageError; current_image.onabort=imageAbort; current_image.src=this.permalink; } var permalink_textfld=new Ext.form.TextField({width: 450}); permalink_textfld.setValue(this.permalink); permalink_textfld.applyTo('permalink-textfld'); }, openFile : function () { window.open(this.permalink,'mywindow','width=800,height=600,resizable = yes, scrollbars = yes'); }, getPermaLink : function () { var currenturl=location.protocol+'//'+location.host+location.pathname; var currenturlpath=currenturl.substring(0,currenturl.lastIndexOf('/')); var permalink=currenturlpath+'/rodsproxy/'+this.ruri; return permalink; }, createReplGridPanel : function() { // the column model has information about grid columns // dataIndex maps the column to the specific data field in // the data store (created below) var cm = new Ext.grid.ColumnModel([{ id: "repl_grid_col_replnum", header: "#", dataIndex: 'repl_num', width: 50, css: 'white-space:normal;' },{ header: "Chksum", dataIndex: 'chk_sum', width: 100, hidden: true },{ id: "repl_grid_col_rescname", header: "Resource", dataIndex: 'resc_name', width: 100 },{ header: "Resc Group", dataIndex: 'resc_grp_name', width: 100, hidden: true },{ header: "Type", dataIndex: 'resc_type', width: 100, hidden: true },{ header: "Class", dataIndex: 'resc_class', width: 100, hidden: true },{ header: "Location", dataIndex: 'resc_loc', width: 100, hidden: true },{ header: "Freespace", dataIndex: 'resc_freespace', width: 100, hidden: true },{ header: "Size", dataIndex: 'size', width: 50, renderer: renderFmtSize, align: 'right' },{ header: "Date Created", dataIndex: 'ctime', width: 150, renderer: renderTime, align: 'right', hidden: true },{ header: "Up-to-date", dataIndex: 'resc_repl_status', width: 100, renderer: function (value,p,record){ if (record.data['resc_repl_status']==0) return '
No
'; else if (record.data['resc_repl_status']==1) return '
Yes
'; else return ''+record.data['resc_repl_status']; }, align: 'right' },{ header: "Date Modified", dataIndex: 'mtime', width: 200, renderer: renderTime, align: 'right' }]); // by default columns are sortable cm.defaultSortable = true; // create the Data Store this.repl_ds = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/fileQuery.php?action=replica' }), // create reader that reads the Topic records reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount' }, [ {name: 'repl_num', mapping: 'repl_num', type: 'int'}, {name: 'chk_sum', mapping: 'chk_sum'}, {name: 'resc_name', mapping: 'resc_name'}, {name: 'resc_repl_status', mapping: 'resc_repl_status', type: 'int'}, {name: 'resc_grp_name', mapping: 'resc_grp_name'}, {name: 'resc_type', mapping: 'resc_type'}, {name: 'resc_class', mapping: 'resc_class'}, {name: 'resc_loc', mapping: 'resc_loc'}, {name: 'resc_freespace', mapping: 'resc_freespace', type: 'int'}, {name: 'data_status', mapping: 'data_status'}, {name: 'size', mapping: 'size', type: 'int'}, {name: 'ctime', mapping: 'ctime', type: 'date', dateFormat: 'timestamp'}, {name: 'mtime', mapping: 'mtime', type: 'date', dateFormat: 'timestamp'} ]), // turn on remote sorting remoteSort: false }); this.repl_ds.proxy.getConnection().on('requestcomplete', jsonErrorResponseHandler); // create the replica list grid this.repl_grid = new Ext.grid.Grid('fileviewer-tab-repl-grid', { ds: this.repl_ds, cm: cm, loadMask: true, selModel: new Ext.grid.RowSelectionModel({singleSelect:true}), enableColLock:false, autoWidth:true, autoExpandColumn:'repl_grid_col_rescname' }); // render it this.repl_grid.render(); var gridHead = this.repl_grid.getView().getHeaderPanel(true); var headerToolbar = new Ext.Toolbar(gridHead); headerToolbar.add({ icon: "images/add.png", text: 'Replicate', tooltip: 'Replicate to Additional Resource', cls: 'x-btn-text-icon', scope: this, handler: this.showReplDialog }, '-', { icon: "images/delete.png", text: 'Remove Selected', tooltip: 'Remove selected copy from its resource', cls: 'x-btn-text-icon', scope: this, handler: this.removeReplHandler }, '-', { icon: "images/arrow_refresh_small.png", text: 'Refresh List', tooltip: 'Remove list of copies', cls: 'x-btn-text-icon', scope: this, handler: function(){ this.repl_ds.reload(); } } ); this.replGridpanel = new Ext.GridPanel(this.repl_grid, {autoCreate: true, fitToFrame: true, autoScroll: true, title: 'Copies'} ); }, // end of method RODSFileViewer::createReplGridPanel removeReplHandler: function(btn) { if (this.repl_ds.getCount()<2) { Ext.MessageBox.alert('Failed to remove backup', 'There has to be at least one copy for each file'); return; } var selMod=this.repl_grid.getSelectionModel(); if (selMod.getCount()<1) { Ext.MessageBox.alert('Failed to remove backup', 'You must select a copy to remove'); return; } var selectedResc=selMod.getSelected().get('resc_name'); Ext.MessageBox.wait('Removing backup in progress', 'Please wait'); var conn=new Ext.data.Connection(); var myparams={ruri: this.ruri,'resource': selectedResc}; conn.request({url: 'services/repl.php?action=remove', params: myparams, scope: this, callback:generalRODSHttpRequestHandler, //this property is used by generalRODSHttpRequestHandler //this function is called only if everything goes well success_calback: function(){ this.repl_ds.reload(); }, //this property is used by generalRODSHttpRequestHandler //this function is called regardless of the state. first_calback: function(){ Ext.MessageBox.hide(); } }); }, showReplDialog: function(btn) { if (this.replDialog==null) { this.replForm = new Ext.form.Form({ labelWidth: 100, // label settings here cascade unless overridden url:'services/repl.php?action=add', timeout: 10 }); this.rescBox=new RODSResourceBox(); this.rescBox.init(this.ruri); this.replForm.add( this.rescBox.box ); this.replForm.end(); this.replForm.render('repl-dlg-bd-form'); this.replForm.on("actionfailed", function(form, action) { Ext.MessageBox.hide(); if (action.result) { var errcode=''; if (action.result.errcode!=null) errcode=action.result.errcode; Ext.MessageBox.alert('Failure:'+errcode, action.result.errmsg); } else { Ext.MessageBox.alert('Failure:', 'Replication request failed with unknown reasons...'); } }, this); this.replForm.on("actioncomplete", function(form, action) { Ext.MessageBox.hide(); this.replDialog.hide(); this.repl_ds.reload(); }, this); this.replDialog=new Ext.BasicDialog("repl-dlg", { height: 130, width: 400, minHeight: 100, minWidth: 150, modal: true, proxyDrag: true, buttonAlign: "center", shadow: true }); this.replDialog.on('beforeshow',function(){ this.rescBox.updateRURI(this.ruri); return true; }, this); this.replDialog.addKeyListener(27, this.replDialog.hide, this.replDialog); // ESC can also close the dialog this.replDialog.addButton('OK', function(){ if (true==this.replForm.isValid()) { Ext.MessageBox.wait('Replication in progress', 'Please wait'); this.replForm.baseParams = {'ruri': this.ruri}; this.replForm.submit(); } }, this); // Could call a save function instead of hiding this.replDialog.addButton('Cancel', this.replDialog.hide, this.replDialog); } this.replDialog.show(btn.getEl()); } }; //end of RODSFileViewer's reuturn } //end of RODSFileViewer function RodsBrowser(inipath, _ssid) { var layout, grid, tree, root, coll_list_data, browse_srv_script_path, rpath_grid, rpath_tree, rpath_grid_uriobj, file_viewer, force_delete, resources, resource_box, new_file_dialog, upload_dialog, upload_applet_dialog, metadata_dialog, metagrid, move_src_parent_node, move_dest_parent_node, ssid, quick_search_fld, file_search_dlg; rpath_grid=inipath; rpath_tree=inipath; ssid=_ssid; function jsonErrorResponseHandler(conn, r, options) { var response = Ext.util.JSON.decode(r.responseText); if (response && response.success == false) { // your error handling code goes here //Ext.MessageBox.alert("Error", response.errors); if (response.errcode==-301000) window.location = 'index.php?redirect='+rpath_grid+'&&errmsg=The Path you tried to access requires authentication!'; else if (response.errcode==-1000) window.location = 'index.php?redirect='+rpath_grid+'&&errmsg=Server is not responding, it may be down!'; else Ext.MessageBox.alert("Error", response.errmsg); } } return { gotoRURI : function (new_ruri){ this.allGoTo(new_ruri); }, getCurrentRURI : function () { return rpath_grid; }, init : function (){ Ext.QuickTips.init(); this.file_viewer=new RODSFileViewer(); this.file_viewer.init(); this.file_search_dlg=new RODSFileSearchDialog(); this.file_search_dlg.init('search-dlg', 'file-search-result-dlg','file-search-result-grid', this.file_viewer); //this.createRodsCollDataStore('browse.php?ruri=rods.tempZone:RODS@rt.sdsc.edu:1247/tempZone/home/rods'); this.createRodsCollDataStore(); this.createRodsCollBrowseGrid(coll_list_data); this.createRodsDirTree(); this.layout = new Ext.BorderLayout(document.body, { north: { split:false, initialSize: 32, titlebar: false }, west: { split:true, initialSize: 200, minSize: 175, maxSize: 400, titlebar: true, collapsible: true, animate: true }, center: { titlebar: false, autoScroll:true, closeOnTab: true } }); this.layout.beginUpdate(); this.layout.add('north', new Ext.ContentPanel('north', 'North')); //this.layout.add('west', new Ext.ContentPanel('west', {title: 'West', closable: false})); this.layout.add('west', new Ext.ContentPanel('tree-div', {title: 'Collections', closable: false, autoScroll:true, fitToFrame:true})); this.layout.add('center', new Ext.GridPanel(grid, 'center2', {title: 'Collections and Files', closable: false})); this.layout.endUpdate(); this.createLoginOutDiv(); }, // end of RodsBrowser::init allGoTo : function (new_ruri) { var currentRURI = YAHOO.util.History.getCurrentState( "ruri" ); if (currentRURI!=new_ruri) { try { //alert("i am going to naviagte with yui history manager:"+new_ruri); YAHOO.util.History.navigate( "ruri", new_ruri ); this.gridGoTo(new_ruri); } catch (e) { //alert("i am going to naviagte without yui history manager:"+new_ruri); this.gridGoTo(new_ruri); } } //else //alert("last_ruri: "+currentRURI+" already exists!"); }, gridGoTo: function (new_ruri) { if (new_ruri!=rpath_grid) { rpath_grid=new_ruri; coll_list_data.load({params:{start:0, limit:50}}); grid.selModel.clearSelections(); //workaround for IE6's wierd behavior this.treeGoTo(rpath_grid); // set new ruri in applet if (document.myApplet) document.myApplet.setRuri(new_ruri); } }, treeGoTo: function (new_ruri) { if (new_ruri!=rpath_tree) { var newacctstr=new_ruri.substring(0,new_ruri.indexOf('/')); var oldacctstr=rpath_tree.substring(0,rpath_tree.indexOf('/')); // if new account and old account matches, just expand the tree if (newacctstr==oldacctstr) { var path="/"+new_ruri; tree.expandPath(path); tree.selectPath(path); rpath_tree=new_ruri; } // else then re-render the tree else { rpath_tree=new_ruri; this.createRodsDirTree(); } } }, // refresh a tree node. refreshTreeNodeByRURI: function (new_ruri) { var path="/"+new_ruri; tree.expandPath(path, 'id', function(bSuccess, oLastNode){ oLastNode.reload(); }); }, // refresh grid. refreshGrid: function () { coll_list_data.load({params:{start:0, limit:50}}); }, createMetadataGrid : function () { if (this.metagrid==null) { this.metagrid=new RODSMetadataGrid(); this.metagrid.init('metadata-grid'); } }, createLoginOutDiv : function () { var acct_str=rpath_grid.substring(0,rpath_grid.indexOf('/')); document.getElementById('login-out').innerHTML = acct_str + ' | Sign Out'; }, moveCallBackHandler: function (options,success,response) { Ext.MessageBox.hide(); var resp; var need_refresh_tree_nodes=false; try { resp= Ext.util.JSON.decode( response.responseText ); } catch (e) { alert("Invalid server response:"+response.responseText+'
Exception:'+e); } if (!resp['success']) { var title='Failure: '; var msg=''; if (!resp['batch_status']) { if (resp['errcode']!=null) title=title+resp['errcode']; if (resp['errmsg']!=null) msg=resp['errmsg']; } else { msg='Some files/collections could not be moved:
\n'; for (var i=0; i'+name+':'+thisstatus['errmsg']+'
\n'; } } } Ext.MessageBox.show({ title: title, msg: msg, width:300, buttons: Ext.MessageBox.OK }); } for (var i=0; i0) { this.move_src_parent_node=tree.getSelectionModel().getSelectedNode(); this.move_dest_parent_node=dropEvent.target; Ext.MessageBox.wait('Moving in progress. Please wait...'); var conn=new Ext.data.Connection(); var myparams={batch: escape(Ext.util.JSON.encode(move_queue))}; conn.request({url: 'services/rename.php', params:myparams, callback: this.moveCallBackHandler, scope: this}); } else dropEvent.cancel=true; } else if (dropEvent.data.node!=null) { var move_queue=new Array(); var move_que_item={}; move_que_item['src']=dropEvent.data.node.getPath().substring(1); move_que_item['type']=0; move_que_item['dest']=dropEvent.target.getPath().substring(1)+'/'+dropEvent.data.node.id; if (move_que_item['src']!=move_que_item['dest']) move_queue.push(move_que_item); if (move_queue.length>0) { this.move_src_parent_node=tree.getSelectionModel().getSelectedNode().parentNode; this.move_dest_parent_node=dropEvent.target; Ext.MessageBox.wait('Moving in progress. Please wait...'); var conn=new Ext.data.Connection(); var myparams={batch: escape(Ext.util.JSON.encode(move_queue))}; conn.request({url: 'services/rename.php', params:myparams, callback: this.moveCallBackHandler, scope: this}); } else dropEvent.cancel=true; } else { Ext.Msg.alert('drop event error', 'Couldn\'t determin what was droppped!'); dropEvent.cancel=true; } }, this); // render the tree tree.render(); //root.expand(); tree.expandPath('/'+rpath_tree); tree.selectPath('/'+rpath_tree); }, createRodsCollDataStore : function() { // create the Data Store coll_list_data = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'services/dir_grid.php' }), // create reader that reads the Topic records reader: new Ext.data.JsonReader({ successProperty: 'success', root: 'que_results', totalProperty: 'totalCount', id: 'id' }, [ {name: 'name', mapping: 'name'}, {name: 'owner', mapping: 'owner'}, {name: 'rescname', mapping: 'rescname'}, {name: 'ruri', mapping: 'ruri'}, {name: 'size', mapping: 'size', type: 'int'}, {name: 'fmtsize', mapping: 'fmtsize'}, {name: 'type', mapping: 'type'}, {name: 'typename', mapping: 'typename'}, {name: 'ctime', mapping: 'ctime', type: 'date', dateFormat: 'timestamp'}, {name: 'mtime', mapping: 'mtime', type: 'date', dateFormat: 'timestamp'} ]), // turn on remote sorting remoteSort: true }); coll_list_data.setDefaultSort('mtime', 'desc'); coll_list_data.on('beforeload', function() { coll_list_data.baseParams = {'ruri': rpath_grid}; document.title='rods://'+rpath_grid; }); /* coll_list_data.on('loadexception', function() { var resp=coll_list_data.reader.read(); alert("loading failed!"+resp.errors); }); */ coll_list_data.proxy.getConnection().on('requestcomplete', jsonErrorResponseHandler); }, createRodsCollBrowseGrid : function(ds) { // the column model has information about grid columns // dataIndex maps the column to the specific data field in // the data store var cm = new Ext.grid.ColumnModel([{ id: "dir_grid_col_name", header: "Name", dataIndex: 'name', width: 400, renderer: renderName, //renderer: renderTopic, //locked: true, //lock the column css: 'white-space:normal;' },{ header: "Owner", dataIndex: 'owner', width: 100, hidden: true },{ header: "Resource", dataIndex: 'rescname', width: 100, hidden: false },{ header: "Type", dataIndex: 'typename', width: 100, hidden: true },{ header: "Size", dataIndex: 'size', width: 100, renderer: renderFmtSize, align: 'right' },{ header: "Date Created", dataIndex: 'ctime', width: 200, renderer: renderTime, align: 'right', hidden: true },{ header: "Date Modified", dataIndex: 'mtime', width: 200, renderer: renderTime, align: 'right' }]); // by default columns are sortable cm.defaultSortable = true; // create the editor grid grid = new Ext.grid.Grid('rods-browser-grid', { ds: ds, cm: cm, selModel: new Ext.grid.RowSelectionModel({singleSelect:false}), enableColLock:false, autoWidth:true, enableDrag: true, ddGroup : 'GridDD', autoExpandColumn:'dir_grid_col_name' }); // drag and drop support grid.enableDragDrop = true; grid.getDragDropText = function(){ var selected_items = this.getSelectionModel().getSelections(); var numfiles = 0; var numdirs = 0; for (var i=0; i1) { var newrpath=rpath_grid.substr(0,lastindex); this.allGoTo(newrpath); } } function showUploadDialog(btn) { if (upload_dialog==null) { var uploadForm = new Ext.form.Form({ labelWidth: 100, // label settings here cascade unless overridden fileUpload : true, url:'services/upload.php', timeout: 10, baseParams: {ruri: rpath_grid} }); var myRescBox=new RODSResourceBox(); myRescBox.init(rpath_grid); uploadForm.add( new Ext.form.TextField({ fieldLabel: 'File', name: 'file', id: 'fileUploadField', width:250, inputType: 'file', selectOnFocus: true, allowBlank:false }), myRescBox.box ); uploadForm.end(); uploadForm.render('file-upload-dlg-bd-form'); upload_dialog=new Ext.BasicDialog("file-upload-dlg", { height: 150, width: 400, minHeight: 100, minWidth: 150, modal: true, proxyDrag: true, buttonAlign: "center", shadow: true }); upload_dialog.uploadForm=uploadForm; upload_dialog.resourcebox=myRescBox; upload_dialog.on('beforeshow',function(){ this.resourcebox.updateRURI(rpath_grid); return true; }); upload_dialog.addKeyListener(27, upload_dialog.hide, upload_dialog); // ESC can also close the dialog upload_dialog.addButton('OK', uploadHandler, upload_dialog); // Could call a save function instead of hiding upload_dialog.addButton('Cancel', upload_dialog.hide, upload_dialog); } else { fileUploadField=upload_dialog.uploadForm.findField('fileUploadField'); fileUploadField.setRawValue(''); } //upload_dialog.resourcebox.setValue(resources.acct_str.getAt(0).data.name); upload_dialog.show(btn.getEl()); } function showUploadAppletDialog(btn) { if (upload_applet_dialog==null) { upload_applet_dialog=new Ext.BasicDialog("upload-applet-dlg", { height: 410, width: 710, minHeight: 100, minWidth: 150, modal: true, proxyDrag: true, buttonAlign: "center", shadow: true }); Ext.get('upload-applet-dlg-bd-main').dom.innerHTML= ''+ ' '+ ' '+ ''; upload_applet_dialog.addKeyListener(27, upload_applet_dialog.hide, upload_applet_dialog); // ESC can also close the dialog }//if upload_applet_dialog.show(btn.getEl()); } function showMetadataDialog(btn) { var sm = grid.getSelectionModel(); if (sm.hasSelection()==false) return; var record = sm.getSelected(); // deselect all but the first selected item sm.selectRecords([record],false); var selected_ruri=rpath_grid+'/'+record.data['name']; var selected_type=record.data['type']; var title='Metadata: '+record.data['name']; if (selected_type==0) { title=title+'/'; } if (metadata_dialog==null) { if (this.metagrid==null) { this.createMetadataGrid(); } metadata_dialog= new Ext.LayoutDialog("metadata-dlg", { width:600, height:400, shadow:true, minButtonWidth:10, minWidth:300, minHeight:300, proxyDrag: true, modal: true, center: { autoScroll:true, //tabPosition: 'top', closeOnTab: true, alwaysShowTabs: false, titlebar: false } }); var layout = metadata_dialog.getLayout(); layout.beginUpdate(); layout.add("center", this.metagrid.gridpanel); layout.endUpdate(); } this.metagrid.load(selected_ruri,selected_type); metadata_dialog.setTitle(title); metadata_dialog.show(); } function showNewFileDialog(btn) { if (new_file_dialog==null) { var newFileForm = new Ext.form.Form({ labelWidth: 100, // label settings here cascade unless overridden url:'new-file.php' }); var myRescBox=new RODSResourceBox(); myRescBox.init(rpath_grid); newFileForm.add( new Ext.form.TextField({ fieldLabel: 'Name', name: 'name', width:250, value: 'Newfile.txt', selectOnFocus: true, allowBlank:false }), myRescBox.box ); newFileForm.end(); newFileForm.render('new-file-dlg-bd-form'); new_file_dialog=new Ext.BasicDialog("new-file-dlg", { height: 150, width: 400, minHeight: 100, minWidth: 150, modal: true, proxyDrag: true, buttonAlign: "center", shadow: true }); new_file_dialog.newFileForm=newFileForm; new_file_dialog.resourcebox=myRescBox; new_file_dialog.on('beforeshow',function(){ this.resourcebox.updateRURI(rpath_grid); return true; }); new_file_dialog.addKeyListener(27, new_file_dialog.hide, new_file_dialog); // ESC can also close the dialog new_file_dialog.addButton('OK', newFileHandler, new_file_dialog); // Could call a save function instead of hiding new_file_dialog.addButton('Cancel', new_file_dialog.hide, new_file_dialog); } new_file_dialog.show(btn.getEl()); } function mkdirDialog (btn) { Ext.MessageBox.show({ title: 'Create New Collection', msg: 'Please enter new collection name', prompt: true, width:400, buttons: Ext.MessageBox.OKCANCEL, animEl: btn.getEl(), fn: mkdirHandler }); } function showReplBulkDialog(btn) { if (this.replDialog==null) { this.replForm = new Ext.form.Form({ labelWidth: 100, // label settings here cascade unless overridden timeout: 10 }); this.replRescBox=new RODSResourceBox(); this.replRescBox.init(rpath_grid); this.replForm.add( this.replRescBox.box ); this.replForm.end(); this.replForm.render('repl-bulk-dlg-bd-form'); this.replDialog=new Ext.BasicDialog("repl-bulk-dlg", { height: 270, width: 400, minHeight: 100, minWidth: 150, modal: true, proxyDrag: true, buttonAlign: "center", shadow: true }); this.replDialog.on('beforeshow',function(){ this.replRescBox.updateRURI(rpath_grid); return true; }, this); this.replDialog.addKeyListener(27, this.replDialog.hide, this.replDialog); // ESC can also close the dialog this.replDialog.addButton('OK', function(btn){ var sm = grid.getSelectionModel(); var records=sm.getSelections(); var files=new Array(); var dirs=new Array(); for (var i=0; i0) { var list = ''; var numfile=0, numcoll=0; for (var i=0; i'; } if (records[i].data['type']==0) numcoll++; else numfile++; } if (records.length>5) list=list+'    ...
'; var dialog_msg='Schedule replications for the following '+numfile+ ' files and '+numcoll+' collections?
'+list; var el=Ext.get("repl-bulk-dlg-bd-desc"); el.update(dialog_msg); this.replDialog.show(btn.getEl()); } } function mkdirHandler(btn, dirname) { dirname=dirname.replace(/^\s+|\s+$/g, ''); if ( (btn!='ok')||(dirname.length<1) ) return; Ext.MessageBox.wait('Creation in progress. Please wait...'); var conn=new Ext.data.Connection(); var myparams={ruri: rpath_grid,'name': dirname}; conn.request({url: 'services/mkdir.php', params: myparams, callback: generalAjaxCallback}); } function uploadHandler() { if (true==this.uploadForm.isValid()) { Ext.MessageBox.wait('uploading in progress', 'Please wait'); this.uploadForm.baseParams = {'ruri': rpath_grid}; this.uploadForm.submit({ // callback handler if submit has been successful success: function(uploadForm, action){ Ext.MessageBox.hide(); upload_dialog.hide(); coll_list_data.reload(); }, failure: function(uploadForm, action) { Ext.MessageBox.hide(); var errcode=''; if (action.result.errcode!=null) errcode=action.result.errcode; Ext.MessageBox.alert('Failure:'+errcode, action.result.errmsg); } }); } } function newFileHandler() { if (true==this.newFileForm.isValid()) { var forminputs=this.newFileForm.getValues(); new_file_dialog.hide(); Ext.MessageBox.wait('Creation in progress. Please wait...'); var conn=new Ext.data.Connection(); var myparams={'ruri': rpath_grid, 'resc': forminputs.resource, 'name':forminputs.name}; conn.request({url: 'services/newfile.php', params: myparams, callback: generalAjaxCallback}); } } function onForceDeleteCheck(item, checked) { if (checked==true) force_delete=true else force_delete=false; } function deletionDialog(btn) { var sm = grid.getSelectionModel(); var records=sm.getSelections(); if (records.length>0) { var list = ''; var numfile=0, numcoll=0; for (var i=0; i'; } if (records[i].data['type']==0) numcoll++; else numfile++; } if (records.length>5) list=list+'    ...
'; if (force_delete==true) var dialog_msg='Permenantly delete the following '+numfile+ ' files and '+numcoll+' collections?
'+list; else var dialog_msg='Move the following '+numfile+ ' files and '+numcoll+' collections to trash?
'+list; Ext.MessageBox.show({ title: 'File/Collection Deletion', msg: dialog_msg, width:400, buttons: Ext.MessageBox.OKCANCEL, animEl: btn.getEl(), fn: deletionHandler }); } } function deletionHandler(btn) { if (btn!='ok') return; var sm = grid.getSelectionModel(); var records=sm.getSelections(); var files=new Array(); var dirs=new Array(); for (var i=0; iException:'+e); } if (!resp['success']) { var title='Failure: '; var msg=''; if (resp['errcode']!=null) title=title+resp['errcode']; if (resp['errmsg']!=null) msg=resp['errmsg']; else if (resp['log']!=null) msg=resp['log']; Ext.MessageBox.show({ title: title, msg: msg, width:300, buttons: Ext.MessageBox.OK }); } else { coll_list_data.reload(); var selected_node=tree.getSelectionModel().getSelectedNode(); if (selected_node) selected_node.reload(); } } } // end of createRodsCollBrowseGrid }; // end of RodsBrowser::return } // end of RodsBrowser php-irods-3.3.0~beta1/web/browse.php000066400000000000000000000212061221272161600173250ustar00rootroot00000000000000 iRods Rich Web Client
 
 Connecting ...
Hi. I'm the west panel.
php-irods-3.3.0~beta1/web/config.inc.php000066400000000000000000000010641221272161600200410ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/images/000077500000000000000000000000001221272161600165575ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/images/add.png000066400000000000000000000013351221272161600200170ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<oIDAT8Ë¥“ëK“a‡ý[¶/ƒ¤†Y(¨)%X(oÙlŠŠNÛ–skŠÎön.ºÍ-µ¡Ûh¤;8ÃfâÔÒEêëP¢"jï¿ÞMGˈø}yພ羹ï$Iÿ“ß.tÓuÌ„lu‰¨æ AXþ¢:Ü𼂒ZËHÑh1óDnZJ´OJBÏÖ{±Z„ÿóÖ?­`2`‡ÒS¾‰â=¹N$ü„Å‘é=;¾íaöƒ &jw °ï›°ôqÚJGò#ÜÁ<"N ’2h8èÞµ`ïë6†·õx¸Ön_+ ~úüZto¶À}`é¢Ðx%XЛ͈ hXÑ¿¬Æ»/›ô‹}èÝÒBóJ‰_G½&ƒ|QÅr-œû6ÜÉAÞƒ ELÐ⬡\ýU3:WUh[‘C6+Š 6.fÊ *ÆÀôK͸ÜFÅŠqþ¡÷½ ýou4Ü„?ñdó|XüÃÈÒ¥ÆMvÞáD` Ú *_ý‰Ò[ «éì#A½­œ2ú´0liÐôRñ|xÖq`4w=\ôûÔèòÞÃuòQ â±Åm+GÀÙ|%$ÞÒ5ˆœÔ¹‹áØ5ãRO*Ø÷YGMš‹UO ƒ¤G€qj4Ö°(XëŒ& s1±cÂË­(LVžfÄ Rù£¢dèj¤ÑQ '-1úÚAÎTA>U ãj4,´pÀV±"4L$eÎ@.ArBù™èY a~m€y÷Y])Q8tN¸L×ô™ÌÜžt2»ó"•¡I §µŸ Ÿo=CS±Èdå)æ_·ñ_óAFË(ÓÁIEND®B`‚php-irods-3.3.0~beta1/web/images/application_double.png000066400000000000000000000010251221272161600231200ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<§IDAT8Ë“±ŠSA…¿™{w ›A c%ŠN ñ ´X[›„ Á^°rAÐÊp‹ÕÀÎ*eH‘bmÜ›MîÌÿ‹›ìÞBÜ?ÃÀ™ÃáãŸðàù§‡wï ŸþªÔÁ¹“sÆåÈ —æN;ÍG£é‡£·»G,Uï ÷·:Ý8è°‰:ÕÌöó€YRœý>aS&Åö½”‰×ooðäÍ„õ9‹l|þ:º~œ»7~þñâ_\õ?q}øÿ˜•Aÿ+¶çÿ/Ùœýßgªën¼.ÈÙ›øèßÿ@ÿþ_v&0Ëã’÷çCn½öLŽíVœD"пðP÷šä´ÆµÇ–ôXúw Éé |‘gÐO& ¹÷;\‚‰[T2.Õý¯—¯ù_+Kõ^ý»;keÒÿÔ%±ÿ­Lÿ›Uþ˜ø¿÷DÓÿä…ÑÿUSgâ4èß—ËþO?ÛûÊé®ÿOµÿï;Ùò¿çDã¸J²ÂÅxY¼.°k¶Ø77ìÔÌàÿú…Zÿµ³Õþ«§)ÿWNR8 ‡ªg ý{èßKdg&Ý< fÍLÕUTÉ„05«¶·| ¤IEND®B`‚php-irods-3.3.0~beta1/web/images/check-mark-16px.png000066400000000000000000000017221221272161600220700ustar00rootroot00000000000000‰PNG  IHDRÔ¯,Ä pHYs  šœgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFHIDATxÚb6FV>Þ¾7Mûýã7ãÕW×2€Î^¤n Îymïõç¡’A‚üüßÿüù¶9ÔˆÉSÞãÝ ß¯(ª+0™ dn¼¾ù§ W·®®óÅÓlþYhÉhÜüúû;0 þÿf@1 €X¸Ùy䬬ïmÛ¶M=0:€UÕ@UOVB†áÚý ·ù§ùÚx­úù÷'8ZÿmF8ôa €˜~þþÉo¯jwôóõ/§îݽϠ(¡Àðòã+†·G^K1ˆ¯&HýD?ÿ£E:@1ýýÿ—Y˜Kè¹¹¤é¬ƒ2|‹;/¾ŽTÏøüí÷7†ßÀ€ûû‰‘Ó è&ÐWŒÀèæ4 XõóÙ'óz0¸r;•Y©™^üóh_˜þ~d:ÿ†f °ÿýg•â‘úa£j;ï×÷ïR¡ú Þ½ýÌðÿH¨‘g °À˜e`ùÅÂgÓÂÎÄÊðë=Pä'Ô¹Œø³8@ øÄé@›ÔÅY$ÀAöõç&FüA) ˜^´ -‰MK0_È/IEND®B`‚php-irods-3.3.0~beta1/web/images/check-mark-unchecked-16px.png000066400000000000000000000012461221272161600240200ustar00rootroot00000000000000‰PNG  IHDRÔ¯,Ä pHYs  šœgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFIDATxÚbüÿÿ?% €XΞ=[¤ø-1`222‚( €bœ@<ˆ×ÒÈÄÄÄÀÃËÎdþÿúå'Hx@ øÄßø'v Û€¶p±43°s°0üüñ‡jÀ/€bªcBu"#Ü66f^~vV°Ëòÿ~ÿ Vô#@± ÛÈÁÉÊðçÏ?†ÿÿþ3ðò±3pmfdbi™ t<й@`– 3#ÿ¿ÿÁ¸xØ…¹þ‚ ÚÀÊÊÌð( 8& Aß¿ý[Àu$@1±°03䙘™¸¹Ù@v€²°05CÄvP@ýÿ!Î@L¿ýù²äW6v˜S’\3Èæ@@^‚€Û² ä$Wp«~|ÿ4ä/Š8@±€ àæagâåcƒÙŠl Üöÿ`çÿ†0` &ÈŸß O1¢[ Ö rÈö_?ÿ2üü‰ê| P’üýû/Ðëÿ¡†ÀìøÒò÷×/?¾}Æý? {ˆ8mLðJ0 MŸ?ÿÚþ‡‰‘‹#ˆâÿÿúû  „ dÿûôñ;0ÄÿÂW h2fúôñï_Á¦}†ö¿ÿ`9` ßê’€‰Æí й`— "4ƒ€&@€Ç èKÊnkIEND®B`‚php-irods-3.3.0~beta1/web/images/collapse-bg.gif000066400000000000000000000022741221272161600214430ustar00rootroot00000000000000GIF89a°÷g"Aj$Cl'Fn*Hq,Ks/Mu2Px4Rz7U|9WúdÚ´fÍ©P£ŠÔÚp*ÕƒD¿ Û3hÖŸ]Ñ6õ*4)[±.¹ÅÚÕlÝ™gå"| ’lÚ¡mÓ · PµIíV»§ãÆx—B–LyñÓÊ{ùºe TåÑÁ™êû3Ø¥޼–'b°mAǤ;—öZÃ…©æ>½ÙkcÍ@m÷~M÷dÃÇïå};haÀÂ[Ëæˆvºs×ÖYglZõeÂÑqs™îL¾e™1bÒ§CF¡ -V¨H℉0íÎ@㥿/&ˆ‘ h|áE\1„(ˆP ˜à‚)8x "¨ *XhÐ N(Ä ”C!nÈB‰ñ).è‹gôðbŒB¼@£hÀh † Æ@ã=â(ÃEþ(â ùôŠÿùGƒB?øÐÃ:ä€Ã 6”G^@;php-irods-3.3.0~beta1/web/images/delete.png000066400000000000000000000013131221272161600205250ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<]IDAT8Ë¥“ûKSaÇý[¶¢‰n„„QP˜ó2wÖÚܦγL[,biŽašAÅ\øC¨¥vÕÊ_2Ml”ZFjסå±òÒNMjmž³kÊ·¹`&.#záûËËûù¼<Ï“ 岿bV¯ÎPæ÷T3¥%¹I­†{Gª™qRiv•È…ë ætzâ#E±ß6„ˆ¼EddüÝÌJñª`Ÿ«ÅDRÁ2<]Nñ ·;°4õѾ;ˆ¶Ûm>‡7›°8ÜÉ€Qe6ÿLžI¬Ìèt‚ìæ®·c‰q!zñ |v ü¶j„/Xi ¶ž@øÞ Ì%1|hŸû±l !ˆÁô|­‹®±ø! ïY#‚uºUáN’w]Á˼ H3è„àu„ t]E´³>k%¾I“f¡’o«ÇR…‡D:“0åÚ`ä~¢ |§ øÓñ(rॠáon„3oG0!˜$‹‚¡ÎV„ë ž*[W0_ª‚¿©ýâ-+‚‰ãµÖ d§ÁWÇ&2¾ZfMFô‰ÒVJpËiF&B°³ >­ ÞRɘ•gƒ- Ð~ CâmèÍÚ´ÒÄ×ERÁ ឫРp«5Þ°y•ø¨È+‹Á21ø¶ŒK—aw·h£`Õ ä#Šüôa×Zñ½ž†‡Tâ³ZoüåL¨óÑ“•ÊÇ`"é(?•ï'žÜËŽJváKµÞ†óñ|ª:†G9[—aöw8é2 Jw Äéf'±“y¿ëmæzsÓ˜žìTswæá_·ñ_óÒιIrþIEND®B`‚php-irods-3.3.0~beta1/web/images/disk.png000066400000000000000000000011541221272161600202200ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<þIDATÁ=‹]UеÏì;C‚’¨`„DD Ve ñ£‚…h‘*BÐ"¥6VV"¢c¡Ø v‚ba•"ÁNÅB´Å Þ™{ö~×j‡o|÷Ãóx÷‘Ž&ÀÞÒ,K“”*ÿìoü¼=]ß»óñË_v<}tëÚuš§.R±±[ËÞÒœ9X´Æñ¶ŸÌs¿þy|åóo~ùäðÆ×ç¼ |uç_’¸ùáªBk6½Y–f7b»–QÚ´ô×^ºüЙƒý<TÅ:Ê:ÖŠ¾Ç¦7U±Ý•u„Ä÷wïÙßìÙžŽý޳£‚Øî ,­6}Ñ4'kÙžF%*Tâ¿NHZ'}&NGÀÛ¯_±é‹¾°Îøï´Œ*UD¤Ê:¦¤t´šH¼ûÙZk–Ʀ/FÅ%8þAëØ#Ñ…J©š¾p‘FQ¡ª$Q‰ª¢5ë:Hé0' РQED‚DK$e]›¤t³Ñ4I¤JDUS*¢œ®!¥³Bxç•KàÖÑOƈ¤ô¥5³ˆHøàöupóê‘9‡Ý‰®Q píÒ«j–¹¥'ɬ4nÿþxöÑÍ9­3’¤Wü¶õø3—Ïj7ŸûÀ…ûËœ¿ÛáoßOò$¹*y€’„”¤HIЉ$HÈ=m¹û?!|n‹m°¢IEND®B`‚php-irods-3.3.0~beta1/web/images/disk_multiple.png000066400000000000000000000012631221272161600221340ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<EIDAT8Ë¥“ÍKTaÆç½÷ÎLãGöA Jh%Õ")%—‰´ B‰ jUH¸ò/h'´1h§«!‰VmÄ!m"­ÁÁPp¥¢ÕŒÖ4Ž3÷ó}[XZ‹Àg}Îï<çá1ÆpÙCc‹³uq(û!Çjclä*ˆ‚Ú¤…6Âb…éLöÁÊxÿâ?•²ËõÎ Üê¨ebæ3ï]ÚWôâm­%tˆ1†ûOff{º/²²–kŸXLq´Æáë¦ øægÉݘÎdûVÆûç÷9PJ° ¸—žkç¸q¹†7s_êkC€íJHDLÌÑZ^g÷ŽÂõr—õ¼ÇÐØj¼.“s3i=ÑàáȬ™Îd»VÆû?Ø¡6xQˆR ËÈÿf2 ˆØ.8bs¼ÎÂR!e/àûvÀTúÛ^£Bу|ÁGDWWˆ´ÁÂ!Ôš‚»¹—Iižv µÁ†¤ žçQÜñ«Û¶hi„ôR@M,IÂ)ázïVQa¤Ñ‘ÆÆ0tv(€åléSjr­¢Æ/×ïeb)ÁBÄ£0FÂ߫ң½w†ß/Ÿo¦3A«#6ƒ7뵿;Ç€MÂŽ1òr­âNðGËÙÒ\jr¡#Ò`á ©š{ÄÉäE¾¼ÎÀÕg(”=ÿo@z´÷öo'¦¥N×nÓÓÞIC¬ Ü&NÕ„$c`‹TOù ® N½kk>ÒÝo a×êÑ1ZÊ,­-“+Ì?¿+rØwþÿÑ!/-‘FÕIEND®B`‚php-irods-3.3.0~beta1/web/images/download.png000066400000000000000000000073621221272161600211040ustar00rootroot00000000000000‰PNG  IHDRhôÏ÷ pHYs  šœ MiCCPPhotoshop ICC profilexÚSwX“÷>ß÷eVBØð±—l"#¬ÈY¢’a„@Å…ˆ VœHUÄ‚Õ Hˆâ (¸gAŠˆZ‹U\8îܧµ}zïííû×û¼çœçüÎyÏ€&‘æ¢j9R…<:ØOHÄɽ€Hà æËÂgÅðyx~t°?ü¯opÕ.$ÇáÿƒºP&W ‘à"ç RÈ.TÈȰS³d ”ly|B"ª ìôI>Ø©“ÜØ¢©™(G$@»`UR,À ¬@".À®€Y¶2G€½vŽX@`€™B,Ì 8CÍ L 0Ò¿à©_p…¸HÀ˕͗KÒ3¸•Ðwòðàâ!âÂl±Ba)f ä"œ—›#HçLÎ ùÑÁþ8?çæäáæfçlïôÅ¢þkðo">!ñßþ¼ŒNÏïÚ_ååÖpǰu¿k©[ÚVhßù]3Û  Z Ðzù‹y8ü@ž¡PÈ< í%b¡½0ã‹>ÿ3áoà‹~öü@þÛzðqš@™­À£ƒýqanv®RŽçËB1n÷ç#þÇ…ýŽ)Ñâ4±\,ŠñX‰¸P"MÇy¹R‘D!É•âé2ñ–ý “w ¬†OÀN¶µËlÀ~î‹XÒv@~ó-Œ ‘g42y÷“¿ù@+Í—¤ã¼è\¨”LÆD *°A Á¬ÀœÁ¼ÀaD@ $À<Bä€ ¡–ATÀ:ص° šá´Á18 çà\ëp`žÂ¼† AÈa!:ˆbŽØ"ΙŽ"aH4’€¤ éˆQ"ÅÈr¤©Bj‘]H#ò-r9\@úÛÈ 2ŠüмG1”²QÔu@¹¨ŠÆ sÑt4]€–¢kÑ´=€¶¢§ÑKèut}ŠŽc€Ñ1fŒÙa\Œ‡E`‰X&ÇcåX5V5cX7vÀžaï$‹€ì^„Âl‚GXLXC¨%ì#´ºW ƒ„1Â'"“¨O´%zùÄxb:±XF¬&î!!ž%^'_“H$É’äN !%2I IkHÛH-¤S¤>ÒiœL&ëmÉÞä²€¬ —‘·O’ûÉÃä·:ňâL ¢$R¤”J5e?奟2B™ ªQÍ©žÔªˆ:ŸZIm vP/S‡©4uš%Í›Cˤ-£ÕКigi÷h/étº ݃E—ЗÒkèéçéƒôw † ƒÇHb(k{§·/™L¦Ó—™ÈT0×2™g˜˜oUX*ö*|‘Ê•:•V•~•çªTUsU?Õyª T«U«^V}¦FU³Pã© Ô«Õ©U»©6®ÎRwRPÏQ_£¾_ý‚úc ²†…F †H£Tc·Æ!Æ2eñXBÖrVë,k˜Mb[²ùìLvûv/{LSCsªf¬f‘fæqÍƱàð9ÙœJÎ!Î Î{--?-±Öj­f­~­7ÚzÚ¾ÚbírííëÚïup@,õ:m:÷u º6ºQº…ºÛuÏê>Ócëyé õÊõéÝÑGõmô£õêïÖïÑ7046l18cðÌcèk˜i¸Ñð„á¨Ëhº‘Äh£ÑI£'¸&î‡gã5x>f¬ob¬4ÞeÜkVyVõV׬IÖ\ë,ëmÖWlPW› ›:›Ë¶¨­›­Äv›mßâ)Ò)õSnÚ1ìüì ìšìí9öaö%ömöÏÌÖ;t;|rtuÌvlp¼ë¤á4éĩÃéWgg¡só5¦KË—v—Sm§Š§nŸzË•åîºÒµÓõ£›»›Ü­ÙmÔÝÌ=Å}«ûM.›É]Ã=ïAôð÷XâqÌã§›§Âóç/^v^Y^û½O³œ&žÖ0mÈÛÄ[à½Ë{`:>=eúÎé>Æ>ŸzŸ‡¾¦¾"ß=¾#~Ö~™~üžû;úËýø¿áyòñN`Áå½³k™¥5»/ >B Yr“oÀòùc3Üg,šÑÊZú0Ì&LÖކÏß~o¦ùLé̶ˆàGlˆ¸i™ù})*2ª.êQ´Stqt÷,Ö¬äYûg½Žñ©Œ¹;Ûj¶rvg¬jlRlc웸€¸ª¸x‡øEñ—t$ í‰äÄØÄ=‰ãsçlš3œäšT–tc®åÜ¢¹æéÎËžwç|þü/÷„óû%ÒŸ3gAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFIDATxÚbœ8q"“4Ó»LÛG§žŸüÿÿb˜7wžÃÛïoÿ{¯÷øÿÿbLMI5¾çqû 3#3# ##ƒç·ÿb,b /_¾dÿÿD»ÿ”””®¹®Î4>3‹sÂqÿK¯Hÿ¿ã¾ÿ&B%ôG®DÿÏéÎÿE¬BÿEšBÿ þ €Å ÃÁfÄÿÿ„{ÿŽŽŽ ³ÌËLÎéÍë ­e¯\v[Ë@«=ÿÿÿÿÿ;¨7ÿÏêÏÿÓëÒÿG­Dÿ?†=ÿ¶¥·¾  ºá¹ÄWÈ×íÕzÅxôÞô4óQ îÏð׫؀øõø÷þ‘‘‘ ‘ýüTÉËÉæ–—^ûüû×ûùû!M ÷ŒÐ‹ýóü(V¶SÖÀp¨åÖæY3ò†Í„PQ/x.X)ÌË+,DE±O´ªÚ© ˜ëôêäôãCD®N±O±Löüöÿÿÿ ðÒññùð/0ÏêÎ45ÿÿýðàï© „>“<{ø ÷   çûæÞ›àÕ¯Öûúû¾å¼æ ? éÙéÙ˜Û÷Ü¾Ý ÿL‘;hq‡¿ïr¹\MDÑ31!ñ‘¢õ1ˆv$¥ qp\´£RªqÔ€(âà XBÁÁÍ¢(ݵ jEAh¡K;”¦­MÀ&ZcÞ—\îÎÁçoþ–ïû‰L&ƒëº„Š„îïîRQZ¬.Rlh;m4¥ÕVYú’í|züùAi­tèˆôÍ4zXëKÆS“__’«æðÉ>ÄßÀvm,Ç~9@}®ÎÌøì½êfí–?ÓÏîH½XyŽåX×OPíT±ì–cᕽÜ9y—im?ÌÛüÞ°‚×£&~d+²=yRTÌ »´ ™¡qÚ¶ÉüÆ<qíØuŒ–ÁÈ»ËL­½ÆÓã¡GÈšDm©êY™[ýf–MY¡ÐXgac‹ýü:÷£i04™ õá*–c¡HÊ/'!èÖºtjíu!Gž90³ç|ÌGÈ%è ‘Œ%‰úcìÛºŸ`o†Õ`äýŒFÅ祹Üdybµž›Íü)%v&¢§"ô„޶ׇðÇÁvm Û2­¼‰1]"÷1ÿ¬¶Y»8ÿRÿž@ô©~uXÛ¦ *[” .têíb³Üš6ëæS7û?ÿs±€–|Õ¹ìÍIEND®B`‚php-irods-3.3.0~beta1/web/images/file.gif000066400000000000000000000002471221272161600201700ustar00rootroot00000000000000GIF89a³ÿÿÿÿÿççÖÿÿÿÿ÷÷÷ÌÌÌËËË™™™†††UUUÿÿÿ!ù ,T©Ik2˜ÉÁ{OK&dY&E¨)¦`‚˲’é–"$>ÓŽÕûoCRÀÄL–nÉ ¨¹–¿Ô¬gÊjy._Pê,HÍÂ-³¹:¸ßp÷.F¯Û;php-irods-3.3.0~beta1/web/images/file.png000066400000000000000000000004661221272161600202120ustar00rootroot00000000000000‰PNG  IHDR‘h6gAMA± üaíIDAT8Ocüÿÿ{{;n ,,‘çàà`jhkk{þü.4sæÌÐÐÐï`T Õdá@ @)ˆb5UCІîU¯ ¨~áËœ)Ï“úžù5>q«~bWöزèÑéÓ§±hXtèÿ¬½'lýݲúgíò…s¿fÍüš:õ³aêYˆ«°ØÐ²ôeÞôçamO½jAC~Ò ,¦-Ý…æï?þƒÐ‡ÿ¦žÉX4L^´d#€¨~ðâ> pKઠkh@aÂø.àÑt+.„ÅÓxRD %ÎàI… h½Žò¸u¸±IEND®B`‚php-irods-3.3.0~beta1/web/images/folder-upload.png000066400000000000000000000014041221272161600220210ustar00rootroot00000000000000‰PNG  IHDRóÿa pHYs  šœgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFzIDATxÚbüÿÿ?% €˜(D±Ä"nm5½ÀÁ§¥ÅȈlÞ†ŸŸï>þûçƒ%óE#˜üªîsù@ `üϤ!k3Ÿ•‘‘¤¬™ÈþóãÒË ÿCEA€™ïÿÿ¿¿_}y¾¯È]@`þüÿÁðïûÏÓþþbf``âêçeàrf2ëdcô? 1ÿÀ†32ñHÜÞdS2 € üfdúÿïP3Pí¿ÿ ÿ¾?bøýõ%×WX9$z~õÿšód¯F9H¡ìaøÿ÷#Ãÿ?&)¨AµªU|NPñ¡«×¯*ø” ÂƒÙ³hU¨ ¤ƒ  8` -` „᢯߿z ;php-irods-3.3.0~beta1/web/images/folder14px.gif000066400000000000000000000010211221272161600212300ustar00rootroot00000000000000GIF89ap!ù_,†É”5Ë—3Ç“/Ö®bß¿€Þ¿ݽkݽdÂŽ*¿/Ξ@Ý»ríÛ©íÛíۆ̡J¼ˆ$¸† ¶‚´€°~¯Ç—/Õ«YñäÅñä¾ðâÆæÓ­åÒ¬äЫãЪ»;ÏIJְRÿÿ³ÿÿµ¾™9ÉöÇ/Õ¯Iÿÿ™º•/ÆÀ³Ó­Hÿü–ÿ÷’¸’,Æ¿³¿'ѪEÿø’ÿ솶*Å¿²Ï¨Cÿóÿá{´)·‡'̦AÿðŠÿ×r³'¿*Ù4ЫEΟ9Íž8Ëœ6É™4Ç—2Å–0Ô.Â’-À›5µŸiÍÊÆ¯ì{Ç»¡Ä·žÃ·Â¶œÁµ›Á´›À³š¿³™¿²™ÊÇÁÐÐÐÔÔÔÏÏÏÇÇÇ¿¿¿n€_‚ƒ„…†‡ƒˆ_  ‡™ ‚$¤¥#¥*&_()­®¯©«)33..4)¸)ª734ÀÁÀ)N½49ÈÉÈ4:^_7Ç>ÒÓ>ÄP‚7Ú*'*O\ƒPPTçèTYކ;php-irods-3.3.0~beta1/web/images/folder_add.png000066400000000000000000000012341221272161600213500ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<.IDAT¥ÁÍ‹MaÇñïsæÌu”;D&n#¡É ™1…†FØIù ¤¬¥$SJ) ÄNÈÆÊÆJbAÔwÉä%/ƒáº÷Üy»÷œçy~Î)E6Ô|>FÓ0MÓ’yu}í£¨eÅ c~±×œ­®üÉ›X¾í© É‹ú.6c@dÆ`ëß—~}tôƒ@üÒTh‘\::þyð p9$gUÇ'3_Îá’&Z0¦HTÚLi݉àA&˜µ`øjßàrH.5|‚K È ?õžtâ+ã£whŽ‚Rð ’,ÅŽCä“ ÉEÞN‘L‚’ ұŎDó:ð „sÀ!™\ÎleNçnÀƒ„ðøä¶z ¹ÙÙrãDm‡¡!r!¹T’«ã'Ÿ #7†lŸV‹ÁV®p÷#žš"µûé \Ø„äHÞâÓoÈÆÈÅÈV‘‘«pãe…§õ"›6®¡mn;·Ÿ_áÞ³‘ðRéT@.‘ ÙÈ–QúÙ2²ed+\{QeuG7.pt/ÜŠ3)½«6ÙQâ+v²§ão'‹ØÆ|\Ò†wËðn%£µ2ÍfÛ;÷‘;°ùËZ»ÈD!Õ'ߜ߱±C‘¿Ôj•èùÈ} 1°õ"Çoî"jšA¦n$ñ/½ý¥cmKfÞÐÕGû‚†¿<äþ“!>¾OIüÞþÒq`PÆ€³ÎŒ üÿs-û·ðëMIEND®B`‚php-irods-3.3.0~beta1/web/images/folder_up.gif000066400000000000000000000020311221272161600212210ustar00rootroot00000000000000GIF89a÷y®€ŒŒmX—X+‰);‘:ƒ D’@L“I ¬1©(8Š2a˜]€°}*€"d¬]§‚5‹+,ƒxÆk—·’/³,ª§À¢*•8·7ªIµ/Dœ.:¬3’=°9ŸW¼8gÍGG¶!C‰+jÚFhÓDnÞHwçPiÍI@ªL» i×>oÝCU¤5xçN^¯?uâGkÊ@n¾Ma¤Cy¨eP´ V¿&M&oÖ>uÁOb¼2KŠ+bÃ)Y•6iÂ/pÊ7±Knª,e™ޝM–¸WЍ9£®eÇÑsþÿŽþÿ™þþŽþþ’þþ•ÿÿ˜ÿÿšÿÿ›ÿÿŸÿÿ¡ÿÿ¨ÿÿ®ÿÿ³ÿÿ¼ÿÿ¿ÿÿÃÿÿÇÿÿÎÿÿçéåúùÍùó•ÿúœÿû¤ÿ÷‘èâ˜ÿûÎþôŒøôÏÿðþò’÷î¦ÿ÷¼ðÚ\ëÚ€ÿíŒÿíšÿò³Ó¶9Õ¸;ÿäzÿç€ÿç„òá›÷ç¦õÒZõ×føÛjÿßnùÛlúÝoÿå„îÚ“öíËСܱ/ÞºCçÆ[ß¿]ÙºZÜÁmèÏzäÌêÕ’êÖ˜ìݪúòÙÏšÍšÍ›Λ РÖ¦Úª!Ü®&Ú¬'Ѧ'å¹5å¸=Ö¯;ر>Ô­=ݶBìÃHÙ²DîÃLݶLÛ·LòÈUã¾OݸMíÅTá½XèÇjçÈmÿÜyà±8ïÂPß·PõÊ[îÇfûÓoæÃgæÄkæÇzóÆ]ðσÿâ¤÷³1óÒ“ýâ²þتÿÿÿÿÿÿ!ù¾,ö} è+‚F° †„7`Ð! ˜áÄŽ :@<@D€/†ØAa_©hÅ‚€D~ 8*.gtñZB¢… Mayå 7jn¨Hq$—¥F…¨8™"¥Š•>FVÀÀ±ëQ§Oqìüáã® 1jHè%h!@¶f­2è‹=rô"å ,UaºhÉ"† fðLòUI£-M¢XIRâ2oRª•g š2`d4(²"nµ©s JöèÙ”H`$ErXÉ*EgŽ«WžN ÌäHÓ¥V‡BAô%‰Ó¢é;php-irods-3.3.0~beta1/web/images/leaf.gif000066400000000000000000000016611221272161600201610ustar00rootroot00000000000000GIF89a‡5Ic6Jd/bÈ1eÍ9râ>vã@vãF{äJ}ã@ÿ@NäV†åX‡åbŽæl”çn—çe•ój™õv›èzŸéqõ¡éw¢ö}§ø€€€“¢·–¥ºš©¾ž®Ã„¥é†¦ê‹ªê„«ù‹°úµû–¹üš½ý£²È§¶ÌŸÀþ¢ÂÿÐàðààðàèððððððÿðøÿÿøÿÿÿÿ!ù ,ŽH° ÁƒA(ñÁ„,@` €@)P” 1BD *Hˆ@à¢B 8`à@—žˆA³fÍ/\h"€Ÿ?iâtÁ"€À6oædQT ‡š¢JºÂ¨‚ ImµªÁ'PB—rÍc(Ó±4§N­*°«M9[°X¡‚k€»xóâEÈ7 ;php-irods-3.3.0~beta1/web/images/leaf14px.gif000066400000000000000000000010341221272161600206700ustar00rootroot00000000000000GIF89ap!ù|,†Ÿß‹§ç‡§çŸçw›çk“ç_‹ãSƒãG{ã?wã7sß?_߬쓳ò‘±ñŽ®ñ‡©ð¤ïtœîi–ì`ëW‰êOƒé;rÞ7o׎­ì–µô‘²óŠ­ò§ñx ðl—ïb‘íYŠìS‡ëP„ë8kÓ/_Ç—¯Ïª½ßÓß÷ÒÞ÷ÏÜ÷ÊÙöÄÕö¿ÑõºÍô²Éô«Æô«ÃôRo¥7OŸ¯Ç»Æ×···@@@ÿÿÿüýÿòùÿðõÿèíøar‡7G_Ÿ¯¿¶ÂÒóóóßßßýþÿñùÿéíøáèñ`q†—§¿³¾ÎºººŽÂÃÍ`o†—§·¯ºÊççç¿¿¿þþÿ÷ûÿð÷ÿíñýcr‰Ÿ·®¹ÉÃÃÃ```þÿÿíñüäêôØØØÀÀÀ¿¿À¸¼À¸»À´¶¼ÎÒÛ`p†áááÏÏÏÏÌÏÆÊÏÆÆÍÂÄÆ¼¾ÆÌÒà]o†‰—¬hwŠhuŠduŠds‰br†?Sl¿¿Ÿ??y€|‚ƒ„…†‡|Š## ‚ŒŽ’#&‚(GG,,--//113‚o@8®899EXXP«BC¹C²´Gs«±KNÃÄoq‚[BKbKK±¼¶|[K]Õ]±´BÇÒ±CÌÍK@gÛ[ÝkçOOKã‚rsïðqsqq?ˆ‡;php-irods-3.3.0~beta1/web/images/loading.gif000066400000000000000000000014031221272161600206610ustar00rootroot00000000000000GIF89a³ ª¨ ‘ކ›“·µ­›’·µ¬†ª¨ŸÃÁ¹ÐÎÅwul„‚yÿÿÿ!ÿ NETSCAPE2.0!ù ,OÉÉŒ¡˜{³³Y̲`’¦I¥D8µç+SîÞ¤(ŒƒðÐûý†D(ìI~” “H` Òé¤ZfƒkNÃáqÙƒ;'éL!ù ,NÉÉ¡˜ {³@Å1†èQ]AiN©:µå)SõT Þ´,ŒÂŽçùý„bÆÜõ$? ‘Q(0Ó)Åj•f‰ƒ{õ‚Ãân-~Nž!ù ,MÉÉΡ˜Úò,Eeu‚€ È”%5¼EÌöf3… ތݮg(„<ÑL™“D"³X`¤RJµJÁN ÆÖÚý‚ÃÜÞ9Ü£€=!ù ,NÉÉJ¡˜Z›'BÌ Ìq`ß’æP)8µ/,S&•$Ý$ŒÝ®÷û y‚’Dö”…"`¤RŠakˆb‹ƒÛõ‚Ãâmï^SÚ™!ù ,MÉÉ¢˜Z›gJÕÆ ö}áH–ÞI « b$¥(ÝtÌ}ç»× ò~9@Y,2Æé¤¢Ò õi00®‚¬–Û |Å™®Áœœt;!ù ,MÉÉR¢˜Z›§RÕÆ ö}áH–ÞI­l›‘Ô²tÓP0¶ºBïÖv>CG12‡ÆiP¢Ñ¦ÓJ0°R-ƒÐõJ²À«œt;!ù ,MÉÉ”¢˜Z›çZÕÆ$ ö}áH–ÞI­l›‘”at‚0¶ëºÞ­Ü8‰ŽB dL³IB)‚¬€q80 à&Ët½à¤¹›¤°3;php-irods-3.3.0~beta1/web/images/new-window.gif000066400000000000000000000002121221272161600213370ustar00rootroot00000000000000GIF89a ³ÔÐȾº´ÿÿÿÌÌÌfff;;;111%%%ÿÿÿ!ù , 7pÉUª½“ŽÍwÉ"Žâ7Bª¦‡áºëÚt«m Û·p €b8ü€¤òÞ˜§ž¯y¬f";php-irods-3.3.0~beta1/web/images/page_white_add.png000066400000000000000000000010001221272161600222000ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<’IDAT8Ë•“»KÃPÅ[ÿ‘‚‚8ˆ‹‚Vê"¸ÁÁApj‹¨“ƒ““‹[­JS,¸889U¤`íèà(ZüRú¢Ïô­ÇœKSÓ·ýàprÏ/ßw’k`PkR•Y•eˆ¦UÑ£ÉИ+•J¶^¯7 ô’ú>Ÿïª¢,4‹E(ŠÒR.—C&“A<X,I’Ú ,#ÜP.—Q­VÅJ d³Y$ (•JàK€€thÖD ù|Éd²k¤f&Æ6€:Fk¯9·6J*•ȲÜÐ)=„0t:ý€Âq˜ A#¨Z­&r!„À.Bo8 ذw±û™«ŽÙ›š4_ïqò`ÇST»†÷ʼn-ïå¡_Z?^D(z }=~H@øé—ÁÚá Üa\a›0»žm4Çe5eEÝÜó0ùƒ§ØôÌá<¼#ÞÌ•÷"ƒ&`ŠAGya{üÎâ4)l›ë’}ÂOï/‡¶¯ÂÆ!&RIEND®B`‚php-irods-3.3.0~beta1/web/images/page_white_get.png000066400000000000000000000010041221272161600222330ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<–IDAT8Ë•“MKQ†µMÿ!Zµ¨ ÉÆM¶ Û­[Û.‹PladdF  †«öµqÑ¢@ úm¿ðsƵÞî5?ºð0sßçžs†« ak’a`‡0Å£Œ‚¦%0ˆ¢Xl4ßÍfÁ¾# º%ŠÀHájµ žçÛ”J% ¤ÓiY’J¥ …:$´´$  µZ ’$ÉO¢R© X,"“ÉÈA@‡D"YÒ# ° (P.—‘Íf{ZjÍDÛ!`m´7Ð;õ­´’ËåäJ’ÉdA7j UBóÈçó£ Ôj‡fB¢ ˆz½.Ï…$Ä¿T ¼‰CœÆ]£ (¤@¸ãN¸p>ìÂÝ]P8c6Äì¸þ #òÀÖ+Þ¥/Î>?>ô/ø'°ÜnÀqgÅÕ»7lQ+LGœÄíëïÕ‚ŸAsX¯Âÿzß‹k—fè̛껰Ȇij}/“ùbgÏÇð<¹°°7G!ƒZ #É «lrs`%CoŸÅÌö4…t”ýQñ¤ÇЛ1ÃIEND®B`‚php-irods-3.3.0~beta1/web/images/s.gif000066400000000000000000000000531221272161600175060ustar00rootroot00000000000000GIF89a€ÿÀÀÀ!ù,D;php-irods-3.3.0~beta1/web/images/square.gif000066400000000000000000000015401221272161600205460ustar00rootroot00000000000000GIF89a ‡e“ÏÆÜùÉÞùËßúÎáúÑãúÔåú×çúÙèûÜêû!ùÿ, =HP`‚ƒ DÀ°aC"J”(ЀŋØÈ‘£@ C†8 ¤I“¨\¹R`€—0aœ ;php-irods-3.3.0~beta1/web/images/table.png000066400000000000000000000010661221272161600203570ustar00rootroot00000000000000‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ÈIDAT8Ë¥SÍ+DQÿ½ß,È̲‘ä›Ò4bAYXJ‘,í­Ä¢”(JìX(d"E)‰X(3“o™æÝç¾Ç{odANÝwî¹ïœßùÝsÎÕ¤”ø˜ê3·õ8I8c\Š2!¸˜Ò\í%ioqp&é\ìÏŒT†m!åø@¸ ø/™§Î\„f¯\ÌRfFY,Ò·nîßQÊÁåí«ûjK3í ¿!…¯ rgzþ¬)ÅEžê¯ZœêbÙ‡ý8L/ÉU¥µÿ>ç¿”(puMÑIEND®B`‚php-irods-3.3.0~beta1/web/images/upload.png000066400000000000000000000017141221272161600205540ustar00rootroot00000000000000‰PNG  IHDRóÿa pHYs  šœgAMA±Ž|ûQ“ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFBIDATxÚbüÿÿ?% €X@ĤI“ÀVVVNvN9~a¾d·/L_Þ~|óÿÆ•wo:¼ãú™ó€>‡iY@Œ bòäÉ ÿüeД֕šøåèõ×^}{Åðù9ø˜°0\ÝvõÙ‰ù§²¾}ú¶f@]ðõËW>¾!CÁ…[Þobºúú ß¿þ320üý÷—‰‘‰“•“AÜMLÊ”ÑdÕ‰™'Ã~ÿ¹¤ €À¼~õZQÊL²kÏûÝL—^^dàfáfÈ7Ìb`d¸õþÃÃOî}¼Çðæçk~c>6ys¹Þ[nŸj}@`~²üŒÄõPòÆ‹ë Ì ÿðÝ· Š|Š *A ‚@ƒÞ|ÍP|¨á5 j (qžæˆjí &ßx¿¹Üÿqèb°sA`ÎåÙ å‡Kn¿¿æ‹pŠ2HsË0üeúÃÀ%ÏÉÀ-Æã  °ê,?þúÔÌ Vüëï/AA†ó:3 s†Ýw1|ÿóA‚[6XY8øÙ•@jlÀûïÿÿÿ÷èF°f^v>†z‹FsI †å7–2L8ßËðù×'^pÈmb;lÀëk¯ï2þd`ø„¢@§6Z41Š1,¹¾˜aΕ٠¿1råí†~2°°°0üzû‹áû; Ÿ €ÀøäÜÓ’·$ìþ©ÿe0•4gÐÑeXpmØ6f6p¸L8×ÇÀ´™ý;Ûëï¾¾þº¤ €À ‰‘‘QZÑZñˆr¬¢‚°’0ƒ›ÃÍ·7@âð@Å ×K_n.¾}÷ùµçÖ@½/ˆš*Ÿ>9õ¤ˆ…ƒeÅ_¿¿läß1°r°Sد ›ÿÿùÏðåê7†‡›ýx}ëU!Pæ%H#@Á\ɬ¬>ZbÓ$¬Äeù4øXùYÁ½ùÅðñæ'†'_>|uóUæß¿·Ã’2@¡â\±<â iRods Rich Web Client

RODS Browser

 

Sign on to iRods

php-irods-3.3.0~beta1/web/login.js000066400000000000000000000054051221272161600167640ustar00rootroot00000000000000 function generateLoginForm(formid, host, port, user, pass, fzone, init_path, errmsg) { var loginform = new Ext.form.Form({ labelWidth: 70, // label settings here cascade unless overridden labelAlign: "right" }); loginform.fieldset( {legend:'Account Information'}, new Ext.form.TextField({ fieldLabel: 'Host/IP ', name: 'host', width:175, value: host, allowBlank:false }), new Ext.form.TextField({ fieldLabel: 'Port ', width:175, name: 'port', value: port, allowBlank:false }), new Ext.form.TextField({ fieldLabel: 'Username', name: 'user', value: user, allowBlank:false, width:175 }), new Ext.form.TextField({ fieldLabel: 'Password', name: 'pass', width:175, value: pass, allowBlank:false, inputType: 'password' }), new Ext.form.TextField({ fieldLabel: 'Zone', name: 'fzone', width:175, value: fzone, allowBlank:false }) ); if ( (errmsg!=null) && (errmsg.length > 1) ) { document.getElementById('form-login-err').innerHTML =errmsg; } /* Lisa Stillwell removed this 020811 to add explicit text entry for Zone if ( (init_path!=null) && (init_path.length > 1) ) { loginform.add( new Ext.form.TextField({ fieldLabel: 'Go to Path', name: 'init_path', width:175, value: init_path }) ); } */ loginform.on("actioncomplete",function(form, action){ window.location = "browse.php#ruri="+action.result.ruri_home; //alert ("result: "+ action.result.ruri_home); }); loginform.on("actionfailed",function(form, action){ if ((action.result!=null)&&(action.result.errors!=null)) document.getElementById('form-login-err').innerHTML = "Attempt Failed: "+action.result.errors; }); loginform.addButton('Sign On', function(){ //loginform.submit({url:'load-form.php'}); /* var fields=loginform.getValues(); var str=""; for( var key in fields ) { str=str+key+":"+fields[key]+" \n"; } alert("you entered: \n"+str); */ var targeturl='services/login.php'; /* Lisa Stillwell removed this 020811 to add explicit text entry for Zone if ( (init_path!=null) && (init_path.length > 1) ) targeturl=targeturl+"?init_path="+init_path; */ loginform.submit({url:targeturl}); }, loginform); loginform.render(formid); } php-irods-3.3.0~beta1/web/logout.php000066400000000000000000000002241221272161600173320ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/mimetype.inc.php000066400000000000000000000125171221272161600204320ustar00rootroot00000000000000 "application/andrew-inset", "hqx" => "application/mac-binhex40", "cpt" => "application/mac-compactpro", "doc" => "application/msword", "bin" => "application/octet-stream", "dms" => "application/octet-stream", "lha" => "application/octet-stream", "lzh" => "application/octet-stream", "exe" => "application/octet-stream", "class" => "application/octet-stream", "so" => "application/octet-stream", "dll" => "application/octet-stream", "oda" => "application/oda", "pdf" => "application/pdf", "ai" => "application/postscript", "eps" => "application/postscript", "ps" => "application/postscript", "smi" => "application/smil", "smil" => "application/smil", "wbxml" => "application/vnd.wap.wbxml", "wmlc" => "application/vnd.wap.wmlc", "wmlsc" => "application/vnd.wap.wmlscriptc", "bcpio" => "application/x-bcpio", "vcd" => "application/x-cdlink", "pgn" => "application/x-chess-pgn", "cpio" => "application/x-cpio", "csh" => "application/x-csh", "dcr" => "application/x-director", "dir" => "application/x-director", "dxr" => "application/x-director", "dvi" => "application/x-dvi", "spl" => "application/x-futuresplash", "gtar" => "application/x-gtar", "hdf" => "application/x-hdf", "js" => "application/x-javascript", "skp" => "application/x-koan", "skd" => "application/x-koan", "skt" => "application/x-koan", "skm" => "application/x-koan", "latex" => "application/x-latex", "nc" => "application/x-netcdf", "cdf" => "application/x-netcdf", "sh" => "application/x-sh", "shar" => "application/x-shar", "swf" => "application/x-shockwave-flash", "sit" => "application/x-stuffit", "sv4cpio" => "application/x-sv4cpio", "sv4crc" => "application/x-sv4crc", "tar" => "application/x-tar", "tcl" => "application/x-tcl", "tex" => "application/x-tex", "texinfo" => "application/x-texinfo", "texi" => "application/x-texinfo", "t" => "application/x-troff", "tr" => "application/x-troff", "roff" => "application/x-troff", "man" => "application/x-troff-man", "me" => "application/x-troff-me", "ms" => "application/x-troff-ms", "ustar" => "application/x-ustar", "src" => "application/x-wais-source", "xhtml" => "application/xhtml+xml", "xht" => "application/xhtml+xml", "zip" => "application/zip", "au" => "audio/basic", "snd" => "audio/basic", "mid" => "audio/midi", "midi" => "audio/midi", "kar" => "audio/midi", "mpga" => "audio/mpeg", "mp2" => "audio/mpeg", "mp3" => "audio/mpeg", "aif" => "audio/x-aiff", "aiff" => "audio/x-aiff", "aifc" => "audio/x-aiff", "m3u" => "audio/x-mpegurl", "ram" => "audio/x-pn-realaudio", "rm" => "audio/x-pn-realaudio", "rpm" => "audio/x-pn-realaudio-plugin", "ra" => "audio/x-realaudio", "wav" => "audio/x-wav", "pdb" => "chemical/x-pdb", "xyz" => "chemical/x-xyz", "bmp" => "image/bmp", "gif" => "image/gif", "ief" => "image/ief", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", "jpe" => "image/jpeg", "png" => "image/png", "tiff" => "image/tiff", "tif" => "image/tif", "djvu" => "image/vnd.djvu", "djv" => "image/vnd.djvu", "wbmp" => "image/vnd.wap.wbmp", "ras" => "image/x-cmu-raster", "pnm" => "image/x-portable-anymap", "pbm" => "image/x-portable-bitmap", "pgm" => "image/x-portable-graymap", "ppm" => "image/x-portable-pixmap", "rgb" => "image/x-rgb", "xbm" => "image/x-xbitmap", "xpm" => "image/x-xpixmap", "xwd" => "image/x-windowdump", "igs" => "model/iges", "iges" => "model/iges", "msh" => "model/mesh", "mesh" => "model/mesh", "silo" => "model/mesh", "wrl" => "model/vrml", "vrml" => "model/vrml", "css" => "text/css", "html" => "text/html", "htm" => "text/html", "asc" => "text/plain", "txt" => "text/plain", "rtx" => "text/richtext", "rtf" => "text/rtf", "sgml" => "text/sgml", "sgm" => "text/sgml", "tsv" => "text/tab-seperated-values", "wml" => "text/vnd.wap.wml", "wmls" => "text/vnd.wap.wmlscript", "etx" => "text/x-setext", "xml" => "text/xml", "xsl" => "text/xml", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", "mpe" => "video/mpeg", "qt" => "video/quicktime", "mov" => "video/quicktime", "mxu" => "video/vnd.mpegurl", "avi" => "video/x-msvideo", "movie" => "video/x-sgi-movie", "ice" => "x-conference-xcooltalk" ); ?>php-irods-3.3.0~beta1/web/services/000077500000000000000000000000001221272161600171355ustar00rootroot00000000000000php-irods-3.3.0~beta1/web/services/delete.php000066400000000000000000000037561221272161600211230ustar00rootroot00000000000000 false,'errmsg'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $files=array(); $dirs=array(); if (isset($_REQUEST['files'])) $files=$_REQUEST['files']; if (isset($_REQUEST['dirs'])) $dirs=$_REQUEST['dirs']; if ( (empty($files))&&(empty($dirs)) ) { $response=array('success'=> false,'errmsg'=>'No files or collections specified'); echo json_encode($response); exit(0); } $force_delete=false; if (isset($_REQUEST['force'])) $force_delete=true; try { $parent=ProdsDir::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($parent->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $parent->account=$acct; } if (empty($parent->account->zone)) { $parent->account->getUserInfo(); } $num_files=0; foreach ($files as $filename) { if (strlen($filename)>0) { $myfile=new ProdsFile($parent->account,$parent->path_str.'/'.$filename); $myfile->unlink(NULL, $force_delete); $num_files++; } } $num_dirs=0; foreach ($dirs as $dirname) { if (strlen($dirname)>0) { $mydir=new ProdsDir($parent->account,$parent->path_str.'/'.$dirname); $mydir->rmdir(true, $force_delete); $num_dirs++; } } $response=array('success'=> true,'log'=>"$num_files files and $num_dirs collections deleted!"); echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> $e->getMessage(), 'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/dir_grid.php000066400000000000000000000077401221272161600214410ustar00rootroot00000000000000account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { $arr=array(); $arr['success']=false; $arr['errors']=array(); $arr['errmsg']="Please sign-on to access this collection/file"; $arr['errcode']=RODSException::rodsErrAbbrToCode("USER_AUTH_STRING_EMPTY"); $str= json_encode($arr); echo "($str)"; exit (0); } $collection->account=$acct; } $start= (isset($_REQUEST['start']))?$_REQUEST['start']:0; $limit= (isset($_REQUEST['limit']))?$_REQUEST['limit']:500; $sort= (isset($_REQUEST['sort']))?$_REQUEST['sort']:'name'; $dir= (isset($_REQUEST['dir']))?$_REQUEST['dir']:'ASC'; if ($dir=='ASC') $dirbit=true; else $dirbit=false; $orderby=array("$sort" => $dirbit); listFileJson($collection, $start, $limit, $orderby); function listFileJson($dir, $start=0, $limit=500, $orderby=array()) { $arr=array(); $arr['totalCount']=0; $arr['que_results']=array(); $arr['success']=true; try { //$dir=ProdsDir::fromURI("rods://rods.tempZone:RODS@rt.sdsc.edu:1247/tempZone/home/rods", false); $arr['totalCount']=0; $childdirs=$dir->getChildDirs($orderby); $arr['totalCount']=$arr['totalCount']+count($childdirs); foreach ($childdirs as $childdir) { $childstats=array(); $childstats['id']=$childdir->stats->id; $childstats['name']=$childdir->stats->name; $childstats['size']=-1; $childstats['fmtsize']=""; $childstats['mtime']=$childdir->stats->mtime; $childstats['ctime']=$childdir->stats->ctime; $childstats['owner']=$childdir->stats->owner; $childstats['type']=0; $childstats['ruri']=$childdir->toURI(); $arr['que_results'][]=$childstats; } $totalcount=0; //$childfiles=$dir->getChildFiles($orderby,0, -1, $totalcount, true); $childfiles=$dir->getChildFiles($orderby); $arr['totalCount']=$arr['totalCount']+count($childfiles); foreach ($childfiles as $childfile) { $childstats=array(); $childstats['id']=$childfile->stats->id.'_'.$childfile->stats->rescname; $childstats['name']=$childfile->stats->name; $childstats['size']=$childfile->stats->size; $childstats['fmtsize']=format_size($childfile->stats->size); $childstats['mtime']=$childfile->stats->mtime; $childstats['ctime']=$childfile->stats->ctime; $childstats['owner']=$childfile->stats->owner; $childstats['rescname']=$childfile->stats->rescname; $childstats['num_replica']=$childfile->stats->num_replica; $childstats['typename']=$childfile->stats->typename; $childstats['type']=1; $childstats['ruri']=$childfile->toURI(); $arr['que_results'][]=$childstats; } $_SESSION['acct_manager']->updateAcct($dir->account); $arr['que_results']=array_slice($arr['que_results'],$start,$limit); $str= json_encode($arr); echo "($str)"; } catch (RODSException $e) { //echo ($e); //echo $e->showStackTrace(); $arr=array(); $arr['success']=false; $arr['errmsg']=$e->getCodeAbbr().":".$e->getMessage(); $arr['errcode']=$e->getCode(); $str= json_encode($arr); echo "($str)"; exit (0); } } function format_size($rawSize) { if ($rawSize / 1099511627776 > 1) return round($rawSize/1099511627776, 2) . ' TB'; else if ($rawSize / 1073741824 > 1) return round($rawSize/1073741824, 2) . ' GB'; else if ($rawSize / 1048576 > 1) return round($rawSize/1048576, 2) . ' MB'; else if ($rawSize / 1024 > 1) return round($rawSize/1024, 2) . ' KB'; else return round($rawSize, 1) . ' B '; } ?> php-irods-3.3.0~beta1/web/services/dir_tree.php000066400000000000000000000056311221272161600214500ustar00rootroot00000000000000account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { $arr=array(); $arr['success']=false; $arr['errmsg']="You don't have permission for this directory! Please sign-on"; $arr['errcode']=-99; $str= json_encode($arr); echo "($str)"; exit (0); } $collection->account=$acct; } $recursive= (isset($_REQUEST['recursive'])&&($_REQUEST['recursive']=='1'))? true:false; try { listChildDirJson($collection); } catch (RODSException $e) { $arr=array(); $arr['success']=false; $arr['errmsg']=$e->getMessage(); $arr['errcode']=$e->getCode(); $str= json_encode($arr); echo "($str)"; } function listChildDirJson($dir) { $arr=array(); $childdirs=$dir->getChildDirs(); foreach ($childdirs as $childdir) { $childstats=array(); $childstats['id']=$childdir->getName(); $childstats['text']=$childdir->getName(); $childstats['leaf']=false; $childstats['cls']='folder'; $arr[]=$childstats; } $str= json_encode($arr); echo "($str)"; } function print_r_html($data,$return_data=false) { $data = print_r($data,true); $data = str_replace( " "," ", $data); $data = str_replace( "\r\n","
\r\n", $data); $data = str_replace( "\r","
\r", $data); $data = str_replace( "\n","
\n", $data); if (!$return_data) echo $data; else return $data; } class ProdsDirTreeNode { public $dir; public $children; public function __construct(ProdsDir $dir) { $this->dir=$dir; $this->children=array(); } public function expandChildDir($path_str) { $children_prods_dirs=$this->dir->getChildDirs(); foreach($children_prods_dirs as $children_prods_dir) { $this->children[]=new ProdsDirTreeNode($children_prods_dir); } if ($this->dir->path_str==$path_str) return; foreach($this->children as $child_node) { if (0==strncmp($child_node->dir->path_str,$path_str, strlen($child_node->dir->path_str))) { $child_node->expandChildDir($path_str); } } } public function toArray() { $ret_val=array(); $ret_val['id']=$this->dir->getName(); $ret_val['text']=$this->dir->getName(); $ret_val['leaf']=false; $ret_val['cls']='folder'; $ret_val['childNodes']=array(); foreach($this->children as $child) { $ret_val['childNodes'][]=$child->toArray(); } return $ret_val; } } ?> php-irods-3.3.0~beta1/web/services/download.php000066400000000000000000000114231221272161600214560ustar00rootroot00000000000000account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($file->account); if (empty($acct)) { header("HTTP/1.0 403 forbidden"); die('Authentication Required'); } $file->account=$acct; } //$file->verify(); if (!$file->exists()) { header("HTTP/1.0 404 Not Found"); die("Requested RODS URI: '$ruri' Not found on the RODS server!"); } $filestats=$file->getStats(); check_modified_header($filestats); if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "Opera"; elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "IE"; else $UserBrowser = ''; require_once("../mimetype.inc.php"); $fileext=array_pop(explode('.',$file->getName()));; $filemimetype='application/octet-stream'; if ( (!empty($fileext)) && isset($GLOBALS['mimetypes'][$fileext]) ) $filemimetype=$GLOBALS['mimetypes'][$fileext]; if ($UserBrowser == "IE") $filemimetype=str_replace('octet-stream','octetstream',$filemimetype); @ob_end_clean(); /// decrease cpu usage extreme header('Content-Type: ' . $filemimetype); if ($force_download===true) header('Content-Disposition: attachment; filename="'.$file->getName().'"'); else header('Content-Disposition: inline; filename="'.$file->getName().'"'); header("Last-Modified: ".get_http_mdate($filestats)); if ($filestats->size >0) header('Content-Length: '.$filestats->size); header('Accept-Ranges: bytes'); header("Cache-control: private"); header('Pragma: private'); ///// multipart-download and resume-download $size=$filestats->size; if ($size<=0) { $range=0; } else if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range) = explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2 = $size-1; $new_length = $size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size-1; header("Content-Length: ".$size); } $chunksize = 1*(1024*1024); //$bytes_send = 0; $file->open("r"); if(isset($_SERVER['HTTP_RANGE'])) $file->seek($range); while( (($buffer = $file->read($chunksize))!=NULL) && (connection_status()==0) ) { print($buffer);//echo($buffer); // is also possible flush(); //$bytes_send += strlen($buffer); //sleep(1);//// decrease download speed } $file->close(); } catch (Exception $e) { if ($e instanceof RODSException) { header("HTTP/1.0 500 Internal Server Error"); header('Content-Type: text/html'); header("Content-Length: "); echo ''. ''. '500 Internal Server Error (iRODS Error: '. $e->getCode().' '.$e->getCodeAbbr().')'. ''. '

iRODS Error:'.$e->getCode().'

'. "$e".'

'. '


'. '
'. ' iRODS Server at '.$acct->host. ' Port: '.$acct->port. ' User: '.$acct->user. '
'. ''; die (); } else { header("HTTP/1.0 500 Internal Server Error"); header('Content-Type: text/html'); header("Content-Length: "); echo ''. ''. '500 Internal Server Error'. ''. '

Internal Server Error:'.$e->getCode().'

'. "$e".'

'. '


'. ''; die (); } } function get_http_mdate($filestats) { return gmdate("D, d M Y H:i:s",$filestats->mtime)." GMT"; } function check_modified_header($filestats) { // This function is based on code from http://ontosys.com/php/cache.html $headers=apache_request_headers(); $if_modified_since=preg_replace('/;.*$/', '', $headers['If-Modified-Since']); if(!$if_modified_since) return; $gmtime=get_http_mdate($filestats); if (strtotime($if_modified_since) < strtotime($gmtime)) { header("HTTP/1.1 304 Not Modified"); exit; } } ?>php-irods-3.3.0~beta1/web/services/fileQuery.php000066400000000000000000000030141221272161600216110ustar00rootroot00000000000000 false,'errmsg'=>'Required RODS URI not found'); echo json_encode($response); exit(0); } $action=""; if (isset($_REQUEST['action'])) $action=$_REQUEST['action']; else { $response=array('success'=> false,'errmsg'=>'Action type not specified'); echo json_encode($response); exit(0); } try { $file=ProdsFile::fromURI($ruri); if (empty($file->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($file->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $file->account=$acct; } switch ($action) { case 'replica': $repl_info=$file->getReplInfo(); $response=array('success'=> true,'totalCount'=>count($repl_info), 'que_results'=> $repl_info); $str= json_encode($response); echo "($str)"; exit(0); break; default: $response=array('success'=> false,'errmsg'=>"Action type '$action' not supported"); echo json_encode($response); exit(0); } } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> "$e",'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/getResources.php000066400000000000000000000025061221272161600223230ustar00rootroot00000000000000 false,'error'=>'Required RODS URI Required'); echo json_encode($response); exit(0); } $collection=ProdsDir::fromURI($ruri, false); if (empty($collection->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { $response=array('success'=> false,'error'=>'Authentication Required'); echo json_encode($response); exit(0); } $collection->account=$acct; } try { /* $conn= new RODSConn($collection->account); $conn->connect(); $resources=$conn->getResources(); $response=array('success'=> true,'totalCount'=>count($resources), 'que_results'=> $resources); echo json_encode($response); $conn->disconnect(); */ $que=new ProdsQuery($collection->account); $resources=$que->getResources(); $response=array('success'=> true,'totalCount'=>count($resources), 'que_results'=> $resources); echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> $e->getMessage(),'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/getTempPassword.php000066400000000000000000000022351221272161600230000ustar00rootroot00000000000000 false,'error'=>'required RODS URI not found'); echo json_encode($response); exit(0); } $account=RODSAccount::fromURI($ruri, false); if (empty($account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($account); if (empty($acct)) { $response=array('success'=> false,'error'=>'Authentication Required'); echo json_encode($response); exit(0); } $account=$acct; } try { $temppass=$account->getTempPassword(); $response=array('success'=> true,'temppass'=>$temppass); echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> $e->getMessage(),'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/login.php000066400000000000000000000020611221272161600207550ustar00rootroot00000000000000getUserInfo(); $_SESSION['acct_manager']->add($acct); } catch (Exception $e) { generateClientError($e->getMessage()); } if (isset($_REQUEST['init_path'])) $ruri_home=$acct->getUserHomeDirURI($_REQUEST['init_path']); else $ruri_home=$acct->getUserHomeDirURI(); $var=array("success"=>true,"ruri_home"=>$ruri_home); echo json_encode($var); function generateClientError($msg) { echo json_encode(array("success"=>false, "errors" => $msg)); exit(0); } ?> php-irods-3.3.0~beta1/web/services/metadata.php000066400000000000000000000076261221272161600214410ustar00rootroot00000000000000 false,'errmsg'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $type=NULL; if (isset($_REQUEST['type'])) $type=$_REQUEST['type']; if ($type==NULL) { $response=array('success'=> false,'errmsg'=>'Expected type not specified'); echo json_encode($response); exit(0); } $action=NULL; $mod_batch=array(); if (isset($_REQUEST['action'])) { $action=$_REQUEST['action']; if ($action=='mod') { if (!isset($_REQUEST['batch'])) { $response=array('success'=> false,'errmsg'=>"Expected Mod batch not found"); echo json_encode($response); exit(0); } $mod_batch=json_decode(urldecode($_REQUEST['batch']),true); if (!is_array($mod_batch)) { $response=array('success'=> false,'errmsg'=>"Mal-formated Mod batch"); echo json_encode($response); exit(0); } } } if ($action==NULL) { $response=array('success'=> false,'errmsg'=>'Expected type not specified'); echo json_encode($response); exit(0); } try { if ($type==0) $this_path=ProdsDir::fromURI($ruri, false); else $this_path=ProdsFile::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($this_path->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $this_path->account=$acct; } if (empty($this_path->account->zone)) { $this_path->account->getUserInfo(); } switch ($action) { case "get": $metadata_objs=$this_path->getMeta(); $metadata_array=array(); foreach($metadata_objs as $metadata_obj) { $metadata_array_entry=array(); $metadata_array_entry['id']=$metadata_obj->id; $metadata_array_entry['name']=$metadata_obj->name; $metadata_array_entry['value']=$metadata_obj->value; $metadata_array_entry['unit']=$metadata_obj->units; $metadata_array_entry['isnew']=false; $metadata_array[]=$metadata_array_entry; } $response=array('success'=> true, 'totalCount'=>count($metadata_array), 'que_results'=>$metadata_array); break; case "mod": modMetadata($mod_batch, $this_path); $response=array('success'=> true, 'msg'=>"all done"); break; default: $response=array('success'=> false, 'errmsg'=>"action type '$action' not supported"); } echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> "$e", 'errcode'=> $e->getCode()); echo json_encode($response); } function modMetadata($mod_batch, ProdsPath $target_path) { foreach($mod_batch as $mod_instrction) { $op_type=$mod_instrction['op']; switch($op_type) { case 'add': $target_path->addMeta(new RODSMeta( $mod_instrction['target']['name'], $mod_instrction['target']['value'], $mod_instrction['target']['unit'] )); break; case 'delbyid': $target_path->rmMetaByID($mod_instrction['id']); break; case 'updatebyid': $target_path->rmMetaByID($mod_instrction['target']['id']); $target_path->addMeta( new RODSMeta( $mod_instrction['target']['name'], $mod_instrction['target']['value'], $mod_instrction['target']['unit']) ); break; default: $response=array('success'=> false,'errmsg'=>"op type '$op_type' no supported"); echo json_encode($response); exit(0); } } } ?>php-irods-3.3.0~beta1/web/services/mkdir.php000066400000000000000000000030531221272161600207550ustar00rootroot00000000000000 false,'log'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $name=''; if (isset($_REQUEST['name'])) $name=$_REQUEST['name']; if (empty($name)) { $response=array('success'=> false,'log'=>'New collection name not specified'); echo json_encode($response); exit(0); } try { $parent=ProdsDir::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($parent->account); if (empty($acct)) { $response=array('success'=> false,'log'=>'Authentication Required'); echo json_encode($response); exit(0); } $parent->account=$acct; } if (empty($parent->account->zone)) { $parent->account->getUserInfo(); } $parent->mkdir($name); $response=array('success'=> true,'log'=>'new collection created!'); echo json_encode($response); } catch (Exception $e) { $msg=''; $err_abbr=RODSException::rodsErrCodeToAbbr($e->getCode()); if (null!=$err_abbr) $msg='Failed to create collection because server returned error: '.$err_abbr; else $msg='Failed to create collection: '.$e->getMessage(); $response=array('success'=> false,'errmsg'=> $msg, 'errcode' => $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/newfile.php000066400000000000000000000033551221272161600213050ustar00rootroot00000000000000 false,'log'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $name=''; if (isset($_REQUEST['name'])) $name=$_REQUEST['name']; if (empty($name)) { $response=array('success'=> false,'log'=>'New file name not specified'); echo json_encode($response); exit(0); } $resc=''; if (isset($_REQUEST['resc'])) $resc=$_REQUEST['resc']; if (empty($resc)) { $response=array('success'=> false,'log'=>'Resource name not specified'); echo json_encode($response); exit(0); } try { $parent=ProdsDir::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($parent->account); if (empty($acct)) { $response=array('success'=> false,'log'=>'Authentication Required'); echo json_encode($response); exit(0); } $parent->account=$acct; } if (empty($parent->account->zone)) { $parent->account->getUserInfo(); } $file=new ProdsFile($parent->account,$parent->path_str.'/'.$name); if ($file->exists()) { $response=array('success'=> false,'log'=>'Path '.$parent->path_str.'/'.$name.' already exists!'); } else { $file->open('w',$resc); $file->close(); $response=array('success'=> true,'log'=>"new file '$name' created!"); } echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'log'=> $e->getMessage()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/rename.php000066400000000000000000000034601221272161600211200ustar00rootroot00000000000000 false,'errmsg'=>"Expected rename batch not found"); echo json_encode($response); exit(0); } $rename_batch=json_decode(urldecode($_REQUEST['batch']),true); if (!is_array($rename_batch)) { $response=array('success'=> false,'errmsg'=>"Mal-formated rename batch"); echo json_encode($response); exit(0); } $tasks_status=array(); $success=true; foreach($rename_batch as $task) { try{ oneTask($task); $status=$task; $status['success']=true; $tasks_status[]=$status; } catch (Exception $e) { $status=$task; $status['success']=false; $status['errcode']=$e->getCode(); $status['errmsg']="$e"; $tasks_status[]=$status; $success=false; } } $response=array('success'=> $success, 'batch_status' => $tasks_status); echo json_encode($response); exit(0); function oneTask ($task) { if ($task['type']==0) { $this_path=ProdsDir::fromURI($task['src'], false); $new_path=ProdsDir::fromURI($task['dest'], false); } else { $this_path=ProdsFile::fromURI($task['src'], false); $new_path=ProdsFile::fromURI($task['dest'], false); } if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($this_path->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $this_path->account=$acct; } if (empty($this_path->account->zone)) { $this_path->account->getUserInfo(); } $this_path->rename($new_path->path_str); } ?>php-irods-3.3.0~beta1/web/services/repl.php000066400000000000000000000035071221272161600206150ustar00rootroot00000000000000 false,'errmsg'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $resource=""; if (isset($_REQUEST['resource'])) $resource=$_REQUEST['resource']; else { $response=array('success'=> false,'errmsg'=>'Expected resource not found'); echo json_encode($response); exit(0); } $action=""; if (isset($_REQUEST['action'])) $action=$_REQUEST['action']; else { $response=array('success'=> false,'errmsg'=>'Expected action not found'); echo json_encode($response); exit(0); } try { $file=ProdsFile::fromURI($ruri, false); if (empty($file->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($file->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $file->account=$acct; } switch($action) { case 'add': $file->repl($resource,array('backupMode'=>true)); $response=array('success'=> true,'log'=>"file replicated to resource $resource"); break; case 'remove': $file->unlink($resource,true); $response=array('success'=> true,'log'=>"replica on resource $resource is removed"); break; default: $response=array('success'=> false,'errmsg'=>"Action '$action' is not supported"); break; } echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> $e->getMessage(), 'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/replBulk.php000066400000000000000000000052601221272161600214310ustar00rootroot00000000000000 false,'errmsg'=>'Expected RURI not found'); echo json_encode($response); exit(0); } $resc=""; if (isset($_REQUEST['resc'])) $resc=$_REQUEST['resc']; else { $response=array('success'=> false,'errmsg'=>'Expected resource name not found'); echo json_encode($response); exit(0); } $files=array(); $dirs=array(); if (isset($_REQUEST['files'])) $files=$_REQUEST['files']; if (isset($_REQUEST['dirs'])) $dirs=$_REQUEST['dirs']; if ( (empty($files))&&(empty($dirs)) ) { $response=array('success'=> false,'errmsg'=>'No files or collections specified'); echo json_encode($response); exit(0); } try { $account=RODSAccount::fromURI($ruri); $acct=$_SESSION['acct_manager']->findAcct($account); if (empty($acct)) { if (empty($account->pass)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } else { $_SESSION['acct_manager']->add($account); } } $account=$acct; $mservices=array(); $input_params=array("*desc_resc" => $resc); $num_files=0; foreach ($files as $fileuri) { if (strlen($fileuri)>0) { $myfile=ProdsFile::fromURI($fileuri); $mservices[]= "msiDataObjRepl(*desc_file$num_files,*desc_resc,*outbuf)"; $input_params["*desc_file$num_files"]=$myfile->getPath(); $num_files++; } } $num_dirs=0; foreach ($dirs as $diruri) { if (strlen($diruri)>0) { $mydir=ProdsDir::fromURI($diruri); $mservices[]= "msiReplColl(*desc_dir$num_dirs,*desc_resc,backupMode,*outbuf)"; $input_params["*desc_dir$num_dirs"]=$mydir->getPath(); $num_dirs++; } } $rule_body='myTestRule||'. 'delayExec(0m,'. implode("##", $mservices). ',nop)|nop'; /* --debug code here in case when delayed exec not working */ //$rule_body='myTestRule||'.implode("##", $mservices).'|nop'; $rule=new ProdsRule($account,$rule_body,$input_params); $results=$rule->execute(); $response=array('success'=> true,'log'=>"$num_files files and $num_dirs scheduled for replication!"); echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> $e->getMessage(), 'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/search.php000066400000000000000000000075301221272161600211200ustar00rootroot00000000000000 false,'log'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $start= (isset($_REQUEST['start']))?$_REQUEST['start']:0; $limit= (isset($_REQUEST['limit']))?$_REQUEST['limit']:500; $sort= (isset($_REQUEST['sort']))?$_REQUEST['sort']:'name'; $dir= (isset($_REQUEST['dir']))?$_REQUEST['dir']:'ASC'; if ($dir=='ASC') $sort_order=true; else $sort_order=false; $parent=ProdsDir::fromURI($ruri, false); if (empty($parent->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($parent->account); if (empty($acct)) { $response=array('success'=> false,'log'=>'Authentication Required'); echo json_encode($response); exit(0); } $parent->account=$acct; } $options=array(); if ( (isset($_REQUEST['name'])) && (strlen(trim($_REQUEST['name']))>0) ) $options['name']='%'.$_REQUEST['name'].'%'; if ( isset($_REQUEST['descendantOnly']) && ($_REQUEST['descendantOnly']=='true') ) $options['descendantOnly']=true; else $options['descendantOnly']=false; if ( isset($_REQUEST['recursive']) && ($_REQUEST['recursive']=='true') ) $options['recursive']=true; else $options['recursive']=false; if ( isset($_REQUEST['smtime']) ) $options['smtime']=(int)($_REQUEST['smtime']); if ( isset($_REQUEST['emtime']) ) $options['emtime']=(int)($_REQUEST['emtime']); if ( (isset($_REQUEST['owner'])) && (strlen($_REQUEST['owner'])>0) ) $options['owner']=($_REQUEST['owner']); if ( (isset($_REQUEST['rescname'])) && (strlen($_REQUEST['rescname'])>0) ) $options['rescname']=(int)($_REQUEST['rescname']); if ( (isset($_REQUEST['metadata'])) && (strlen($_REQUEST['metadata'])>0) ) { $metadata_arr=json_decode(urldecode($_REQUEST['metadata']),true); $options['metadata']=array(); foreach($metadata_arr as $meta) { $options['metadata'][]=new RODSMeta( $meta['name'],'%'.$meta['val'].'%',NULL,NULL,$meta['op']); } } if (count($options)<=0) { $response=array('success'=> false,'log'=>'Search option not specified'); echo json_encode($response); exit(0); } try { $total_count=0; $found_files=$parent->findFiles($options, $total_count,(int) $start,(int) $limit,array($sort => $sort_order)); $arr=array(); $arr['totalCount']=(int) $total_count; $arr['que_results']=array(); $arr['success']=true; foreach($found_files as $file) { $filestats=array(); $filestats['id']=$file->stats->id; $filestats['name']=$file->stats->name; $filestats['size']=$file->stats->size; $filestats['fmtsize']=format_size($file->stats->size); $filestats['mtime']=$file->stats->mtime; $filestats['ctime']=$file->stats->ctime; $filestats['owner']=$file->stats->owner; $filestats['rescname']=$file->stats->rescname; $filestats['typename']=$file->stats->typename; $filestats['type']=1; $filestats['dirname']=$file->getParentPath(); $filestats['ruri']=$file->toURI(); $arr['que_results'][]=$filestats; } $str= json_encode($arr); echo "($str)"; } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> "$e", 'errcode' => $e->getCode()); echo json_encode($response); } function format_size($rawSize) { if ($rawSize / 1099511627776 > 1) return round($rawSize/1099511627776, 2) . ' TB'; else if ($rawSize / 1073741824 > 1) return round($rawSize/1073741824, 2) . ' GB'; else if ($rawSize / 1048576 > 1) return round($rawSize/1048576, 2) . ' MB'; else if ($rawSize / 1024 > 1) return round($rawSize/1024, 2) . ' KB'; else return round($rawSize, 1) . ' B '; } ?>php-irods-3.3.0~beta1/web/services/serverQuery.php000066400000000000000000000037061221272161600222100ustar00rootroot00000000000000 false,'error'=>'Required RODS URI not found'); echo json_encode($response); exit(0); } $account=RODSAccount::fromURI($ruri); if (empty($account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($account); if (empty($acct)) { $response=array('success'=> false,'error'=>'Authentication Required'); echo json_encode($response); exit(0); } $account=$acct; } $action=""; if (isset($_REQUEST['action'])) $action=$_REQUEST['action']; else { $response=array('success'=> false,'error'=>'Action type not specified'); echo json_encode($response); exit(0); } try { switch ($action) { case 'metadataname_for_files': $que=new ProdsQuery($account); $names=$que->getMetadataNamesForAllFiles(); $fmted_array=array(); foreach($names as $name) $fmted_array[]=array('name'=>$name); $response=array('success'=> true,'totalCount'=>count($names), 'que_results'=> $fmted_array); $str= json_encode($response); echo "($str)"; exit(0); break; case 'resources': $que=new ProdsQuery($account); $resources=$que->getResources(); $response=array('success'=> true,'totalCount'=>count($resources), 'que_results'=> $resources); $str= json_encode($response); echo "($str)"; exit(0); break; default: $response=array('success'=> false,'error'=>"Action type '$action' not supported"); echo json_encode($response); exit(0); } } catch (Exception $e) { $response=array('success'=> false,'errmsg'=> "$e",'errcode'=> $e->getCode()); echo json_encode($response); } ?>php-irods-3.3.0~beta1/web/services/upload.php000066400000000000000000000136241221272161600211400ustar00rootroot00000000000000"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive (".ini_get("upload_max_filesize").") in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder", 7=>"Failed to write file to disk.", 8=>"File upload stopped by extension." ); /* $data .= '
' . date('Y-m-d H:i:s') . '$_FILES
' . print_r($_FILES, true) . "
"; $data .= '
' . date('Y-m-d H:i:s') . '$_POST
' . print_r($_POST, true) . "
"; $fp = fopen(date('Y-m-d') .".txt", "a"); fwrite($fp, $data); fclose($fp); */ $ruri=""; if (isset($_REQUEST['ruri'])) $ruri=$_REQUEST['ruri']; else { $response=array('success'=> false,'errmsg'=>'Expected RODS URI not found'); echo json_encode($response); exit(0); } $resource=""; if (isset($_REQUEST['resource'])) $resource=$_REQUEST['resource']; else { $response=array('success'=> false,'errmsg'=>'Resource not set'); echo json_encode($response); exit(0); } $collection=ProdsDir::fromURI($ruri, false); if (empty($collection->account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { $response=array('success'=> false,'errmsg'=>'Authentication Required'); echo json_encode($response); exit(0); } $collection->account=$acct; } if (empty($collection->account->zone)) { $collection->account->getUserInfo(); } $response=array('success'=> false,'errmsg'=>'Unknow errors', 'errcode'=>-1); $error=false; $filelist=array(); $numfiles=0; try { foreach($_FILES as $srcfile) { $filename=($srcfile['name']); if (empty($filename)) continue; if ($srcfile['error']!=UPLOAD_ERR_OK) { if (isset($upload_error_msg[$srcfile['error']])) $response=array('success'=> false,'errmsg'=>$upload_error_msg[$srcfile['error']],'errcode'=>$srcfile['error']); else $response=array('success'=> false,'errmsg'=>'Unknow errors', 'errcode'=>$srcfile['error']); $error=true; break; } $tempuploadfilepath=tempnam(dirname($srcfile['tmp_name']),'RODS_Web_Upload'); move_uploaded_file($srcfile['tmp_name'], $tempuploadfilepath); //copy($srcfile['tmp_name'], $srcfile['name']); $destfile=new ProdsFile($collection->account, $collection->path_str."/".$filename); /* $response=array('success'=> false,'log'=> ''.$collection->account); echo json_encode($response); exit(0); */ $destfile->open('w',$resource); $destfile->write(file_get_contents($tempuploadfilepath)); $destfile->close(); if (AUTO_EXTRACT_EXIF === true) extactExif($tempuploadfilepath,$destfile); $numfiles++; unlink($tempuploadfilepath); } if ($error===false) { $response=array('success'=> true,'msg'=>"Uploaded file successfully."); } echo json_encode($response); } catch (Exception $e) { $response=array('success'=> false, 'errmsg'=> $e->getMessage(), 'errcode'=>$e->getCode()); echo json_encode($response); } function extactExif($localfile, $remoteRODSfile) { $exif = exif_read_data($localfile, 'EXIF'); if ($exif===false) return; foreach ($exif as $name => $val) { // replace ascii char that can't be displayed, which causes problem in irods if ( (!is_array($val))&&(is_string($val))&& ( (ord($val[0])<32)||(ord($val[0])>126) ) && ( $name!='UserComment' ) ) { $val='__undefined__'; } if ($name=='THUMBNAIL') { foreach ($val as $tname => $tval) $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.THUMBNAIL.'.$tname, $tval, '')); } else if ($name=='COMPUTED') { foreach ($val as $cname => $cval) { if ($cname=='html') { //skip html tag, because there is a irods server bug that corrupting string with //double quotes: 'COMPUTED.html: width="3264" height="2448"' } else $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.COMPUTED.'.$cname, $cval, '')); } } else if ($name=='MakerNote') { //skip makernote } else if ($name=='ComponentsConfiguration') { //skip ComponentsConfiguration, because there is a irods server bug that corrupting string with } else if ($name=='UserComment') { if (($start=strpos($val,'GCM_TAG'))!==false) { $str=substr($val,$start+strlen('GCM_TAG')); $gcm_tokens=explode(chr(0),$str); $gcm_counter=0; foreach($gcm_tokens as $gcm_tag) { if ( (strlen($gcm_tag)>0)&&(preg_match('/^[' . chr(32) . '-' . chr(126) . ']+$/', $gcm_tag)) ) { $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.UserComment'.$gcm_counter++, $gcm_tag, '')); } } } else { if (strlen($val)<1) $str=' '; //replace no displable char $str=preg_replace('/[^' . chr(32) . '-' . chr(126) . ']+/', ' ', $val); $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.UserComment', $str, '')); } } else if (is_array($val)) { foreach ($val as $cname => $cval) { $remoteRODSfile->addMeta(new RODSMeta( "EXIF.$name.".$cname, $cval, '')); } } else $remoteRODSfile->addMeta(new RODSMeta( 'EXIF.'.$name, $val, '')); } } ?>php-irods-3.3.0~beta1/web/uploadApplet.php000066400000000000000000000022311221272161600204530ustar00rootroot00000000000000account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { echo "Error: RODS URI expected but not found!"; exit(0); } $collection->account=$acct; $pass=$collection->account->pass; } else $pass=$collection->account->pass; ?> Upload Applet php-irods-3.3.0~beta1/web/uploadDialog.css000066400000000000000000000014201221272161600204250ustar00rootroot00000000000000.list {list-style:square;width:500px;padding-left:16px;} .list li{padding:2px;font-size:8pt;} /* hide the tab content while loading */ .tab-content{display:none;} pre { font-size:11px; } #tabs1 {width:400px;} #tabs1 .x-tabs-item-body {display:none;padding:10px;} #upload_form_tabs {width:670px;} #upload_form_tabs .x-tabs-body {height:320px;overflow:auto;} #upload_form_tabs .x-tabs-item-body {display:none;padding:10px;font-size:11px;} /* default loading indicator for ajax calls */ .loading-indicator { font-size:8pt; background-image:url('images/loading.gif'); background-repeat: no-repeat; background-position: left; padding-left:20px; } #tab-panel1 .x-tabs-body {height:300px;overflow:auto;} #tab-panel1 .x-tabs-item-body {padding:10px;}php-irods-3.3.0~beta1/web/uploadDialog.js000066400000000000000000000307331221272161600202620ustar00rootroot00000000000000var UploadForm=function(){ var upload, upload_button; return { init : function(){ var tabs = new Ext.TabPanel('upload_form_tabs'); tabs.resizeTabs=true; var tab1= tabs.addTab('upload_form_tabs-1', "Basic"); var tab2= tabs.addTab('upload_form_tabs-2', "Advanced (applet)"); var updater = tab2.getUpdateManager(); updater.setDefaultUrl('uploadApplet.php?ruri='+ruri); tab2.on('activate', updater.refresh, updater, true); tabs.activate('upload_form_tabs-1'); this.makeBasicUploadTab(); tabs.autoSizeTabs(); }, makeBasicUploadTab : function(){ Ext.QuickTips.init(); // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; var upload = new Ext.form.Form({ id: 'upload_form_data', labelAlign: 'right' }); upload.column( {width:530, style:'margin-left:10px'} ); upload.fieldset( {id:'dest_disp', legend:'Destination RODS URI', hideLabels: true}, new Ext.form.TextField({ width:450, name: 'ruri', value: ruri, allowBlank:false }) ); //upload.end(); //var resource_arr=Ext.util.JSON.decode(resources_json); var resource; if ((resource_arr!=null)&&(resource_arr['success']===true)) { var resource_store = new Ext.data.SimpleStore({ fields: ['id', 'name', 'type', 'zone', 'class', 'loc', 'info', 'comment', 'ctime', 'mtime', 'vault_path', 'free_space'], data : resource_arr['que_results'] }); resource = new Ext.form.ComboBox({ store: resource_store, displayField:'name', typeAhead: true, mode: 'local', triggerAction: 'all', emptyText:'Select a Resource...', selectOnFocus:true, allowBlank:false, hiddenName: 'resource', forceSelection:true }); resource.on("render",function() { resource.setValue(resource_arr['que_results'][0][1]); }); function disp_resource_info(combo, record, index) { var ctime= record.data['ctime']; var ctime_fmt; try { var ctime_date=new Date(ctime*1000); ctime_fmt=ctime_date.dateFormat('F j, Y, g:i a T'); } catch (e) { ctime_fmt = record.data['ctime']; } document.getElementById('resource_info_disp').innerHTML= "Location: "+record.data['loc']+"
" +"Class: "+record.data['class']+"
" +"Created On:"+ctime_fmt+"
" +"Zone: "+record.data['zone']+"
" +"Free Space:"+record.data['free_space']; }; resource.on("select",disp_resource_info); } else { resource = new Ext.form.TextField({ width:175, name: 'resource', allowBlank:false }); } upload.fieldset( {id:'dest_resource_disp', legend:'Destination Resource', hideLabels: true}, resource ); //upload.end(); // ================= upload.fieldset( {id:'filechooser', legend:'Choose files'} ); upload.end(); // ===================== this.upload_button=upload.addButton({text:'Upload', handler:this.submitHandler}); //upload.render('form-upload'); upload.render('upload_form_tabs-1'); // ===================== /* var dest_disp_div=document.createElement('p'); dest_disp_div.innerHTML=document.getElementById('upload_dest_ruri').innerHTML; var dest_disp = Ext.get('dest_disp'); dest_disp.appendChild(dest_disp_div); */ // ===================== var resource_info_disp_div=document.createElement('div'); resource_info_disp_div.id="resource_info_disp"; var dest_disp = Ext.get('dest_resource_disp'); dest_disp.appendChild(resource_info_disp_div); // ===================== var img_upload = document.createElement('img'); img_upload.id="img_upload"; img_upload.src="images/upload.png"; img_upload.alt="upload"; var a_attachFile = document.createElement('a'); a_attachFile.id="a_attachFile"; a_attachFile.href="#"; a_attachFile.innerHTML="Upload a file"; // ===================== var attach = Ext.get('filechooser'); attach.appendChild(img_upload); attach.appendChild(a_attachFile); this.createFirstBrowseUploadFile(); Ext.get('a_attachFile').on('click', this.createBrowseUploadFile, this); }, // ================================ submitHandler : function (this_button, this_event){ this_button.setDisabled(true); this_button.setText("Uploading..."); // The FIRST argument is form. // The SECOND argument is true to indicate file upload. // The THIRD argument to true to prevent IE from throwing domain security errors, // when uploading files in applications over SSL and using IE. YAHOO.util.Connect.setForm(document.body.getElementsByTagName('FORM')['upload_form_data'], true, true); /* var postvars= 'ruri=' + document.getElementById('upload_dest_ruri').innerHTML + '&' + "jobid=" + UploadForm.jobid; */ YAHOO.util.Connect.asyncRequest('POST', 'services/upload.php', {upload: UploadForm.uploadCBHandler} /*,postvars*/); }, uploadCBHandler : function (oResponse) { UploadForm.upload_button.setDisabled(false); UploadForm.upload_button.setText("Upload"); var resp; try { resp= Ext.util.JSON.decode( oResponse.responseText ); } catch (e) { alert("Invalid server response:"+oResponse.responseText); } //alert(resp['log']); if (!resp['success']) { Ext.MessageBox.show({ title: 'Failure', msg: resp['log'], width:300, buttons: Ext.MessageBox.OK }); } else { Ext.MessageBox.show({ title: 'Success', msg: resp['log'], width:300, buttons: Ext.MessageBox.OK }); } //UploadForm.resetBrowseUploadFileDivs(); }, // ================================ createBrowseUploadFile : function (){ // Create browse file template var html_tpl = '
' + ' ' + '  ' + ' remove' + '
'; var tpl = Ext.DomHelper.createTemplate(html_tpl); // Insert before image upload var oInsert = document.getElementById('img_upload'); // Create new id var new_id = this.findInputTag_MaxID() + 1; // Assign to template tpl.insertBefore(oInsert, { div_id: ('div_browser_file_' + new_id), input_id: ('file_' + new_id), input_name: ('file_' + new_id), a_id: ('remove_' + new_id), a_onclick: "javascript:UploadForm.removeBrowseUploadFile('" + new_id + "'); return false" }); // Change attach file text document.getElementById('a_attachFile').innerHTML = "Add another file"; }, createFirstBrowseUploadFile : function (){ // Create browse file template var html_tpl = '
' + ' ' + '  ' + '
'; var tpl = Ext.DomHelper.createTemplate(html_tpl); // Insert before image upload var oInsert = document.getElementById('img_upload'); // Create new id //var new_id = this.findInputTag_MaxID() + 1; var new_id = 0; // Assign to template tpl.insertBefore(oInsert, { div_id: ('div_browser_file_' + new_id), input_id: ('file_' + new_id), input_name: ('file_' + new_id) }); // Change attach file text document.getElementById('a_attachFile').innerHTML = "Add another file"; }, resetBrowseUploadFileDivs : function (){ var max_id=this.findInputTag_MaxID(); for(var idx=0; idx < max_id; idx++) { this.removeBrowseUploadFile(idx); } this.createFirstBrowseUploadFile(); }, // ================================ removeBrowseUploadFile : function (idx){ var upload_div=Ext.get('div_browser_file_' + idx); if (upload_div!=null) upload_div.remove(); if (this.countInputTag_TypeFile() == 0) { // Change attach file text document.getElementById('a_attachFile').innerHTML="Add a file"; } }, // ================================ countInputTag_TypeFile : function (){ var count = 0; var inputTags = document.body.getElementsByTagName('INPUT'); for (idx = 0; idx < inputTags.length; idx++) { if (inputTags[idx].type.toLowerCase() != 'file') { continue; } count++; } return count; }, // ================================ findInputTag_MaxID : function (){ var nameArray; var max = 0; var inputTags = document.body.getElementsByTagName('INPUT'); for (idx = 0; idx < inputTags.length; idx++) { //if (inputTags[idx].type.toLowerCase() != 'file') { var typestr=inputTags[idx].type; if (typestr.toLowerCase() != 'file') { continue; } nameArray = inputTags[idx].id.split('_'); max = parseInt(nameArray[1]); } return (max > 0) ? max : 0; } }; }();php-irods-3.3.0~beta1/web/uploadDialog.php000066400000000000000000000057121221272161600204340ustar00rootroot00000000000000account->pass)) { $acct=$_SESSION['acct_manager']->findAcct($collection->account); if (empty($acct)) { echo "Error: RODS URI expected but not found!"; exit(0); } $collection->account=$acct; } $resources_json=""; try { $conn= new RODSConn($collection->account); $conn->connect(); $resources=$conn->getResources(); $resources_arr_no_keys=array(); foreach($resources as $resource) { $resources_arr_no_keys[]=array_values($resource); } $resources_with_status=array("success" => true, "total_count" => count($resources), "que_results" => $resources_arr_no_keys); $resources_json=json_encode($resources_with_status); $conn->disconnect(); } catch (Exception $e) { $response=array('success'=> false,'error'=> $e->getMessage()); $resources_json=json_encode($response); } ?> Upload to <?php echo $ruri; ?>