incorporate development branch of ssh://irodsguest@code.renci.org/gitroot/irodsphp

This commit is contained in:
Thomas Müller 2013-07-12 15:08:13 +02:00
parent 481bb831bb
commit 01378e1907
80 changed files with 7938 additions and 1 deletions

9
.gitignore vendored
View File

@ -6,7 +6,7 @@
/apps/inc.php
# ignore all apps except core ones
/apps*
#/apps*
!/apps/files
!/apps/files_encryption
!/apps/files_external
@ -15,6 +15,13 @@
!/apps/files_versions
!/apps/user_ldap
!/apps/user_webdavauth
/apps/files_external/3rdparty/irodsphp/PHPUnitTest
/apps/files_external/3rdparty/irodsphp/web
/apps/files_external/3rdparty/irodsphp/prods/test
/apps/files_external/3rdparty/irodsphp/prods/tutorial
/apps/files_external/3rdparty/irodsphp/prods/test*
# ignore themes except the README
/themes/*

View File

@ -0,0 +1,28 @@
iRODS 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.

View File

@ -0,0 +1,87 @@
;; 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 <cellog@php.net>
;;
;; 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

View File

@ -0,0 +1,34 @@
*'''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

View File

@ -0,0 +1,28 @@
iRODS 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.

View File

@ -0,0 +1,4 @@
<?php
require_once("autoload.inc.php");
require_once("ProdsConfig.inc.php");
?>

View File

@ -0,0 +1,19 @@
<?php
/**#@+
* Constants
*/
define("RODS_REL_VERSION", 'rods1.1');
define("RODS_API_VERSION", 'd');
/**#@-*/
if (file_exists(__DIR__ . "/prods.ini")) {
$GLOBALS['PRODS_CONFIG'] = parse_ini_file(__DIR__ . "/prods.ini", true);
}
else {
$GLOBALS['PRODS_CONFIG'] = array();
}
?>

View File

@ -0,0 +1,730 @@
<?php
/**
* PRODS directory class
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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; $i<sizeof($que_result_users["COL_DATA_ACCESS_USER_ID"]);$i++) {
$que_result_user_info = $connLocal->genQuery(
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;
}
}

View File

@ -0,0 +1,434 @@
<?php
/**
* PRODS file class
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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;
}
}

View File

@ -0,0 +1,283 @@
<?php
/**
* ProdsPath class file.
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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;
}
}
?>

View File

@ -0,0 +1,107 @@
<?php
/**
* ProdsQuery class.
*
* This class provides high level PRODS queries, which aren't specific
* to a path, account or resource.
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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;
}
}
?>

View File

@ -0,0 +1,62 @@
<?php
/**
* ProdsRule class. Provides iRODS rule related functionalities.
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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;
}
}
?>

View File

@ -0,0 +1,436 @@
<?php
/**
* PRODS class
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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');
?>

View File

@ -0,0 +1,41 @@
<?php
/**
* Developer: Daniel Speichert <s@drexel.edu>
* 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);
}
}

View File

@ -0,0 +1,203 @@
<?php
/**#@+
* Constants
*/
/**
* Maximum lengh of password string. Only up to this lengh of password are submitted to RODS server.
*/
define("MAX_PASSWORD_LEN", 50);
/**#@-*/
require_once("autoload.inc.php");
class RODSAccount
{
/**#@+
* @var string
*/
public $user;
public $pass;
public $host;
public $port;
public $zone;
public $default_resc;
public $auth_type;
public $ticket;
/**#@-*/
public function __construct($host, $port, $user, $pass, $zone="",
$default_resc="", $auth_type="irods",$ticket = '')
{
$this->host=$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();
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
<?php
/**#@+
* Constants
*/
/**
* Maximum number of connection per user per server
*/
define("MAX_NUM_CONN_PER_USER_SERVER", 5);
/**#@-*/
if (!isset($GLOBALS['RODSConnManager']))
$GLOBALS['RODSConnManager'] = new RODSConnManager();
class RODSConnManager
{
private $waiting_queue;
private $conn_map;
public function __construct()
{
$this->waiting_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... <br/> \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]))."<br/>\n";
if (isset($manager->conn_map[$conn_sig][$conn->getId()])) {
$manager->conn_map[$conn_sig][$conn->getId()]->unlock();
}
}
}
?>

