view release on metacpan or search on metacpan
lib/AFS/Command/BOS.pm view on Meta::CPAN
use English;
use AFS::Command::Base;
use AFS::Object;
use AFS::Object::BosServer;
use AFS::Object::Instance;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub getdate {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getdate";
my $directory = $args{dir} || '/usr/afs/bin';
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getlog {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getlog";
my $redirect = undef;
my $redirectname = undef;
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getrestart {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "getrestart";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listhosts {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listhosts";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
$result->_setAttribute( hosts => \@hosts );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listkeys {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listkeys";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listusers {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "listusers";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
return if $errors;
return $result;
}
#
# XXX -- we might want to provide parsing of the bos salvage output,
# but for now, this is a non-parsed command.
#
# sub salvage {
# my $self = shift;
# my (%args) = @_;
# my $result = AFS::Object::BosServer->new();
# $self->{operation} = "salvage";
# return unless $self->_parse_arguments(%args);
lib/AFS/Command/BOS.pm view on Meta::CPAN
# }
# $errors++ unless $self->_reap_cmds();
# $errors++ unless $self->_restore_stderr();
# return if $errors;
# return $result;
# }
sub status {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::BosServer->new();
$self->{operation} = "status";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/Base.pm view on Meta::CPAN
our $AUTOLOAD = "";
our $VERSION = '1.99';
our %Carp =
(
carp => \&Carp::carp,
croak => \&Carp::croak,
);
sub setCarp {
my $class = shift;
my (%args) = @_;
foreach my $key ( keys %args ) {
unless ( $Carp{$key} ) {
croak("Unsupported argument: '$key'");
}
unless ( ref $args{$key} eq 'CODE' ) {
croak("Not a code reference: '$args{$key}'");
}
$Carp{$key} = $args{$key};
}
return AFS::Object->_setCarp(@_);
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my %args = @_;
my $self = {};
foreach my $key ( qw( localtime noauth localauth encrypt quiet timestamps ) ) {
$self->{$key}++ if $args{$key};
}
lib/AFS/Command/Base.pm view on Meta::CPAN
} else {
@{$self->{command}} = lc((split(/::/,$class))[2]);
}
bless $self, $class;
return $self;
}
sub errors {
my $self = shift;
return $self->{errors};
}
sub supportsOperation {
my $self = shift;
my $operation = shift;
return $self->_operations($operation);
}
sub supportsArgument {
my $self = shift;
my $operation = shift;
my $argument = shift;
return unless $self->_operations($operation);
return unless $self->_arguments($operation);
return exists $self->{_arguments}->{$operation}->{$argument};
}
sub _Carp {
my $self = shift;
$Carp{carp}->(@_);
}
sub _Croak {
my $self = shift;
$Carp{croak}->(@_);
}
sub _operations {
my $self = shift;
my $operation = shift;
my $class = ref $self;
unless ( $self->{_operations} ) {
my %operations = ();
lib/AFS/Command/Base.pm view on Meta::CPAN
}
$self->{_operations} = \%operations;
}
return $self->{_operations}->{$operation};
}
sub _arguments {
my $self = shift;
my $operation = shift;
my $arguments =
{
optional => {},
required => {},
aliases => {},
};
lib/AFS/Command/Base.pm view on Meta::CPAN
if ( $? ) {
$self->_Carp("Error running @command $operation -help. Unable to configure @command $operation");
$errors++;
}
return if $errors;
return $self->{_arguments}->{$operation} = $arguments;
}
sub _save_stderr {
my $self = shift;
$self->{olderr} = IO::File->new(">&STDERR") || do {
$self->_Carp("Unable to dup stderr: $ERRNO");
return;
};
my $command = basename((split /\s+/,@{$self->{command}})[0]);
lib/AFS/Command/Base.pm view on Meta::CPAN
$newerr->close() || do {
$self->_Carp("Unable to close $self->{tmpfile}: $ERRNO");
return;
};
return 1;
}
sub _restore_stderr {
my $self = shift;
STDERR->fdopen( $self->{olderr}->fileno(), "w") || do {
$self->_Carp("Unable to restore stderr: $ERRNO");
return;
};
$self->{olderr}->close() || do {
$self->_Carp("Unable to close saved stderr: $ERRNO");
lib/AFS/Command/Base.pm view on Meta::CPAN
$self->_Carp("Unable to unlink $self->{tmpfile}: $ERRNO");
return;
};
delete $self->{tmpfile};
return 1;
}
sub _parse_arguments {
my $self = shift;
my $class = ref($self);
my (%args) = @_;
my $arguments = $self->_arguments($self->{operation});
unless ( defined $arguments ) {
$self->_Carp("Unable to obtain arguments for $class->$self->{operation}");
return;
lib/AFS/Command/Base.pm view on Meta::CPAN
}
push( @{$self->{cmds}}, \@argv );
}
return 1;
}
sub _exec_cmds {
my $self = shift;
my %args = @_;
my @cmds = @{$self->{cmds}};
$self->{pids} = {};
for ( my $index = 0 ; $index <= $#cmds ; $index++ ) {
lib/AFS/Command/Base.pm view on Meta::CPAN
$self->{handle} = $pipe->reader();
$self->{pids}->{$pid} = $cmd;
}
return 1;
}
sub _parse_output {
my $self = shift;
$self->{errors} = "";
while ( defined($_ = $self->{handle}->getline()) ) {
$self->{errors} .= time2str("[%Y-%m-%d %H:%M:%S] ",time,'GMT') if $self->{timestamps};
$self->{errors} .= $_;
}
return 1;
}
sub _reap_cmds {
my $self = shift;
my (%args) = @_;
my $errors = 0;
$self->{handle}->close() || do {
$self->_Carp("Unable to close pipe handle: $ERRNO");
$errors++;
};
lib/AFS/Command/Base.pm view on Meta::CPAN
$errors++;
}
}
return if $errors;
return 1;
}
sub AUTOLOAD {
my $self = shift;
my (%args) = @_;
$self->{operation} = $AUTOLOAD;
$self->{operation} =~ s/.*:://;
return unless $self->_parse_arguments(%args);
return unless $self->_exec_cmds( stderr => 'stdout' );
lib/AFS/Command/Base.pm view on Meta::CPAN
my $errors = 0;
$errors++ unless $self->_parse_output();
$errors++ unless $self->_reap_cmds();
return if $errors;
return 1;
}
sub DESTROY {}
1;
lib/AFS/Command/Base.pod view on Meta::CPAN
mechanism for trapping these errors and redirecting them elsewhere.
For example, stderr in a system daemon may be entirely ignored, and
syslog may be a more appropriate destination. In this case, the
setCarp method may be used to configure this, globally, for the entire
API.
AFS::Command->setCarp
(
carp => sub {
my ($lines) = @_;
foreach my $line ( split(/\n+/,$lines) ) {
syslog('warning',$line);
}
},
croak => sub {
my ($lines) = @_;
foreach my $line ( split(/\n+/,$lines) ) {
syslog('error',$line);
}
die $lines; # If we're dying, whine at stderr, too.
},
);
This method takes a list of key/value pairs, with only two supported
lib/AFS/Command/FS.pm view on Meta::CPAN
use AFS::Object;
use AFS::Object::CacheManager;
use AFS::Object::Path;
use AFS::Object::Cell;
use AFS::Object::Server;
use AFS::Object::ACL;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub checkservers {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "checkservers";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$result->_setAttribute( servers => \@servers );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub diskfree {
my $self = shift;
return $self->_paths_method('diskfree',@_);
}
sub examine {
my $self = shift;
return $self->_paths_method('examine',@_);
}
sub listquota {
my $self = shift;
return $self->_paths_method('listquota',@_);
}
sub quota {
my $self = shift;
return $self->_paths_method('quota',@_);
}
sub storebehind {
my $self = shift;
return $self->_paths_method('storebehind',@_);
}
sub whereis {
my $self = shift;
return $self->_paths_method('whereis',@_);
}
sub whichcell {
my $self = shift;
return $self->_paths_method('whichcell',@_);
}
sub listacl {
my $self = shift;
return $self->_paths_method('listacl',@_);
}
sub _paths_method {
my $self = shift;
my $operation = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = $operation;
my $pathkey = $operation eq 'storebehind' ? 'files' : 'path';
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds( allowstatus => 1 );
return if $errors;
return $result;
}
sub exportafs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object->new();
$self->{operation} = "exportafs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcacheparms {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcacheparms";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcellstatus {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcellstatus";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getclientaddrs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getclientaddrs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$result->_setAttribute( addresses => \@addresses );
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getcrypt {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getcrypt";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub getserverprefs {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "getserverprefs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listaliases {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "listaliases";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listcells {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "listcells";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub lsmount {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "lsmount";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds( allowstatus => 1 );
return if $errors;
return $result;
}
#
# This is deprecated in newer versions of OpenAFS
#
sub monitor {
my $self = shift;
$self->_Carp("fs monitor: This operation is deprecated and no longer supported");
return;
}
sub sysname {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "sysname";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/FS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub wscell {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::CacheManager->new();
$self->{operation} = "wscell";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
use AFS::Command::Base;
use AFS::Object;
use AFS::Object::PTServer;
use AFS::Object::Principal;
use AFS::Object::Group;
use AFS::Object::User;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub creategroup {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "creategroup";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub createuser {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "createuser";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub examine {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "examine";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listentries {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listentries";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listmax {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listmax";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listowned {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "listowned";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/PTS.pm view on Meta::CPAN
$result->_addUser($user) if $user;
$result->_addGroup($group) if $group;
$errors++ unless $self->_reap_cmds();
return if $errors;
return $result;
}
sub membership {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::PTServer->new();
$self->{operation} = "membership";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
use AFS::Object::Volume;
use AFS::Object::VolumeHeader;
use AFS::Object::VolServer;
use AFS::Object::FileServer;
use AFS::Object::Partition;
use AFS::Object::Transaction;
our @ISA = qw(AFS::Command::Base);
our $VERSION = '1.99';
sub examine {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::Volume->new();
my $entry = AFS::Object::VLDBEntry->new( locked => 0 );
$self->{operation} = "examine";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listaddrs {
my $self = shift;
my (%args) = @_;
my @result = ();
$self->{operation} = "listaddrs";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return @result;
}
sub listpart {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::FileServer->new();
$self->{operation} = "listpart";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
}
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listvldb {
my $self = shift;
my (%args) = @_;
$self->{operation} = "listvldb";
my $locked = 0;
my $result = AFS::Object::VLDB->new();
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub listvol {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::VolServer->new();
$self->{operation} = "listvol";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub partinfo {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::FileServer->new();
$self->{operation} = "partinfo";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub status {
my $self = shift;
my (%args) = @_;
my $result = AFS::Object::VolServer->new();
$self->{operation} = "status";
return unless $self->_parse_arguments(%args);
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return $result;
}
sub dump {
my $self = shift;
my (%args) = @_;
$self->{operation} = 'dump';
my $file = delete $args{file} || do {
$self->_Carp("Missing required argument: 'file'");
return;
};
lib/AFS/Command/VOS.pm view on Meta::CPAN
$errors++ unless $self->_reap_cmds();
$errors++ unless $self->_restore_stderr();
return if $errors;
return 1;
}
sub restore {
my $self = shift;
my (%args) = @_;
$self->{operation} = "restore";
my $file = delete $args{file} || do {
$self->_Carp("Missing required argument: 'file'");
return;
};
lib/AFS/Object.pm view on Meta::CPAN
our $AUTOLOAD = "";
our $VERSION = '1.99';
our %Carp =
(
carp => \&Carp::carp,
croak => \&Carp::croak,
);
sub _setCarp {
my $class = shift;
my (%args) = @_;
foreach my $key ( keys %args ) {
$Carp{$key} = $args{$key};
}
return 1;
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = { _attrs => { @_ } };
return bless $self, $class;
}
sub listAttributes {
my $self = shift;
return keys %{$self->{_attrs}};
}
sub getAttribute {
my $self = shift;
my $attr = shift;
return $self->{_attrs}->{$attr};
}
sub getAttributes {
my $self = shift;
my $attr = shift;
return %{$self->{_attrs}};
}
sub hasAttribute {
my $self = shift;
my $attr = shift;
return exists $self->{_attrs}->{$attr};
}
sub _Carp {
my $self = shift;
$Carp{carp}->(@_);
}
sub _Croak {
my $self = shift;
$Carp{croak}->(@_);
}
sub _setAttribute {
my $self = shift;
my (%attrs) = @_;
foreach my $attr ( keys %attrs ) {
$self->{_attrs}->{$attr} = $attrs{$attr};
}
return 1;
}
sub DESTROY {}
sub AUTOLOAD {
my $self = shift;
my $attr = $AUTOLOAD;
$attr =~ s/.*:://;
return $self->{_attrs}->{$attr};
}
1;
lib/AFS/Object/ACL.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::ACL;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPrincipals {
my $self = shift;
return unless ref $self->{_principals};
return keys %{$self->{_principals}};
}
sub getRights {
my $self = shift;
my $principal = shift;
return unless ref $self->{_principals};
return $self->{_principals}->{lc($principal)};
}
sub getEntries {
my $self = shift;
return unless ref $self->{_principals};
return %{$self->{_principals}};
}
sub _addEntry {
my $self = shift;
my $principal = shift;
my $rights = shift;
return $self->{_principals}->{$principal} = $rights;
}
1;
lib/AFS/Object/BosServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::BosServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getInstanceNames {
my $self = shift;
return unless ref $self->{_instances};
return keys %{$self->{_instances}};
}
sub getInstance {
my $self = shift;
my $name = shift;
return unless ref $self->{_instances};
return $self->{_instances}->{$name};
}
sub getInstances {
my $self = shift;
return unless ref $self->{_instances};
return values %{$self->{_instances}};
}
sub _addInstance {
my $self = shift;
my $instance = shift;
unless ( ref $instance && $instance->isa("AFS::Object::Instance") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Instance object");
}
return $self->{_instances}->{$instance->instance()} = $instance;
}
sub getFileNames {
my $self = shift;
return unless ref $self->{_files};
return keys %{$self->{_files}};
}
sub getFile {
my $self = shift;
my $filename = shift;
return unless ref $self->{_files};
return $self->{_files}->{$filename};
}
sub getFiles {
my $self = shift;
return unless ref $self->{_files};
return values %{$self->{_files}};
}
sub _addFile {
my $self = shift;
my $file = shift;
unless ( ref $file && $file->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_files}->{$file->file()} = $file;
}
sub getKeyIndexes {
my $self = shift;
return unless ref $self->{_keys};
return keys %{$self->{_keys}};
}
sub getKey {
my $self = shift;
my $index = shift;
return unless ref $self->{_keys};
return $self->{_keys}->{$index};
}
sub getKeys {
my $self = shift;
return unless ref $self->{_keys};
return values %{$self->{_keys}};
}
sub _addKey {
my $self = shift;
my $key = shift;
unless ( ref $key && $key->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_keys}->{$key->index()} = $key;
}
1;
lib/AFS/Object/CacheManager.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::CacheManager;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPathNames {
my $self = shift;
return unless ref $self->{_pathnames};
return keys %{$self->{_pathnames}};
}
sub getPaths {
my $self = shift;
return unless ref $self->{_pathnames};
return values %{$self->{_pathnames}};
}
sub getPath {
my $self = shift;
my $path = shift;
return unless ref $self->{_pathnames};
return $self->{_pathnames}->{$path};
}
sub _addPath {
my $self = shift;
my $path = shift;
unless ( ref $path && $path->isa("AFS::Object::Path") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Path object");
}
return $self->{_pathnames}->{$path->path()} = $path;
}
sub getCellNames {
my $self = shift;
return unless ref $self->{_cells};
return keys %{$self->{_cells}};
}
sub getCells {
my $self = shift;
return unless ref $self->{_cells};
return values %{$self->{_cells}};
}
sub getCell {
my $self = shift;
my $cell = shift;
return unless ref $self->{_cells};
return $self->{_cells}->{$cell};
}
sub _addCell {
my $self = shift;
my $cell = shift;
unless ( ref $cell && $cell->isa("AFS::Object::Cell") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Cell object");
}
return $self->{_cells}->{$cell->cell()} = $cell;
}
sub getServerNames {
my $self = shift;
return unless ref $self->{_servers};
return keys %{$self->{_servers}};
}
sub getServers {
my $self = shift;
return unless ref $self->{_servers};
return values %{$self->{_servers}};
}
sub getServer {
my $self = shift;
my $server = shift;
return unless ref $self->{_servers};
return $self->{_servers}->{$server};
}
sub _addServer {
my $self = shift;
my $server = shift;
unless ( ref $server && $server->isa("AFS::Object::Server") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Server object");
}
return $self->{_servers}->{$server->server()} = $server;
}
1;
lib/AFS/Object/FileServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::FileServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPartitionNames {
my $self = shift;
return unless ref $self->{_partitions};
return keys %{$self->{_partitions}};
}
sub getPartitions {
my $self = shift;
return unless ref $self->{_partitions};
return values %{$self->{_partitions}};
}
sub getPartition {
my $self = shift;
my $partname = shift;
return unless ref $self->{_partitions};
return $self->{_partitions}->{$partname};
}
sub _addPartition {
my $self = shift;
my $partition = shift;
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Partition object");
}
return $self->{_partitions}->{$partition->partition()} = $partition;
}
1;
lib/AFS/Object/Instance.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Instance;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getCommandIndexes {
my $self = shift;
return unless ref $self->{_commands};
return sort keys %{$self->{_commands}};
}
sub getCommands {
my $self = shift;
return unless ref $self->{_commands};
return values %{$self->{_commands}};
}
sub getCommand {
my $self = shift;
my $index = shift;
return unless ref $self->{_commands};
return $self->{_commands}->{$index};
}
sub _addCommand {
my $self = shift;
my $command = shift;
unless ( ref $command && $command->isa("AFS::Object") ) {
$self->_Croak("Invalid argument: must be an AFS::Object object");
}
return $self->{_commands}->{$command->index()} = $command;
}
1;
lib/AFS/Object/PTServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::PTServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getGroupNames {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return keys %{$self->{_groups}->{_byName}};
}
sub getGroupIds {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byId};
return keys %{$self->{_groups}->{_byId}};
}
sub getGroups {
my $self = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return values %{$self->{_groups}->{_byName}};
}
sub getGroupByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return $self->{_groups}->{_byName}->{lc($name)};
}
sub getGroupById {
my $self = shift;
my $id = shift;
return unless ref $self->{_groups} && ref $self->{_groups}->{_byId};
return $self->{_groups}->{_byId}->{$id};
}
sub getGroup {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/PTServer.pm view on Meta::CPAN
return $self->{_groups}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_groups} && ref $self->{_groups}->{_byName};
return $self->{_groups}->{_byName}->{lc($args{name})};
}
}
sub _addGroup {
my $self = shift;
my $group = shift;
unless ( ref $group && $group->isa("AFS::Object::Group") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Group object");
}
if ( $group->hasAttribute('name') ) {
my $name = $group->name();
lib/AFS/Object/PTServer.pm view on Meta::CPAN
$self->{_groups}->{_byId}->{$id} = $group;
} else {
$self->_Croak("Group has no id attribute!!\n" .
Data::Dumper->Dump([$group],['group']));
}
return 1;
}
sub getUserNames {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return keys %{$self->{_users}->{_byName}};
}
sub getUserIds {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byId};
return keys %{$self->{_users}->{_byId}};
}
sub getUsers {
my $self = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return values %{$self->{_users}->{_byName}};
}
sub getUserByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return $self->{_users}->{_byName}->{lc($name)};
}
sub getUserById {
my $self = shift;
my $id = shift;
return unless ref $self->{_users} && ref $self->{_users}->{_byId};
return $self->{_users}->{_byId}->{$id};
}
sub getUser {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/PTServer.pm view on Meta::CPAN
return $self->{_users}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_users} && ref $self->{_users}->{_byName};
return $self->{_users}->{_byName}->{lc($args{name})};
}
}
sub _addUser {
my $self = shift;
my $user = shift;
unless ( ref $user && $user->isa("AFS::Object::User") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::User object");
}
if ( $user->hasAttribute('name') ) {
my $name = $user->name();
lib/AFS/Object/Partition.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Partition;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeIds {
my $self = shift;
return unless ref $self->{_headers};
return keys %{$self->{_headers}->{_byId}};
}
sub getVolumeNames {
my $self = shift;
return unless ref $self->{_headers};
return keys %{$self->{_headers}->{_byName}};
}
sub getVolumeHeaderById {
my $self = shift;
my $id = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byId};
return $self->{_headers}->{_byId}->{$id};
}
sub getVolumeHeaderByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byName};
return $self->{_headers}->{_byName}->{$name};
}
sub getVolumeHeaders {
my $self = shift;
return unless ref $self->{_headers} && ref $self->{_headers}->{_byId};
return values %{$self->{_headers}->{_byId}};
}
sub getVolumeHeader {
my $self = shift;
my (%args) = @_;
if ( exists $args{id} && exists $args{name} ) {
$self->_Carp("Invalid arguments: both of 'id' or 'name' may not be specified");
return;
}
unless ( exists $args{id} || exists $args{name} ) {
lib/AFS/Object/Partition.pm view on Meta::CPAN
return $self->{_headers}->{_byId}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_headers} && ref $self->{_headers}->{_byName};
return $self->{_headers}->{_byName}->{$args{name}};
}
}
sub _addVolumeHeader {
my $self = shift;
my $header = shift;
unless ( ref $header && $header->isa("AFS::Object::VolumeHeader") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VolumeHeader object");
}
if ( $header->hasAttribute('name') ) {
$self->{_headers}->{_byName}->{$header->name()} = $header;
lib/AFS/Object/Path.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Path;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getACL {
my $self = shift;
my $type = shift || 'normal';
return unless ref $self->{_acl};
return $self->{_acl}->{"_$type"};
}
sub getACLNormal {
my $self = shift;
return $self->getACL();
}
sub getACLNegative {
my $self = shift;
return $self->getACL('negative');
}
sub _setACLNormal {
my $self = shift;
my $acl = shift;
unless ( ref $acl && $acl->isa("AFS::Object::ACL") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::ACL object");
}
return $self->{_acl}->{_normal} = $acl;
}
sub _setACLNegative {
my $self = shift;
my $acl = shift;
unless ( ref $acl && $acl->isa("AFS::Object::ACL") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::ACL object");
}
return $self->{_acl}->{_negative} = $acl;
lib/AFS/Object/Principal.pm view on Meta::CPAN
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Principal;
use strict;
our $VERSION = '1.99';
sub _addOwned {
my $self = shift;
my $owned = shift;
return $self->{_owned}->{$owned}++;
}
sub getOwned {
my $self = shift;
return unless ref $self->{_owned};
return keys %{$self->{_owned}};
}
sub _addMembership {
my $self = shift;
my $membership = shift;
return $self->{_membership}->{$membership}++;
}
sub getMembership {
my $self = shift;
return unless ref $self->{_membership};
return keys %{$self->{_membership}};
}
1;
lib/AFS/Object/VLDB.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VLDB;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeNames {
my $self = shift;
return unless ref $self->{_names};
return keys %{$self->{_names}};
}
sub getVolumeIds {
my $self = shift;
return unless ref $self->{_ids};
return keys %{$self->{_ids}};
}
sub getVLDBEntry {
my $self = shift;
my %args = ();
if ( $#_ == 0 ) {
if ( $^W ) {
$self->_Carp("WARNING: getVLDBEntry(\$name) usage is deprecated\n" .
"Use getVLDBENtryByName(\$name), or getVLDBERntry( name => \$name )\n");
}
lib/AFS/Object/VLDB.pm view on Meta::CPAN
return $self->{_ids}->{$args{id}};
}
if ( exists $args{name} ) {
return unless ref $self->{_names};
return $self->{_names}->{$args{name}};
}
}
sub getVLDBEntryByName {
my $self = shift;
my $name = shift;
return unless ref $self->{_names};
return $self->{_names}->{$name};
}
sub getVLDBEntryById {
my $self = shift;
my $id = shift;
return unless ref $self->{_ids};
return $self->{_ids}->{$id};
}
sub getVLDBEntries {
my $self = shift;
return unless ref $self->{_names};
return values %{$self->{_names}};
}
sub _addVLDBEntry {
my $self = shift;
my $entry = shift;
unless ( ref $entry && $entry->isa("AFS::Object::VLDBEntry") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBEntry object");
}
foreach my $id ( $entry->rwrite(), $entry->ronly(),
$entry->backup(), $entry->rclone() ) {
lib/AFS/Object/VLDBEntry.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VLDBEntry;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVLDBSites {
my $self = shift;
return unless ref $self->{_sites};
return @{$self->{_sites}};
}
sub _addVLDBSite {
my $self = shift;
my $site = shift;
unless ( ref $site && $site->isa("AFS::Object::VLDBSite") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBSite object");
}
return push( @{$self->{_sites}}, $site );
}
1;
lib/AFS/Object/VolServer.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::VolServer;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getPartitionNames {
my $self = shift;
return unless ref $self->{_partitions};
return keys %{$self->{_partitions}};
}
sub getPartitions {
my $self = shift;
return unless ref $self->{_partitions};
return values %{$self->{_partitions}};
}
sub getPartition {
my $self = shift;
my $partname = shift;
return unless ref $self->{_partitions};
return $self->{_partitions}->{$partname};
}
sub _addPartition {
my $self = shift;
my $partition = shift;
unless ( ref $partition && $partition->isa("AFS::Object::Partition") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Partition object");
}
return $self->{_partitions}->{$partition->partition()} = $partition;
}
sub getTransactions {
my $self = shift;
return unless ref $self->{_volumes};
return values %{$self->{_volumes}};
}
sub getVolumes {
my $self = shift;
return unless ref $self->{_volumes};
return keys %{$self->{_volumes}};
}
sub getTransactionByVolume {
my $self = shift;
my $volume = shift;
return unless ref $self->{_volumes};
return $self->{_volumes}->{$volume};
}
sub _addTransaction {
my $self = shift;
my $transaction = shift;
unless ( ref $transaction && $transaction->isa("AFS::Object::Transaction") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::Transaction object");
}
unless ( $transaction->volume() ) {
$self->_Croak("Invalid AFS::Object::Transaction object: has no 'volume' attribute");
lib/AFS/Object/Volume.pm view on Meta::CPAN
# See ..../src/LICENSE for terms of distribution.
#
package AFS::Object::Volume;
use strict;
our @ISA = qw(AFS::Object);
our $VERSION = '1.99';
sub getVolumeHeaders {
my $self = shift;
return unless ref $self->{_headers};
return @{$self->{_headers}};
}
sub _addVolumeHeader {
my $self = shift;
my $header = shift;
unless ( ref $header && $header->isa("AFS::Object::VolumeHeader") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VolumeHeader object");
}
return push( @{$self->{_headers}}, $header );
}
sub getVLDBEntry {
my $self = shift;
return $self->{_vldbentry};
}
sub _addVLDBEntry {
my $self = shift;
my $entry = shift;
unless ( ref $entry && $entry->isa("AFS::Object::VLDBEntry") ) {
$self->_Croak("Invalid argument: must be an AFS::Object::VLDBEntry object");
}
return $self->{_vldbentry} = $entry;
}
1;
util/bin/check_copyright view on Meta::CPAN
if ( $rcs ) {
system("echo 'Updated copyright year' | ci -u $old > /dev/null");
die "Unable to ci -u $old\n" if $? >> 8;
}
}
exit $errors ? 1 : 0;
sub rcs {
my ($file) = @_;
my $dirname = dirname($file);
my $basename = basename($file);
return -f "$dirname/RCS/$basename,v" ? "$dirname/RCS/$basename,v" : "";
}
util/bin/check_version view on Meta::CPAN
if ( $rcs ) {
system("echo 'Updated \$VERSION to $newversion' | ci -u $old > /dev/null");
die "Unable to ci -u $old\n" if $? >> 8;
}
}
exit 0;
sub rcs {
my ($file) = @_;
my $dirname = dirname($file);
my $basename = basename($file);
return -f "$dirname/RCS/$basename,v" ? "$dirname/RCS/$basename,v" : "";
}