Copyright © 1998, 1999, 2000, 2001, 2002, 2003 The California Institute of Technology
All rights reserved.

Database fei
Stored Procedeures

Last update on January 27, 2003 by Helen Mortensen
Send questions, comments and corrections to DBA

Select one of these links to go to an overview page
| Database | Tables & Views | Triggers |


Click on a link for a detailed description of a object.
(Links are restricted to internal users.)

addAccessRole name, getFlag, addFlag, rplFlag, delFlag, proprietaryGet

Define an access role in the accessRole tablefor the given group name. An access role for a group must first be defined before file types or users can be assigned to it.

addBackupServerFor server, backupHost, backupPort

Adds the host and port numbers for a backup instance of an FEI server. The server record must first exists, use addServer, before this procedure can be used to add a backup network address and port number. Not fully implemented.

addFile ftIdx, fileName, crcValue, size

Used by FEI servers to add a file to the files table.

addFileType name, mission, megaBytesReserved, feiServer, host, directory, crcFlag, encryptFlag, description

Add a file type record to the fileTypes table.

addFileTypeRole fileType, role

Associate an access role with a file type. Members having the access role can then access this file type with the capabilities of the access role. Use the view fileTypeRoleInfo to see this information.

addServer name, host, port, krbRealm

Inserts a new record into the feiServers table. If the netTyep is not supplied, the default value of /dev/tcp is supplied. (Most likely this is what you want.) To add a backup server for this record, use the procedure addBackupServerFor to add backup server information once you've defined the server.

addService service, fileType, capability, onError, seqNum

Associate a service with a file type. This information is stored in the feiServices table.

The capability associated with a service can be 1 - get, 2 - add, 4 - replace, 8 - delete. A service definition must be entered for each distinct {file type, capability} pair.

The new field onError means on error do: 0 - Fail capability on service reported error. 1 - Stop processing services but don't fail capability. 2 - Just continue service processing.

addSrvParameter server, parameter, value

Associates a server parameter with an FEI server. Only parameters defined in the srvParameterDefinitions table can be associated with an FEI server. If server name is NULL, the list of server parameters names is returned.

addUserRole name, role

Associate a principal, or user, with an access role. Once the association is made, the prinicipal, has the capabilities of the role.

changeFileTypeDesc fileType, description

Update an existing file type, adding a description to it. See also addFileType.

changeFileTypeDirectory fileType, host, directory

Update the host and directory for a file type. Since these values can initially be NULL, this procedure can also be used to set the initial values for these attributes. See also addFileType.

changeFileTypeServer fileType, server

Change the FEI server that manages a fileType. Since the file type may not be assigned to a server, the server value is NULL, this is a way to make the initial assignment as well. See also addFileType.

deleteFile fileIdx

Delete the record of a file in the FEI files table. Use by FEI servers.

deleteFileType fileType

Delete a file type from the fileTypes table. The trigger fileTypes_D will delete any file type roles for this file type. A file type can't be deleted if files are associated with it in the files table. (This constraint is enforced by the fileTypes_D trigger.)

deleteFileTypeRole fileType, role

Deletes a record from the fileTypeRoles table that associates a file type and an access role. If the role is not supplied all associations between the file type and roles are deleted.

feiShutdown serverName

Sets the value of stoppedAt in the feiServer table to the current time for the named server. Used by FEI servers.

fileCheckInfo ftIdx, since

Returns information used by the FEI admin utility FeiFileCheck. If a date is supplied, files with a modification date on that date or later are returned.

getAccessRolesForFileType ftIdx

Get the defined capabilities (access roles) for the file type. Used by FEI servers.

getFeiServerInfo serverName

Used by FEI servers at boot time to get information about the server's configuration.

getFile ftIdx, fileName

Get the fileIdx, status, CRC value and file modification time for a file when the ftIdx and fileName values are known. Use by an FEI server when it's about to retrieve a file. The file's modification time is returned using the following time format: yy-dyThh:mi:ss.ms. the time format

getFilesForType ftIdx, namePattern, sortFlag, since