View File

@ -0,0 +1,25 @@
<?php
class RODSDirStats
{
public $name;
public $owner;
public $ownerzone;
public $mtime;
public $ctime;
public $id;
public $comments;
public function __construct($name, $owner, $ownerzone, $mtime, $ctime, $id, $comments)
{
$this->name = $name;
$this->owner = $owner;
$this->ownerzone = $ownerzone;
$this->mtime = $mtime;
$this->ctime = $ctime;
$this->id = $id;
$this->comments = $comments;
}
}

View File

@ -0,0 +1,184 @@
<?php
/**
* RODS exception class
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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 <br/>\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 = "<p style=\"font-family: monospace; border: solid 1px #000000\"><span style=\"font-weight: bold; color: #000000;\">An exception was thrown :<br/></span>";
$htmldoc .= "Exception code : $this->code<br/>";
$htmldoc .= "Exception abbr : $this->code_abbr<br/>";
$htmldoc .= "Exception message : $this->message<br/>";
$htmldoc .= "<span style=\"color: #0000FF;\">";
$i = 0;
foreach ($this->getStackTrace() as $key => $trace) {
$htmldoc .= $this->showTrace($trace, $i);
$i++;
}
$htmldoc .= "#$i {main}<br/>";
unset($i);
$htmldoc .= "</span></p>";
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 .= ")<br/>";
}
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();
}
}
?>

View File

@ -0,0 +1,34 @@
<?php
class RODSFileStats
{
public $name;
public $size;
public $owner;
public $ownerzone;
public $mtime;
public $ctime;
public $id;
public $typename;
public $rescname;
public $comments;
public $num_replica;
public function __construct($name, $size, $owner, $ownerzone, $mtime, $ctime, $id, $typename,
$rescname, $comments, $num_replica = null)
{
$this->name = $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;
}
}

View File

@ -0,0 +1,114 @@
<?php
require_once("autoload.inc.php");
class RODSGenQueConds
{
private $cond;
private $cond_kw;
/**
* default constructor. It take names, ops, and vals.
* suppose name='foo' op='>=' 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;
}
}
?>

View File

@ -0,0 +1,99 @@
<?php
require_once("autoload.inc.php");
class RODSGenQueResults
{
private $total_count;
private $values;
private $numcol;
private $numrow;
/**
* default constructor.
* @param integer $total_count total count of all potential results.
* @param array $result_array an associative array of the values. Each key is the return field name, and each array element is an array of values of the query.
*/
public function __construct($total_count = 0, array $result_array = array())
{
$this->total_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;
}
}
?>

View File

