Apache-Sling

 view release on metacpan or  search on metacpan

lib/Apache/Sling/Authz.pm  view on Meta::CPAN

#{{{sub config

sub config {
    my ( $authz, $sling, @ARGV ) = @_;
    my $authz_config = $authz->config_hash( $sling, @ARGV );

    GetOptions(
        $authz_config,     'auth=s',
        'help|?',           'log|L=s',
        'man|M',            'pass|p=s',
        'threads|t=s',      'url|U=s',
        'user|u=s',         'verbose|v+',
        'addChildNodes!',   'all!',
        'delete|d',         'lifecycleManage!',
        'lockManage!',      'modifyACL!',
        'modifyProps!',     'nodeTypeManage!',
        'principal|P=s',    'readACL!',
        'read!',            'remote|r=s',
        'removeChilds!',    'removeNode!',
        'retentionManage!', 'versionManage!',
        'view|V',           'write!'

lib/Apache/Sling/Authz.pm  view on Meta::CPAN

    my $retention_manage;
    my $version_manage;
    my $write;

    my %authz_config = (
        'auth'            => \$sling->{'Auth'},
        'help'            => \$sling->{'Help'},
        'log'             => \$sling->{'Log'},
        'man'             => \$sling->{'Man'},
        'pass'            => \$sling->{'Pass'},
        'threads'         => \$sling->{'Threads'},
        'url'             => \$sling->{'URL'},
        'user'            => \$sling->{'User'},
        'verbose'         => \$sling->{'Verbose'},
        'addChildNodes'   => \$add_child_nodes,
        'all'             => \$all,
        'delete'          => \$delete,
        'lifecycleManage' => \$life_cycle_manage,
        'lockManage'      => \$lock_manage,
        'modifyACL'       => \$modify_acl,
        'modifyProps'     => \$modify_props,

lib/Apache/Sling/Content.pm  view on Meta::CPAN

#{{{sub config

sub config {
    my ( $content, $sling, @ARGV ) = @_;
    my $content_config = $content->config_hash( $sling, @ARGV );

    GetOptions(
        $content_config,    'auth=s',
        'help|?',            'log|L=s',
        'man|M',             'pass|p=s',
        'threads|t=s',       'url|U=s',
        'user|u=s',          'verbose|v+',
        'add|a',             'additions|A=s',
        'copy|c',            'delete|d',
        'exists|e',          'filename|n=s',
        'local|l=s',         'move|m',
        'property|P=s',      'remote|r=s',
        'remote-source|S=s', 'replace|R',
        'view|V'
    ) or $content->help();

lib/Apache/Sling/Content.pm  view on Meta::CPAN

    my $remote_source;
    my $replace;
    my $view;

    my %content_config = (
        'auth'          => \$sling->{'Auth'},
        'help'          => \$sling->{'Help'},
        'log'           => \$sling->{'Log'},
        'man'           => \$sling->{'Man'},
        'pass'          => \$sling->{'Pass'},
        'threads'       => \$sling->{'Threads'},
        'url'           => \$sling->{'URL'},
        'user'          => \$sling->{'User'},
        'verbose'       => \$sling->{'Verbose'},
        'add'           => \$add,
        'additions'     => \$additions,
        'copy'          => \$copy,
        'delete'        => \$delete,
        'exists'        => \$exists,
        'filename'      => \$filename,
        'local'         => \$local,

lib/Apache/Sling/Content.pm  view on Meta::CPAN

 --help or -?                      - view the script synopsis and options.
 --local or -l (localPath)         - Local path to content to upload.
 --log or -L (log)                 - Log script output to specified log file.
 --man or -M                       - view the full script documentation.
 --move or -m                      - Move content.
 --pass or -p (password)           - Password of user performing content manipulations.
 --property or -P (property)       - Specify property to set on node.
 --remote or -r (remoteNode)       - specify remote destination under JCR root to act on.
 --remote-source or -S (remoteSrc) - specify remote source node under JCR root to act on.
 --replace or -R                   - when copying or moving, overwrite remote destination if it exists.
 --threads or -t (threads)         - Used with -A, defines number of parallel
                                     processes to have running through file.
 --url or -U (URL)                 - URL for system being tested against.
 --user or -u (username)           - Name of user to perform content manipulations as.
 --verbose or -v or -vv or -vvv    - Increase verbosity of output.
 --view or -V (actOnGroup)         - view details for specified group in json format.

Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man
EOF

lib/Apache/Sling/Group.pm  view on Meta::CPAN

#}}}

#{{{sub config

sub config {
    my ( $group, $sling, @ARGV ) = @_;
    my $group_config = $group->config_hash( $sling, @ARGV );

    GetOptions(
        $group_config, 'auth=s',     'help|?',       'log|L=s',
        'man|M',        'pass|p=s',   'threads|t=s',  'url|U=s',
        'user|u=s',     'verbose|v+', 'add|a=s',      'additions|A=s',
        'delete|d=s',   'exists|e=s', 'property|P=s', 'view|V=s'
    ) or $group->help();

    return $group_config;
}

#}}}

#{{{sub config_hash

lib/Apache/Sling/Group.pm  view on Meta::CPAN

    my $exists;
    my @property;
    my $view;

    my %group_config = (
        'auth'      => \$sling->{'Auth'},
        'help'      => \$sling->{'Help'},
        'log'       => \$sling->{'Log'},
        'man'       => \$sling->{'Man'},
        'pass'      => \$sling->{'Pass'},
        'threads'   => \$sling->{'Threads'},
        'url'       => \$sling->{'URL'},
        'user'      => \$sling->{'User'},
        'verbose'   => \$sling->{'Verbose'},
        'add'       => \$add,
        'additions' => \$additions,
        'delete'    => \$delete,
        'exists'    => \$exists,
        'property'  => \@property,
        'view'      => \$view
    );

lib/Apache/Sling/Group.pm  view on Meta::CPAN

 --additions or -A (file)          - file containing list of groups to be added.
 --add or -a (actOnGroup)          - add specified group.
 --auth (type)                     - Specify auth type. If ommitted, default is used.
 --delete or -d (actOnGroup)       - delete specified group.
 --exists or -e (actOnGroup)       - check whether specified group exists.
 --help or -?                      - view the script synopsis and options.
 --log or -L (log)                 - Log script output to specified log file.
 --man or -M                       - view the full script documentation.
 --pass or -p (password)           - Password of user performing actions.
 --property or -P (property=value) - Specify property to set on group.
 --threads or -t (threads)         - Used with -A, defines number of parallel
                                     processes to have running through file.
 --url or -U (URL)                 - URL for system being tested against.
 --user or -u (username)           - Name of user to perform any actions as.
 --verbose or -v or -vv or -vvv    - Increase verbosity of output.
 --view or -V (actOnGroup)         - view details for specified group in json format.

Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man
EOF

lib/Apache/Sling/GroupMember.pm  view on Meta::CPAN

#{{{sub config

sub config {
    my ( $group_member, $sling, @ARGV ) = @_;
    my $group_member_config = $group_member->config_hash( $sling, @ARGV );

    GetOptions(
        $group_member_config, 'auth=s',
        'help|?',              'log|L=s',
        'man|M',               'pass|p=s',
        'threads|t=s',         'url|U=s',
        'user|u=s',            'verbose|v+',
        'add|a=s',             'additions|A=s',
        'delete|d=s',          'exists|e=s',
        'group|g=s',           'view|V'
    ) or $group_member->help();

    return $group_member_config;
}

#}}}

lib/Apache/Sling/GroupMember.pm  view on Meta::CPAN

    my $exists;
    my $group;
    my $view;

    my %group_member_config = (
        'auth'      => \$sling->{'Auth'},
        'help'      => \$sling->{'Help'},
        'log'       => \$sling->{'Log'},
        'man'       => \$sling->{'Man'},
        'pass'      => \$sling->{'Pass'},
        'threads'   => \$sling->{'Threads'},
        'url'       => \$sling->{'URL'},
        'user'      => \$sling->{'User'},
        'verbose'   => \$sling->{'Verbose'},
        'add'       => \$add,
        'additions' => \$additions,
        'delete'    => \$delete,
        'exists'    => \$exists,
        'group'     => \$group,
        'view'      => \$view
    );

lib/Apache/Sling/GroupMember.pm  view on Meta::CPAN

 --additions or -A (file)       - file containing list of members to be added to groups.
 --add or -a (member)           - add specified member.
 --auth (type)                  - Specify auth type. If ommitted, default is used.
 --delete or -d (member)        - delete specified group member.
 --exists or -e (member)        - check whether specified member exists in group.
 --group or -g (actOnGroup)     - group to perform membership actions on.
 --help or -?                   - view the script synopsis and options.
 --log or -L (log)              - Log script output to specified log file.
 --man or -M                    - view the full script documentation.
 --pass or -p (password)        - Password of user performing actions.
 --threads or -t (threads)      - Used with -A, defines number of parallel
                                  processes to have running through file.
 --url or -U (URL)              - URL for system being tested against.
 --user or -u (username)        - Name of user to perform any actions as.
 --verbose or -v or -vv or -vvv - Increase verbosity of output.
 --view or -V                   - view members of specified group.

Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man
EOF

lib/Apache/Sling/JsonQueryServlet.pm  view on Meta::CPAN


sub config {
    my ( $json_query_servlet, $sling, @ARGV ) = @_;

    my $json_query_servlet_config = $json_query_servlet->config_hash( $sling, @ARGV );

    GetOptions(
        $json_query_servlet_config, 'auth=s',
        'help|?',                    'log|L=s',
        'man|M',                     'pass|p=s',
        'threads|t=s',               'url|U=s',
        'user|u=s',                  'verbose|v+',
        'all_nodes|a'
    ) or $json_query_servlet->help();

    return $json_query_servlet_config;
}

#}}}

#{{{sub config_hash

lib/Apache/Sling/JsonQueryServlet.pm  view on Meta::CPAN

sub config_hash {
    my ( $json_query_servlet, $sling, @ARGV ) = @_;
    my $all_nodes;

    my %json_query_servlet_config = (
        'auth'      => \$sling->{'Auth'},
        'help'      => \$sling->{'Help'},
        'log'       => \$sling->{'Log'},
        'man'       => \$sling->{'Man'},
        'pass'      => \$sling->{'Pass'},
        'threads'   => \$sling->{'Threads'},
        'url'       => \$sling->{'URL'},
        'user'      => \$sling->{'User'},
        'verbose'   => \$sling->{'Verbose'},
        'all_nodes' => \$all_nodes
    );

    return \%json_query_servlet_config;
}

#}}}

lib/Apache/Sling/JsonQueryServlet.pm  view on Meta::CPAN

    print <<"EOF";
Usage: perl $0 [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]
The following options are accepted:

 --all_nodes or -a                 - Return a JSON representation of all nodes in the system.
 --auth (type)                     - Specify auth type. If ommitted, default is used.
 --help or -?                      - view the script synopsis and options.
 --log or -L (log)                 - Log script output to specified log file.
 --man or -M                       - view the full script documentation.
 --pass or -p (password)           - Password of user performing json queries.
 --threads or -t (threads)         - Used with -A, defines number of parallel
                                     processes to have running through file.
 --url or -U (URL)                 - URL for system being tested against.
 --user or -u (username)           - Name of user to perform queries as.
 --verbose or -v or -vv or -vvv    - Increase verbosity of output.

Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man
EOF

lib/Apache/Sling/LDAPSynch.pm  view on Meta::CPAN

#{{{sub config

sub config {
    my ( $ldap_synch, $sling, @ARGV ) = @_;
    my $ldap_synch_config = $ldap_synch->config_hash( $sling, @ARGV );

    GetOptions(
        $ldap_synch_config,      'auth=s',
        'help|?',                 'log|L=s',
        'man|M',                  'pass|p=s',
        'threads|t=s',            'url|U=s',
        'user|u=s',               'verbose|v+',
        'download-user-list',     'ldap-attributes|a=s',
        'ldap-base|b=s',          'ldap-dn|d=s',
        'ldap-filter|f=s',        'ldap-host|h=s',
        'ldap-pass|P=s',          'attributes|A=s',
        'synch-full|s',           'synch-full-since|S=s',
        'synch-listed|l',         'synch-listed-since',
        'upload-user-list'
    ) or $ldap_synch->help();

lib/Apache/Sling/LDAPSynch.pm  view on Meta::CPAN

    my $synch_listed;
    my $synch_listed_since;
    my $upload_user_list;

    my %ldap_synch_config = (
        'auth'               => \$sling->{'Auth'},
        'help'               => \$sling->{'Help'},
        'log'                => \$sling->{'Log'},
        'man'                => \$sling->{'Man'},
        'pass'               => \$sling->{'Pass'},
        'threads'            => \$sling->{'Threads'},
        'url'                => \$sling->{'URL'},
        'user'               => \$sling->{'User'},
        'verbose'            => \$sling->{'Verbose'},
        'attributes'         => $attributes,
        'download-user-list' => $download_user_list,
        'flag-disabled'      => $flag_disabled,
        'ldap-attributes'    => $ldap_attributes,
        'ldap-base'          => $ldap_base,
        'ldap-dn'            => $ldap_dn,
        'ldap-filter'        => $ldap_filter,

lib/Apache/Sling/Print.pm  view on Meta::CPAN


=head1 METHODS

=head2 print_with_lock

Selects printing to standard out or to log with locking based on whether a suitable log file is defined.

=head2 print_file_lock

Prints out a specified message to a specified file with locking in an attempt
to prevent competing threads or forks from stepping on each others toes when
writing to the file.

=head2 print_lock

Prints out a specified message with locking in an attempt to prevent competing
threads or forks from stepping on each others toes when printing to stdout.

=head2 print_result

Takes an object (user, group, site, etc) and prints out it's Message value,
appending a new line. Also looks at the verbosity level and if greater than or
equal to 1 will print extra information extracted from the object's Response
object. At the moment, won't print if log is defined, as the prints to log
happen elsewhere. TODO tidy that up.

=head2 date_time

lib/Apache/Sling/User.pm  view on Meta::CPAN


sub config {
    my ( $user, $sling, @ARGV ) = @_;

    my $user_config = $user->config_hash( $sling, @ARGV );

    GetOptions(
        $user_config,         'auth=s',
        'help|?',              'log|L=s',
        'man|M',               'pass|p=s',
        'threads|t=s',         'url|U=s',
        'user|u=s',            'verbose|v+',
        'add|a=s',             'additions|A=s',
        'change-password|c=s', 'delete|d=s',
        'email|E=s',           'first-name|f=s',
        'exists|e=s',          'last-name|l=s',
        'new-password|n=s',    'password|w=s',
        'property|P=s',        'update=s',
        'view|V=s'
    ) or $user->help();

lib/Apache/Sling/User.pm  view on Meta::CPAN

    my @property;
    my $update;
    my $view;

    my %user_config = (
        'auth'            => \$sling->{'Auth'},
        'help'            => \$sling->{'Help'},
        'log'             => \$sling->{'Log'},
        'man'             => \$sling->{'Man'},
        'pass'            => \$sling->{'Pass'},
        'threads'         => \$sling->{'Threads'},
        'url'             => \$sling->{'URL'},
        'user'            => \$sling->{'User'},
        'verbose'         => \$sling->{'Verbose'},
        'add'             => \$add,
        'additions'       => \$additions,
        'change-password' => \$change_password,
        'delete'          => \$delete,
        'email'           => \$email,
        'exists'          => \$exists,
        'first-name'      => \$first_name,

lib/Apache/Sling/User.pm  view on Meta::CPAN

 --first-name or -f (firstName)      - specify first name property for user.
 --help or -?                        - view the script synopsis and options.
 --last-name or -l (lastName)        - specify last name property for user.
 --log or -L (log)                   - Log script output to specified log file.
 --man or -M                         - view the full script documentation.
 --me or -m                          - me returns json representing authenticated user.
 --new-password or -n (newPassword)  - Used with -c, new password to set.
 --password or -w (actOnPass)        - Password of user being actioned.
 --pass or -p (password)             - Password of user performing actions.
 --property or -P (property=value)   - Specify property to set on user.
 --threads or -t (threads)           - Used with -A, defines number of parallel
                                       processes to have running through file.
 --update (actOnUser)                - update specified user name, used with -P.
 --url or -U (URL)                   - URL for system being tested against.
 --user or -u (username)             - Name of user to perform any actions as.
 --verbose or -v or -vv or -vvv      - Increase verbosity of output.
 --view or -V (actOnUser)            - view details for specified user in json format.

Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man

t/Local/Apache-Sling.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More tests => 8;
use Test::Exception;
BEGIN { use_ok('Apache::Sling') };
# sling object:
my $sling = Apache::Sling->new(16);
isa_ok $sling, 'Apache::Sling', 'sling';
ok( $sling->{ 'MaxForks' } eq '16', 'Check MaxForks set' );
ok( $sling->check_forks, 'check check_forks function threads undefined' );
$sling->{'Threads'} = 0;
ok( $sling->check_forks, 'check check_forks function threads 0' );
$sling->{'Threads'} = 8;
ok( $sling->check_forks, 'check check_forks function threads normal' );
$sling->{'Threads'} = 'eight';
ok( $sling->check_forks, 'check check_forks function threads written' );
$sling->{'Threads'} = 17;
ok( $sling->check_forks, 'check check_forks function threads bigger than max' );



( run in 0.584 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )