releasing/cbrtools/perl/Symbian/IPR.pm
author Ross Qin <ross.qin@nokia.com>
Thu, 28 Oct 2010 11:18:50 +0800
changeset 667 a3b39a14147a
parent 602 3145852acc89
permissions -rw-r--r--
Remove the PrintingServices component from TB10.1 on wards(on behalf of dane.waby@nokia.com)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
# Symbian::IPR
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
package Symbian::IPR;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use Carp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use Symbian::CBR::IPR::MRP;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use Symbian::DistributionPolicy::Reader;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use base qw(Class::Singleton);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
sub _new_instance {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
    my $pkg = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
    my $useDistPolFirst = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
    my $disallowUnclassifiedSource = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
    my $typeOfMrp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
    my $verbose = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
    my $captureDistributionPolicyOutput = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
    if (!$typeOfMrp || shift) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
        # caller(0))[3] gives the package and the method called, e.g. Symbian::IPR::_new_instance
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
        croak "Invalid number of arguments passed to " . (caller(0))[3] . "\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
    my $self = {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
            'useDistPolFirst' => $useDistPolFirst,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
            'disallowUnclassifiedSource' => $disallowUnclassifiedSource,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
            'verbose' => $verbose,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
            'typeOfMrp' => $typeOfMrp,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
            'captureDistributionPolicyOutput' => $captureDistributionPolicyOutput};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
    bless $self, $pkg;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
    if (!$useDistPolFirst) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
        # If we are not using distribution policy files as default then create a Symbian::CBR::IPR::MRP object... 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
        $self->CreateMrpObject();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
    return $self;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
sub CreateMrpObject {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    if (!exists $self->{'mrpObject'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
        $self->{'mrpObject'} = Symbian::CBR::IPR::MRP->instance($self->{typeOfMrp}, $self->{verbose});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
    # We may have cached calls to PrepareInformationForComponent...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
    if (defined $self->{prepareInformationForComponentCache}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
        foreach my $component (@{$self->{prepareInformationForComponentCache}}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
            $self->PrepareInformationForComponent($component);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
        delete $self->{prepareInformationForComponentCache};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
    # and also to PrepareInformationForMrpFile...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
    if (defined $self->{prepareInformationForMrpFileCache}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
        $self->PrepareInformationForMrpFile->(@{$self->{prepareInformationForMrpFileCache}});
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
        delete $self->{prepareInformationForMrpFileCache};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
sub PrepareInformationForComponent {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
    my $component = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
    # An MRP object may not have been created, for example if using distribution policy files first.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
    # In that case we cache the calls to PrepareInformationForComponent, and will pass them onto the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
    # MRP object if it is ever created.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
    if (defined $self->{'mrpObject'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
        $self->{'mrpObject'}->PrepareInformationForComponent($component);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
        push @{$self->{prepareInformationForComponentCache}}, $component;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
sub PrepareInformationForMrpFile {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
    my @mrps = shift;   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
    # An MRP object may not have been created, for example if using distribution policy files first.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
    # In that case we cache the calls to PrepareInformationForMrpFile, and will pass them onto the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
    # MRP object if it is ever created.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
    if (defined $self->{'mrpObject'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
        $self->{'mrpObject'}->PrepareInformationForMrpFile(@mrps);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
    else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
        push @{$self->{prepareInformationForMrpFileCache}}, @mrps;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
sub Category {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
    my $path = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    if (!$path || shift) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
        croak "Invalid number of arguments passed to " . (caller(0))[3] . "\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
    my ($category, $errors) = $self->GetRequestedInformation($path, 'Category');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    if (!$category) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
        $category = 'X';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
    return ($category, $errors);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
sub ExportRestricted {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
    my $path = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
    if (!$path || shift) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
        croak "Invalid number of arguments passed to " . (caller(0))[3] . "\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
    my ($exportRestricted, $errors) = $self->GetRequestedInformation($path, 'ExportRestricted');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
    return ($exportRestricted, $errors);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
sub GetRequestedInformation {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
    my $path = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
    my $what = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
    my @errors; # This collects the errors produced from the distribution policy modules.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
                # The CBR Tools handle these errors in a different way.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
    if (!$path || !$what || shift) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
        croak "Invalid number of arguments passed to " . (caller(0))[3] . "\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
    my $result = undef;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
    my $informationFrom = undef;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
    if (!$self->{useDistPolFirst} && $self->{mrpObject}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
        # If to use MRP files first and an Mrp object exists...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
        $result = $self->{mrpObject}->$what($path);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
        $informationFrom = 'M' if (defined $result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
    if (! defined $result) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
        # If  distribution policies are to be used first or could not obtain information
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
        # from MRP object then use distribution policies
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
        # Create a distribution policy reader if one does not already exist...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
        if (!$self->{distPolReader}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
            # Create a distribution policy reader if one does not already exist...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
            $self->{distPolReader} = Symbian::DistributionPolicy::Reader->new();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
        if ($self->{distPolReader}->isa("Symbian::DistributionPolicy::Reader")) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
            my $warner;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
            
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
            # We may need to capture the output of the distribution policy modules
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
            if ($self->{'captureDistributionPolicyOutput'}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
                $warner = sub { push @errors, shift; };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
            }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
            local $SIG{__WARN__} = $warner if ($warner);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
            # We want to make sure that we do have a reader before trying to read a file
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
            eval {  my $distPolObj = $self->{distPolReader}->ReadPolicyFile($path);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
                    $result = $distPolObj->$what()};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
            $informationFrom = 'D' if (defined $result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
    if ((!defined $result) && $self->{useDistPolFirst}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
        # If distribution policies have been used first and failed then try getting the information from MRP files...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
        # The Symbian::CBR::IPR::MRP might not yet have been created
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
        if (!exists $self->{mrpObject}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
            $self->CreateMrpObject();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
        $result = $self->{mrpObject}->$what($path);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
        $informationFrom = 'M' if (defined $result);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
   
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
    if (!defined $informationFrom && $self->{disallowUnclassifiedSource}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
        carp "Warning: IPR information for '$path' could not be obtained from either MRP files or distribution policy files\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
    if ($self->{verbose} > 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
        # If verbose then we print information saying where the IPR information was obtained from
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
        if ($informationFrom eq 'M') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
            print "Info: IPR information for '$path' was obtained using MRP files\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
        }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
        elsif ($informationFrom eq 'D') {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
            print "Info: IPR information for '$path' was obtained using Distribution Policy files\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
        }        
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
    return ($result, \@errors);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
=pod
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
Symbian::IPR - An interface to IPR information within MRP files and Distribution
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
Policy files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
use Symbian::IPR;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
 # Instantiate a Symbian::IPR object
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
 my $iprObject = Symbian::IPR->instance(0, 0, 'MRP', undef, 1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
 # Get the IPR category for a path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
 my $category = $iprObject->Category('\aPath\somewhere');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
 # Get the export restricted flag for a path
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
 my $exportRestricted = $iprObject->ExportRestricted('\aPath\somewhere');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
This package provides an interface to obtaining IPR information from MRP files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
and Distribution Policy files.  The user can specify the order of preference
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
between MRP and distribution policies.  If the requested information can not be
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
obtained from the preferred choice then the package will fall back to using the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
other option.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
=head1 METHODS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
=head2 new(useDistPolFirst, disallowUnclassifiedSource, typeOfMrp, component, verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
Instantiates a Symbian::IPR object.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
The default order is for IPR information to be obtained from MRP files first, and
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
if unsuccessful then to obtain the IPR information from distribution policy files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
If the boolean value useDistPolFirst is specified then IPR information will be
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
obtained from distribution policy files by default, and if not successful then
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
MRP files will be used.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
If the disallowUnclassifiedSource flag is specified then warnings will be produced
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
if IPR information can not be obtained both MRP files and distribution.policy files.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
The typeOfMrp argument is non-optional.  Valid types are MRP and MRPDATA.  See the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
documentation for Symbian::CBR::MRP::Reader for more information.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
If a component had been specified then the MRP file for the component will be processed
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
and the IPR information obtained.  Any MRP files for dependant components will be
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
located and processed too.  If no component name has been specified all MRP files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
in the environment will be processed.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
=head2 Category(path)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
Returns the IPR category of the path.  If no IPR information exists for the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
specified path then X will be returned.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
=head2 ExportRestricted(path)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
Returns true if the specified path is export restricted, and false if it is not.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
If no IPR information exists for the specified path then undef will be returned.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
=head2 PrepareInformationForComponent(component_name)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
If using MRP files for IPR information it is possible to specify which components
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
contain the information required.  This improves performance as only required
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
MRP files are processed.  The default behaviour is to process all MRP files listed
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
in the CBR Tools environment database.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
If using distribution policy files as default then information passed to this method
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
will be cached and realised only if it becomes necessary to use MRP files for IPR
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
information (e.g. distribution policy file does not exist).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
=head2 PrepareInformationForMrpFile(list_of_mrp_files)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
If using MRP files for IPR information it is possible to specify which MRP files
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
contain the information required.  This can be used in scenarios where a CBR Tools
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
environment database does not exist, and so MRP locations are unknown.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
If using distribution policy files as default then information passed to this method
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
will be cached and realised only if it becomes necessary to use MRP files for IPR
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
information (e.g. distribution policy file does not exist).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
 Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
=cut