Obtain a list of files for a specified type. Used by FEI servers. If sortFlag is 0, sort by name. Otherwise, sort by time. The since parameter is only used for time-based sorts.

getFileTypesForServer feiServerIdx

Used by FEI servers at boot time to get the description of file types managed by a server.

getFtIdx fileType

Return the ftIdx for a file type from the fileTypes table. Used by FEI servers.

getServicesForFileType ftIdx, capability

Get the Services for the specified file type, fei Server and capability. Used by FEI servers.

getSysDate

Get the date and time in space-time format: yy-dyThh:mi:ss.ms. Used by FEI servers.

getUserRoles name

Get the user roles for the identified principal. Used by FEI servers.

markFileForDelete ftIdx, fileName, @fileIdx

Marks a file for delete by changing its status. Returns the fileIdx. Once the file is deleted, use deleteFile to delete the record in the catalog. Used by FEI servers.

markFileForReplace ftIdx, fileName, contributor, @fileIdx

Marks a file for replace by changing its status. Returns the fileIdx. Once the file is replaced, use the updateFileStatus to change status to final value. Used by FEI servers.

setProprietaryTime fileType, timeValue

Set the proprietary time for a file type in the fileTypes table by updating the file type's proprietaryTime value. If the value is NULL, the default, there is no proprietary time for the file type.

To see proprietary files, a user and file type must be associated with a role, that has the proprietaryGet capability turned on, see the accessRoles table.

showAccessRole role

Shows access role and capabilities for the role. If not role is specified, shows information for all roles.

showBadFiles fileType

Show file information for files with a bad status value, files.status < 4. If the file type is not supplied, all bad file records are retrieved.

showDomainFile

Generates an FEI domain file. This procedure retrieves FEI connection information and formats it as an feiDomain file. Use this procedure to generate a new feiDomain file whenever file types are changes or the association between an FEI server and one or more file types changes.

The feiDomain file is distributed to client machines from which FEI server connections are made.

showFeiServer name, showFileTypes

Displays the configuration information for an FEI server found in the feiServers and srvParameters tables. If no server name is supplied, information for each server is displayed. The server name can be a regular expression, e.g. fei%.

showFileCount fileType, startAt, endAt

Shows the count of all files, files with normal status, and files with bad status. If not arguments are present, shows counts for files of all file types. If a fileType is named, shows counts for files of that type only. If a startAt time is included, shows counts for files of the specified type that were received by the system at that time or later. If endAt time is also included, shows counts for files for the time period specified.

showFileIdx ftIdx, fileName

Returns the fileIdx for a file registered in the FEI files table associated with the supplied ftIdx and fileName. Used by the admin program FeiFileCheck that does a files consistency check between files listed in the files table and those found in an FEI managed directory.

showFiles fileType, since, endAt

Shows a set of files in the FEI domain. If the file type is not supplied, all files are displayed by file type. If a file type and a date are supplied, only files since that time are displayed. If the endAt date is also included, the files shown are bounded by the since and endAt dates. (Note: A data can be just the date or it cany include a time a well.) The information returned includes the file name, date and time received and size of the file in bytes.

showFileType fileType

Show fields from the fileTypes table that are of interest to the end-user community. Note: this specifically does not include file location information. File location is transparent to the user. If no file type is supplied, information on all file types is returned.

showServerTime

Shows the amount of time a server has been running. Also shows those servers not running.

showServicesForFileType fileType

Returns the service information associated with a file type and capability: g (get), a (add), d (delete) and r (replace). ??? Review this. - JR

updateAllStats

Update statistics on all of the tables in the FEI database. Doing this after new data is entered into the tables will often make queries run faster.

updateFileStatus ftIdx, fileName, status, crcValue, size, modified

Change the status for a file in the files table. Used by FEI servers.

Notes:

If crcValue and size are NULL, and we are not deleting, then we are using this procedure to rollback a failed delete. So, don't lose our size and crcValue fields. Otherwise, the server is providing these values.

If a file is being added or replaced, then we return the modified time as stored procedure return values. Otherwise, these return values are NULL.

updateServerParameter server, parameter, newValue

Updates the value of a parameter for a server in the srvParameters table.