@ -0,0 +1,160 @@
<?php
require_once("autoload.inc.php");
class RODSGenQueSelFlds
{
private $names;
private $indexes;
private $attrs;
/**
* default constructor.
* @param string $name name of the field, which must be one defined in file 'RodsGenQueryNum.inc.php'.
* @param string $attrs extra options used for operations such as order_by, the expected values are:
* - '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 function __construct(array $names = array(), array $attrs = array())
{
require_once("RodsGenQueryNum.inc.php"); //load magic numbers
$this->names = $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;
}
}
?>

View File

@ -0,0 +1,50 @@
<?php
/**
* RODS keyval type class. This class is conresponding to iRODS's keyval type
* @author Sifang Lu <sifang@sdsc.edu>
* @copyright Copyright &copy; 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;
}
}
?>

View File

@ -0,0 +1,185 @@
<?php
require_once("autoload.inc.php");
$GLOBALS['RODSMessage_types'] = array(
"RODS_CONNECT_T" => "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();
}
}
?>

View File

@ -0,0 +1,21 @@
<?php
class RODSMeta
{
public $name;
public $value;
public $units;
public $id;
public $op;
public function __construct($name, $value, $units = NULL, $id = NULL, $op = "=")
{
$this->name = $name;
$this->value = $value;
$this->units = $units;
$this->id = $id;
$this->op = $op;
}
}

View File

@ -0,0 +1,20 @@
<?php
define ("DONE_OPR", 9999);
define ("PUT_OPR", 1);
define ("GET_OPR", 2);
define ("SAME_HOST_COPY_OPR", 3);
define ("COPY_TO_LOCAL_OPR", 4);
define ("COPY_TO_REM_OPR", 5);
define ("REPLICATE_OPR", 6);
define ("REPLICATE_DEST", 7);
define ("REPLICATE_SRC", 8);
define ("COPY_DEST", 9);
define ("COPY_SRC", 10);
define ("RENAME_DATA_OBJ", 11);
define ("RENAME_COLL", 12);
define ("MOVE_OPR", 13);
define ("RSYNC_OPR", 14);
define ("PHYMV_OPR", 15);
define ("PHYMV_SRC", 16);
define ("PHYMV_DEST", 17);
?>

View File

@ -0,0 +1,22 @@
<?php
class RODSQueryCondition
{
public $name;
public $value;
public $op;
public function __construct($name, $value, $op = "=")
{
$this->name = $name;
$this->value = $value;
$this->op = $op;
}
public function __toString()
{
return "$this->name $this->op '$this->value'";
}
}

View File

@ -0,0 +1,217 @@
<?php
/* This file is generated by setRodsAPINum.php Please modify that file if you wish to update the API number. */
$GLOBALS['PRODS_API_NUMS'] = array(
'FILE_CREATE_AN' => '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',
);
?>

View File

@ -0,0 +1,8 @@
<?php
// following is general defines. Do not motify unless you know what you
// are doing!
define ("ORDER_BY", 0x400);
define ("ORDER_BY_DESC", 0x800);
?>

View File

@ -0,0 +1,587 @@
<?php
/* This file is generated by setRodsErrorCodes.php. Please modify that file if you wish to update the error codes. */
$GLOBALS['PRODS_ERR_CODES'] = array(
'SYS_SOCK_OPEN_ERR' => '-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',
);
?>

View File

@ -0,0 +1,225 @@
<?php
/* This file is generated by setRodsGenQueryKeyWd.php Please modify that file if you wish to update the Gen Query keywords. */
$GLOBALS['PRODS_GENQUE_KEYWD'] = array(
'ALL_KW' => "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',
);
?>

View File

@ -0,0 +1,235 @@
<?php
/* This file is generated by setRodsGenQueryNum.php Please modify that file if you wish to update the Gen Query number. */
$GLOBALS['PRODS_GENQUE_NUMS'] = array(
'MAX_SQL_ATTR' => '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',
);
?>

View File

@ -0,0 +1,47 @@
<?php
// change this, if this code isn't "higher" than ALL classfiles
define("CLASS_DIR", dirname(__FILE__));
/**
* autoload classes (no need to include them one by one)
*
* @uses classFolder()
* @param $className string
*/
function __autoload($className)
{
$folder = classFolder($className);
if ($folder)
require_once($folder . $className . ".class.php");
}
/**
* search for folders and subfolders with classes
*
* @param $className string
* @param $sub string[optional]
* @return string
*/
function classFolder($className, $sub = "/")
{
$dir = dir(CLASS_DIR . $sub);
if (file_exists(CLASS_DIR . $sub . $className . ".class.php"))
return CLASS_DIR . $sub;
while (false !== ($folder = $dir->read())) {
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');

View File

@ -0,0 +1,250 @@
<?php
//require_once(dirname(__FILE__)."/../autoload.inc.php");
/*
$GLOBALS['Pack_PI_Table']=array (
"MsgHeader_PI" => 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<br/>\n";
$node->appendChild($doc->createElement($name, htmlspecialchars($sub_packlet)));
}
}
}
} else //if node holds a string
{ //echo "packlet = $packlet<br/>\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));
}
*/
}
?>

View File

@ -0,0 +1,14 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_BinBytesBuf extends RODSPacket
{
public function __construct($buflen = '', $buf = '')
{
$packlets = array("buflen" => $buflen, "buf" => $buf);
parent::__construct("BinBytesBuf_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_CollInp extends RODSPacket
{
public function __construct($collName = "",
RP_KeyValPair $KeyValPair_PI = NULL)
{
if (!isset($KeyValPair_PI)) $KeyValPair_PI = new RP_KeyValPair();
$packlets = array("collName" => $collName,
'KeyValPair_PI' => $KeyValPair_PI);
parent::__construct("CollInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_CollOprStat extends RODSPacket
{
public function __construct($filesCnt = 0, $totalFileCnt = 0, $bytesWritten = 0,
$lastObjPath = '')
{
$packlets = array("filesCnt" => $filesCnt, "totalFileCnt" => $totalFileCnt,
'bytesWritten' => $bytesWritten, 'lastObjPath' => $lastObjPath);
parent::__construct("CollOprStat_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,19 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_DataObjCopyInp extends RODSPacket
{
public function __construct(RP_DataObjInp $src = NULL,
RP_DataObjInp $dest = NULL)
{
if (!isset($src)) $src = new RP_DataObjInp();
if (!isset($dest)) $dest = new RP_DataObjInp();
$packlets = array("src" => $src, 'dest' => $dest);
parent::__construct("DataObjCopyInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,22 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_DataObjInp extends RODSPacket
{
public function __construct($objPath = "", $createMode = 0, $openFlags = 0,
$offset = 0, $dataSize = -1, $numThreads = 0, $oprType = 0,
RP_KeyValPair $KeyValPair_PI = NULL)
{
if (!isset($KeyValPair_PI)) $KeyValPair_PI = new RP_KeyValPair();
$packlets = array("objPath" => $objPath, 'createMode' => $createMode,
'openFlags' => $openFlags, 'offset' => $offset, "dataSize" => $dataSize,
"numThreads" => $numThreads, "oprType" => $oprType,
'KeyValPair_PI' => $KeyValPair_PI);
parent::__construct("DataObjInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,56 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of RP_ExecCmdOut
*
* @author lisa
*/
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_ExecCmdOut extends RODSPacket
{
public function __construct($buf = '', $buflen = 0)
{
$packlets = array("buf" => $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] = "";
}
}
}
?>

View File

@ -0,0 +1,22 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_ExecMyRuleInp extends RODSPacket
{
public function __construct($myRule = '', RP_RHostAddr $RHostAddr_PI = null,
RP_KeyValPair $KeyValPair_PI = null, $outParamDesc = '',
RP_MsParamArray $MsParamArray_PI = null)
{
if (!isset($RHostAddr_PI)) $RHostAddr_PI = new RP_RHostAddr();
if (!isset($KeyValPair_PI)) $KeyValPair_PI = new RP_KeyValPair();
if (!isset($MsParamArray_PI)) $MsParamArray_PI = new RP_MsParamArray();
$packlets = array("myRule" => $myRule, "RHostAddr_PI" => $RHostAddr_PI,
"KeyValPair_PI" => $KeyValPair_PI, "outParamDesc" => $outParamDesc,
"MsParamArray_PI" => $MsParamArray_PI);
parent::__construct("ExecMyRuleInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,25 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_GenQueryInp extends RODSPacket
{
public function __construct($maxRows = 500, $continueInx = 0,
RP_KeyValPair $KeyValPair_PI = NULL,
RP_InxIvalPair $InxIvalPair_PI = NULL,
RP_InxValPair $InxValPair_PI = NULL,
$options = 0, $partialStartIndex = 0)
{
if (!isset($KeyValPair_PI)) $KeyValPair_PI = new RP_KeyValPair();
if (!isset($InxIvalPair_PI)) $InxIvalPair_PI = new RP_InxIvalPair();
if (!isset($InxValPair_PI)) $InxValPair_PI = new RP_InxValPair();
$packlets = array("maxRows" => $maxRows, 'continueInx' => $continueInx,
'partialStartIndex' => $partialStartIndex, 'options' => $options,
'KeyValPair_PI' => $KeyValPair_PI, 'InxIvalPair_PI' => $InxIvalPair_PI,
'InxValPair_PI' => $InxValPair_PI);
parent::__construct("GenQueryInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,22 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_GenQueryOut extends RODSPacket
{
// if one of the packlet is an array of packets, define it here.
protected $array_rp_type;
public function __construct($rowCnt = 0, $attriCnt = 0, $continueInx = 0,
$totalRowCount = 0, array $SqlResult_PI = array())
{
$this->array_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);
}
}
?>

View File

@ -0,0 +1,27 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_InxIvalPair extends RODSPacket
{
public function __construct($iiLen = 0, array $inx = array(), array $ivalue = array())
{
$packlets = array("iiLen" => $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();
}
}
}
?>

View File

@ -0,0 +1,44 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
require_once(dirname(__FILE__) . "/../RodsGenQueryNum.inc.php");
class RP_InxValPair extends RODSPacket
{
public function __construct($isLen = 0, array $inx = array(), array $svalue = array())
{
$packlets = array("isLen" => $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 "<pre> $cond->op '$cond->value' </pre>";
}
}
}
?>

View File

@ -0,0 +1,47 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_KeyValPair extends RODSPacket
{
public function __construct($ssLen = 0, array $keyWord = array(), array $svalue = array())
{
if ($ssLen < 1) {
$keyWord = NULL;
$svalue = NULL;
}
$packlets = array("ssLen" => $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'";
}
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_MiscSvrInfo extends RODSPacket
{
public function __construct($serverType = 0, $relVersion = 0, $apiVersion = 0,
$rodsZone = '')
{
$packlets = array("serverType" => $serverType, 'relVersion' => $relVersion,
'apiVersion' => $apiVersion, 'rodsZone' => $rodsZone);
parent::__construct("MiscSvrInfo_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,18 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_ModAVUMetadataInp extends RODSPacket
{
public function __construct($arg0 = NULL, $arg1 = NULL, $arg2 = NULL,
$arg3 = NULL, $arg4 = NULL, $arg5 = NULL, $arg6 = NULL, $arg7 = NULL, $arg8 = NULL,
$arg9 = NULL)
{
$packlets = array("arg0" => $arg0, "arg1" => $arg1, "arg2" => $arg2,
"arg3" => $arg3, "arg4" => $arg4, "arg5" => $arg5,
"arg6" => $arg6, "arg7" => $arg7, "arg8" => $arg8, "arg9" => $arg9);
parent::__construct("ModAVUMetadataInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,45 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_MsParam extends RODSPacket
{
public function __construct($label = '', RODSPacket $inOutStruct = null,
RP_BinBytesBuf $BinBytesBuf_PI = null)
{
if (!isset($BinBytesBuf_PI)) $BinBytesBuf_PI = new RP_BinBytesBuf();
if (!isset($inOutStruct)) $inOutStruct = new RODSPacket();
$packlets = array("label" => $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);
}
}
?>

View File

@ -0,0 +1,21 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_MsParamArray extends RODSPacket
{
// if one of the packlet is an array of packets, define it here.
protected $array_rp_type;
public function __construct(array $MsParam_PI = array(),
$oprType = 0)
{
$this->array_rp_type = array("MsParam_PI" => "RP_MsParam");
$packlets = array("paramLen" => count($MsParam_PI),
"oprType" => $oprType, "MsParam_PI" => $MsParam_PI);
parent::__construct("MsParamArray_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,17 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_MsgHeader extends RODSPacket
{
public function __construct($type = NULL, $msgLen = 0, $errorLen = 0, $bsLen = 0,
$intInfo = 0)
{
$packlets = array("type" => $type, "msgLen" => $msgLen,
"errorLen" => $errorLen, "bsLen" => $bsLen, "intInfo" => $intInfo);
parent::__construct("MsgHeader_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_RHostAddr extends RODSPacket
{
public function __construct($hostAddr = '', $rodsZone = '', $port = 0)
{
$packlets = array("hostAddr" => $hostAddr, "rodsZone" => $rodsZone,
"port" => $port);
parent::__construct("RHostAddr_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,20 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_RodsObjStat extends RODSPacket
{
public function __construct($objSize = 0, $objType = 0, $numCopies = 0,
$dataId = -1, $chksum = NULL, $ownerName = NULL, $ownerZone = NULL,
$createTime = NULL, $modifyTime = NULL)
{
$packlets = array("objSize" => $objSize, 'objType' => $objType,
'numCopies' => $numCopies, 'dataId' => $dataId, "chksum" => $chksum,
"ownerName" => $ownerName, "ownerZone" => $ownerZone,
'createTime' => $createTime, 'modifyTime' => $modifyTime);
parent::__construct("RodsObjStat_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_STR extends RODSPacket
{
public function __construct($myStr = '')
{
$packlets = array("myStr" => $myStr);
parent::__construct("STR_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_SqlResult extends RODSPacket
{
public function __construct($attriInx = 0, $reslen = 0, array $value = array())
{
$packlets = array("attriInx" => $attriInx, 'reslen' => $reslen, 'value' => $value);
parent::__construct("SqlResult_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,18 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_StartupPack extends RODSPacket
{
public function __construct($user = "", $zone = "", $relVersion = RODS_REL_VERSION,
$apiVersion = RODS_API_VERSION, $option = NULL)
{
$packlets = array("irodsProt" => 1, "connectCnt" => 0,
"proxyUser" => $user, "proxyRcatZone" => $zone, "clientUser" => $user,
"clientRcatZone" => $zone, "relVersion" => $relVersion,
"apiVersion" => $apiVersion, "option" => $option);
parent::__construct("StartupPack_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_TransStat extends RODSPacket
{
public function __construct($numThreads = 0, $bytesWritten = 0)
{
$packlets = array("numThreads" => $numThreads,
'bytesWritten' => $bytesWritten);
parent::__construct("TransStat_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_Version extends RODSPacket
{
public function __construct($status = 0, $relVersion = 'rods0.5',
$apiVersion = 'a')
{
$packlets = array("status" => $status, "relVersion" => $relVersion,
"apiVersion" => $apiVersion);
parent::__construct("Version_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_authRequestOut extends RODSPacket
{
public function __construct($challenge = "")
{
$packlets = array("challenge" => $challenge);
parent::__construct("authRequestOut_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_authResponseInp extends RODSPacket
{
public function __construct($response = "", $username = "")
{
$packlets = array("response" => $response, "username" => $username);
parent::__construct("authResponseInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_dataObjCloseInp extends RODSPacket
{
public function __construct($l1descInx = -1, $bytesWritten = 0)
{
$packlets = array("l1descInx" => $l1descInx,
'bytesWritten' => $bytesWritten);
parent::__construct("dataObjCloseInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_dataObjReadInp extends RODSPacket
{
public function __construct($l1descInx = -1, $len = 0)
{
$packlets = array("l1descInx" => $l1descInx,
'len' => $len);
parent::__construct("dataObjReadInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_dataObjWriteInp extends RODSPacket
{
public function __construct($dataObjInx = -1, $len = 0)
{
$packlets = array("dataObjInx" => $dataObjInx,
'len' => $len);
parent::__construct("dataObjWriteInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_fileLseekInp extends RODSPacket
{
public function __construct($fileInx = -1, $offset = 0, $whence = 0)
{
$packlets = array("fileInx" => $fileInx, "offset" => $offset,
'whence' => $whence);
parent::__construct("fileLseekInp_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,15 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_fileLseekOut extends RODSPacket
{
public function __construct($offset = 0)
{
$packlets = array("offset" => $offset);
parent::__construct("fileLseekOut_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,14 @@
<?php
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_getTempPasswordOut extends RODSPacket
{
public function __construct($stringToHashWith = '')
{
$packlets = array("stringToHashWith" => $stringToHashWith);
parent::__construct("getTempPasswordOut_PI", $packlets);
}
}
?>

View File

@ -0,0 +1,13 @@
<?php
require_once(dirname(__FILE__)."/../autoload.inc.php");
class RP_pamAuthRequestInp extends RODSPacket
{
public function __construct($pamUser="", $pamPassword="", $timeToLive=-1)
{
$packlets=array("pamUser" => $pamUser, "pamPassword" => $pamPassword, "timeToLive" => $timeToLive);
parent::__construct("pamAuthRequestInp_PI",$packlets);
}
}
?>

View File

@ -0,0 +1,13 @@
<?php
require_once(dirname(__FILE__)."/../autoload.inc.php");
class RP_pamAuthRequestOut extends RODSPacket
{
public function __construct($irodsPamPassword="")
{
$packlets=array("irodsPamPassword" => $irodsPamPassword);
parent::__construct("pamAuthRequestOut_PI",$packlets);
}
}
?>

View File

@ -0,0 +1,13 @@
<?php
require_once(dirname(__FILE__)."/../autoload.inc.php");
class RP_sslEndInp extends RODSPacket
{
public function __construct($arg0="")
{
$packlets=array("arg0" => $arg0);
parent::__construct("sslEndInp_PI",$packlets);
}
}
?>

View File

@ -0,0 +1,13 @@
<?php
require_once(dirname(__FILE__)."/../autoload.inc.php");
class RP_sslStartInp extends RODSPacket
{
public function __construct($arg0="")
{
$packlets=array("arg0" => $arg0);
parent::__construct("sslStartInp_PI",$packlets);
}
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* Developer: Daniel
* Date: 11.01.13
* Time: 16:45
*/
require_once(dirname(__FILE__) . "/../autoload.inc.php");
class RP_ticketAdminInp extends RODSPacket
{
public function __construct($arg1 = 'session', // session -> 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);
}
}

View File

@ -0,0 +1,15 @@
; 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"

View File

@ -0,0 +1,31 @@
*'''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));

View File

@ -0,0 +1,70 @@
<?php
$PRODS_tree_root = dirname(__FILE__) . "/../../..";
$RODS_tree_root = "/opt/sifang/iRODS";
$capi_api_num_file = $RODS_tree_root . "/lib/api/include/apiNumber.h";
$prods_api_num_file = $PRODS_tree_root . "/clients/prods/src/RodsAPINum.inc.php";
// Add more API number here, if you wish. It will be added to the default
// RODS API number. Note that these API number are for web server/client
// only. RODS server does not recongnize them.
$new_api_nums = array(//array("SOMEAPI", 40000),
);
$value_pairs = array();
$lines = explode("\n", file_get_contents($capi_api_num_file));
foreach ($lines as $line) {
if (strlen($line) < 8) continue;
if (substr($line, 0, 7) == '#define') {
$rest = trim(substr($line, 7));
$tokens = preg_split("/\s+/", $rest);
var_dump($tokens);
if (count($tokens) < 2)
continue;
$val1 = NULL;
$val2 = NULL;
foreach ($tokens as $token) {
if (strlen($token) > 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 = "<?php \n" .
"/* This file is generated by " . basename(__FILE__) .
" Please modify that file if you wish to update the " .
" API number. */\n";
$outputstr = $outputstr . '$GLOBALS[\'PRODS_API_NUMS\']=array(' . "\n";
foreach ($value_pairs as $value_pair) {
$val1 = $value_pair[0];
$val2 = $value_pair[1];
$outputstr = $outputstr . " '$val1' => '$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);
?>

View File

@ -0,0 +1,75 @@
<?php
$RODS_tree_root = dirname(__FILE__) . "/../../..";
$capi_error_table_file = $RODS_tree_root . "/lib/core/include/rodsErrorTable.h";
$prods_error_table_file = $RODS_tree_root . "/clients/prods/src/RodsErrorTable.inc.php";
// Add more error code here, if you wish. It will be added to the default
// RODS error code. Note that these errors code are for web server/client
// only. RODS server does not recongnize them.
$new_error_codes = array(
array("GENERAL_PRODS_ERR", -3000000),
array("PERR_INTERNAL_ERR", -3100000),
array("PERR_UNEXPECTED_PACKET_FORMAT", -3101000),
array("PERR_PATH_DOES_NOT_EXISTS", -3102000),
array("PERR_UNSUPPORTED_PROTOCOL_SCHEME", -3103000),
array("PERR_USER_INPUT_ERROR", -3104000),
array("PERR_USER_INPUT_PATH_ERROR", -3105000),
array("PERR_CONN_NOT_ACTIVE", -3106000)
);
$value_pairs = array();
$lines = explode("\n", file_get_contents($capi_error_table_file));
foreach ($lines as $line) {
if (strlen($line) < 8) continue;
if (substr($line, 0, 7) == '#define') {
$rest = trim(substr($line, 7));
$tokens = preg_split("/\s+/", $rest);
if (count($tokens) < 2)
continue;
$val1 = NULL;
$val2 = NULL;
foreach ($tokens as $token) {
if (strlen($token) > 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 = "<?php \n" .
"/* This file is generated by setRodsErrorCodes.php. " .
" Please modify that file if you wish to update the " .
" error codes. */\n";
$outputstr = $outputstr . '$GLOBALS[\'PRODS_ERR_CODES\']=array(' . "\n";
foreach ($value_pairs as $value_pair) {
$val1 = $value_pair[0];
$val2 = $value_pair[1];
$outputstr = $outputstr . " '$val1' => '$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);
?>

View File

@ -0,0 +1,73 @@
<?php
$RODS_tree_root = dirname(__FILE__) . "/../../..";
$capi_genque_KeyWd_file = $RODS_tree_root . "/lib/core/include/rodsKeyWdDef.h";
$prods_genque_keywd_file = $RODS_tree_root . "/clients/prods/src/RodsGenQueryKeyWd.inc.php";
// Add more Query keywd here, if you wish. It will be added to the default
// RODS Gen Que number. Note that these number are for web server/client
// only. RODS server does not recongnize them.
$new_genque_keywds = array(//array("SOMEKEYWD", "SOMESTR"),
);
$value_pairs = array();
$lines = explode("\n", file_get_contents($capi_genque_KeyWd_file));
foreach ($lines as $line) {
if (strlen($line) < 8) continue;
if (substr($line, 0, 7) == '#define') {
$rest = trim(substr($line, 7));
$tokens = preg_split("/\s+/", $rest);
if (count($tokens) < 2)
continue;
$val1 = NULL;
$val2 = NULL;
foreach ($tokens as $token) {
if (strlen($token) > 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 = "<?php \n" .
"/* This file is generated by " . basename(__FILE__) .
" Please modify that file if you wish to update the " .
" Gen Query keywords. */\n";
$outputstr = $outputstr . '$GLOBALS[\'PRODS_GENQUE_KEYWD\']=array(' . "\n";
foreach ($value_pairs as $value_pair) {
$val1 = $value_pair[0];
$val2 = $value_pair[1];
$outputstr = $outputstr . " '$val1' => $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);
?>

View File

@ -0,0 +1,63 @@
<?php
$RODS_tree_root = dirname(__FILE__) . "/../../..";
$capi_genque_num_file = $RODS_tree_root . "/lib/core/include/rodsGenQuery.h";
$prods_genque_num_file = $RODS_tree_root . "/clients/prods/src/RodsGenQueryNum.inc.php";
// Add more GenQue number here, if you wish. It will be added to the default
// RODS Gen Que number. Note that these number are for web server/client
// only. RODS server does not recongnize them.
$new_genque_nums = array(//array("SOMENUMBER", 40000),
);
$value_pairs = array();
$lines = explode("\n", file_get_contents($capi_genque_num_file));
foreach ($lines as $line) {
if (strlen($line) < 8) continue;
if (substr($line, 0, 7) == '#define') {
$rest = trim(substr($line, 7));
$tokens = preg_split("/\s+/", $rest);
if (count($tokens) < 2)
continue;
$val1 = trim($tokens[0]);
$val2 = trim($tokens[1]);
if ((!empty($val1)) && (!empty($val2))) {
array_push($value_pairs, array($val1, 0 + $val2));
}
}
}
var_dump($value_pairs);
foreach ($new_genque_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 = "<?php \n" .
"/* This file is generated by " . basename(__FILE__) .
" Please modify that file if you wish to update the " .
" Gen Query number. */\n";
$outputstr = $outputstr . '$GLOBALS[\'PRODS_GENQUE_NUMS\']=array(' . "\n";
foreach ($value_pairs as $value_pair) {
$val1 = $value_pair[0];
$val2 = $value_pair[1];
$outputstr = $outputstr . " '$val1' => '$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);
?>

View File

@ -0,0 +1,145 @@
<?php
// reset the connection parameters below
$host = 'rt.sdsc.edu';
$port = 1247;
$user = 'rods';
$pass = 'RODS';
/**
* This simple script reads JPEG/TIFF files stored in iRODS, extract
* its EXIF information, and set it as userdefined metadata.
* Note: EXIF php module is required for this program to work properly
* http://us2.php.net/manual/en/ref.exif.php
*
* Example: php -f exif2meta.php /tempZone/home/rods/test2/RIMG0087.jpg
*/
//----------don't modify below this line!! -----------
require_once("../src/Prods.inc.php");
$target_file = $argv[1];
try {
$account = new RODSAccount($host, $port, $user, $pass);
$irodsfile = new ProdsFile($account, $target_file, true);
$metas = $irodsfile->getMeta();
$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, ''));
}
}
?>

View File

@ -0,0 +1,14 @@
*'''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