releasing/cbrtools/perl/Symbian/DistributionPolicy.pm
author marvin shi <marvin.shi@nokia.com>
Wed, 17 Nov 2010 14:05:07 +0800
changeset 691 9eeecb73a5d4
parent 602 3145852acc89
permissions -rw-r--r--
fix ou1cimx1#651819
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2005-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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
package Symbian::DistributionPolicy;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use POSIX qw(mktime);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
# create OSD bit vector constants for $obj->{osd}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use constant SYMBIAN_DPOL_COMMON      => 0x0001;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use constant SYMBIAN_DPOL_OPTIONAL    => 0x0002;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
use constant SYMBIAN_DPOL_SYMBIAN     => 0x0004;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
use constant SYMBIAN_DPOL_REPLACEABLE => 0x0008;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
use constant SYMBIAN_DPOL_TEST        => 0x0010;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
sub new {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
    my $class = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
    my $self = {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
        authorized        => {},
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
        category          => undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
        description       => '',
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
        expires           => undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
        export_restricted => undef,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
        osd               => 0,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
    };
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
    bless $self, $class;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
    return $self;
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
# public.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
sub Authorized {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
    my $licensee = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
    my $time = @_ ? shift : time; # use current time if not specified
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
    # absent = fail
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
    return if !exists $self->{authorized}{$licensee};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
    # present without expiry = pass
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
    return 1 if !defined $self->{authorized}{$licensee};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
    # check expiry
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
    return $self->{authorized}{$licensee} > $time;
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
sub SetAuthorizedUntil {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
    my $licensee = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
    my $until = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
    return if !defined $licensee;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
    $self->{authorized}{$licensee} = $self->parsedate($until);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    # success depends on whether a date was passed and parsed successfully
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    return defined $until ? defined $self->{authorized}{$licensee} : 1;
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
sub Category {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
    return $_[0]->{category};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
sub SetCategory {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    my $cat = uc(shift); # uppercase
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
    return if !defined $cat;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
    if ($cat !~ /^[A-Z]$/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
        warn "Invalid IPR category: '$cat'\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
        return;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
    $self->{category} = $cat;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
sub Common {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
    return $_[0]->{osd} & SYMBIAN_DPOL_COMMON;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
sub SetCommon {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
    my $bool = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
    return $self->SetOptional(1) if !$bool;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
    $self->{osd} |= SYMBIAN_DPOL_COMMON;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
    $self->{osd} &= ~SYMBIAN_DPOL_OPTIONAL; # toggles optional off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
    return 1;
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
sub Description {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
    return $_[0]->{description};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
sub SetDescription {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
    my $desc = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
    $self->{description} = defined $desc ? $desc : '';
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
sub Expires {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
    return $_[0]->{expires};
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
sub SetExpires {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
    my $date = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
    return if !defined $date;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
    $self->{expires} = $self->parsedate($date);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
    # if parsedate failed it returned undef so that is our status
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
    return defined $self->{expires};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
sub Expired {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
    my $time = @_ ? shift : time;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
    # not defined = no expiry
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
    return if !defined $self->{expires};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
    # check expiry
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
    return $self->{expires} < $time;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
sub ExportRestricted {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
    
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
    # If the category is defined then we know a distribution policy file has been parsed.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
    if ($self->{category}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
        # double ! reduces the value to a boolean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
        return !!$self->{export_restricted};
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
    return undef;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
sub SetExportRestricted {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
    my $flag = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
    $self->{export_restricted} = $flag;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
sub Optional {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
    return $_[0]->{osd} & SYMBIAN_DPOL_OPTIONAL;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
sub SetOptional {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
    my $bool = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
    return $self->SetCommon(1) if !$bool;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
    $self->{osd} |= SYMBIAN_DPOL_OPTIONAL;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
    $self->{osd} &= ~SYMBIAN_DPOL_COMMON; # toggles common off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
sub Replaceable {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
    return $_[0]->{osd} & SYMBIAN_DPOL_REPLACEABLE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
sub SetReplaceable {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
    my $bool = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
    return $self->SetSymbian(1) if !$bool;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
    $self->{osd} |= SYMBIAN_DPOL_REPLACEABLE;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
    $self->{osd} &= ~SYMBIAN_DPOL_SYMBIAN; # toggles symbian off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
sub Symbian {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
    return $_[0]->{osd} & SYMBIAN_DPOL_SYMBIAN;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
sub SetSymbian {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   178
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   179
    my $bool = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   180
    return $self->SetReplaceable(1) if !$bool;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   181
    $self->{osd} |= SYMBIAN_DPOL_SYMBIAN;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   182
    $self->{osd} &= ~SYMBIAN_DPOL_REPLACEABLE; # toggles replaceable off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   183
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   184
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   185
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   186
sub Test {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   187
    return $_[0]->{osd} & SYMBIAN_DPOL_TEST;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   188
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   189
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   190
sub SetTest {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   191
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   192
    my $bool = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   193
    if ($bool) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   194
        $self->{osd} |= SYMBIAN_DPOL_TEST; # on
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   195
    } else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   196
        $self->{osd} &= ~SYMBIAN_DPOL_TEST; # off
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   197
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   198
    return 1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   199
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   200
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   201
# private.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   202
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   203
sub parsedate {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   204
    my $self = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   205
    my $date = shift; # dd/mm/yyyy
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   206
    return unless defined $date;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   207
    if ($date !~ m!^(\d\d)/(\d\d)/(\d{4})$!) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   208
        warn "Invalid date: '$date'\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   209
        return;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   210
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   211
    my($d, $m, $y) = ($1, $2, $3);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   212
    my $time = mktime(59, 59, 23, $d, --$m, $y-1900);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   213
    if (!defined $time) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   214
        warn "Date out of range: '$date'\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   215
        return;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   216
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   217
    return $time;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   218
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   219
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   220
1;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   221
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   222
=pod
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   223
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   224
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   225
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   226
Symbian::DistributionPolicy - OO representation of a DISTRIBUTION.POLICY file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   227
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   228
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   229
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   230
 # normally you would not create a policy object directly but
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   231
 # use one returned by the Symbian::DistributionPolicy::Reader...
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   232
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   233
 use Symbian::DistributionPolicy::Reader;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   234
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   235
 my $dpr = Symbian::DistributionPolicy::Reader->new();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   236
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   237
 my $policy = $dpr->ReadPolicyFile($path);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   238
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   239
 # then you may query the object using the methods below
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   240
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   241
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   242
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   243
This module provides an object to represent the data in a DISTRIBUTION.POLICY
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   244
file. The DISTRIBUTION.POLICY file specifies the policy information for all the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   245
source code files in the same directory. The directives are:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   246
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   247
=head2 Authorized LICENSEE_ID [until DATE]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   248
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   249
The C<Authorized> directive overrides any IPR restriction and makes available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   250
the source to the licensee with a specific I<LICENSEE_ID>. If the C<until>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   251
keyword is used then I<DATE> should be a string in the format dd/mm/yyyy. The
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   252
exception made by this directive will expire at the end of this date. Only
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   253
one C<Authorized> directive is allowed per I<LICENSEE_ID>.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   254
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   255
=head2 Category IPR_CATEGORY
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   256
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   257
The C<Category> directive specifies the IPR category of the source.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   258
I<IPR_CATEGORY> may be any single character from the range A to Z. The default for
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   259
unclassified source is X.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   260
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   261
=head2 Description TEXT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   262
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   263
The C<Description> directive specifies a one-line textual description of the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   264
directory content. I<TEXT> need not be quoted (in fact, it should not be).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   265
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   266
=head2 Expires DATE
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   267
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   268
The C<Expires> directive specifies the date after which the directive(s) in the
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   269
DISTRIBUTION.POLICY file become invalid. I<DATE> must be in dd/mm/yyyy format.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   270
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   271
=head2 Export STATUS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   272
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   273
The C<Export> keyword specifies whether the source is export restricted or not.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   274
The default is that it is not and this is equivalent to setting I<STATUS> to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   275
Unrestricted. Changing I<STATUS> to Restricted will enable this feature.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   276
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   277
=head2 OSD: ((COMMON|OPTIONAL) (SYMBIAN|REPLACEABLE)|REFERENCE/TEST) [NAME]
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   278
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   279
The OSD line describes the nature of the source in five metrics: (COMMON vs.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   280
OPTIONAL and SYMBIAN vs. REPLACEABLE) or REFERENCE/TEST. The descriptions of
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   281
these are available in Schedule 2 of the CKL.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   282
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   283
=head1 METHODS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   284
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   285
In addition to the constructor, getters and setters are provided for all policy
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   286
directives:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   287
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   288
=begin text
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   289
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   290
    +--------------+-------------------+----------------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   291
    | Directive    | Getter            | Setter               |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   292
    +--------------+-------------------+----------------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   293
    | Authorized   | Authorized        | SetAuthorizedUntil   |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   294
    | Category     | Category          | SetCategory          |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   295
    | Description  | Description       | SetDescription       |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   296
    | Expires      | Expires           | SetExpires           |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   297
    | Export       | ExportRestricted  | SetExportRestricted  |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   298
    | OSD          | See table below for individual methods.  |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   299
    +--------------+-------------------+----------------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   300
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   301
=end
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   302
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   303
Individual OSD metrics getters and setters are detailed in the following table:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   304
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   305
=begin text
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   306
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   307
    +-----------------+--------------+-----------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   308
    | Metric          | Getter       | Setter          |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   309
    +-----------------+--------------+-----------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   310
    | COMMON          | Common       | SetCommon       |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   311
    | OPTIONAL        | Optional     | SetOptional     |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   312
    | REPLACEABLE     | Replaceable  | SetReplaceable  |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   313
    | SYMBIAN         | Symbian      | SetSymbian      |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   314
    | REFERENCE/TEST  | Test         | SetTest         |
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   315
    +-----------------+--------------+-----------------+
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   316
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   317
=end
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   318
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   319
=head2 new()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   320
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   321
Creates the policy object with default settings (cat=X, desc='', expires=never,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   322
export=unrestricted).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   323
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   324
=head2 Authorized($licensee_id[, $time])
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   325
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   326
Returns the authorized status as a boolean (1=authorized, undef=not) for a
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   327
given $licensee_id. If a $time is not specified the current time will be used.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   328
This is required if the C<Authorized> directive makes use of the I<until>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   329
keyword and the expiry time needs to be checked.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   330
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   331
=head2 SetAuthorizedUntil($licensee_id[, $date])
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   332
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   333
Adds an authorized licensee to the policy. If an expiry date is specified it
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   334
must be in dd/mm/yyyy format.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   335
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   336
=head2 Category()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   337
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   338
Returns the IPR category as a single-character string. If no IPR category exists
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   339
in the distrubution file then 'undef' will be returned.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   340
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   341
=head2 SetCategory($cat)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   342
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   343
Sets the category. Will accept any single character from the range A to Z as a
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   344
string in $cat.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   345
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   346
=head2 Common()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   347
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   348
Returns non-zero if the OSD metric COMMON is set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   349
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   350
=head2 SetCommon($bool)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   351
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   352
Sets the OSD metric COMMON if $bool is true. Unsets it if $bool is false. Also
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   353
sets the mutually exclusive OPTIONAL to the opposite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   354
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   355
=head2 Description()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   356
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   357
Returns the description text (never undef - if blank you get an empty string).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   358
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   359
=head2 SetDescription($text)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   360
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   361
Sets the description text.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   362
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   363
=head2 Expires()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   364
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   365
Returns the expiry time specified in the file (or undef if not specified). It
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   366
will be in UNIX (epoch) time format for your convenience. See Expired().
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   367
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   368
=head2 SetExpires($date)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   369
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   370
Sets the expiry time to 23:59:59 on the date provided. $date should be a string
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   371
in dd/mm/yyyy format.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   372
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   373
=head2 Expired([$time])
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   374
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   375
Will test whether the policy data has (or will have) expired at the time
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   376
specified. If no time is specified, the current time will be used - i.e. to
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   377
determine whether the policy has already expired.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   378
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   379
=head2 ExportRestricted()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   380
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   381
Returns the export restricted status as a boolean (1=restricted,
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   382
0=unrestricted, undef=information not available).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   383
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   384
=head2 SetExportRestricted($flag)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   385
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   386
Sets the export restricted status. $flag is a boolean (undef is allowed for
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   387
false).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   388
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   389
=head2 Optional()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   390
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   391
Returns non-zero if the OSD metric OPTIONAL is set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   392
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   393
=head2 SetOptional($bool)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   394
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   395
Sets the OSD metric OPTIONAL if $bool is true. Unsets it if $bool is false. Also
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   396
sets the mutually exclusive COMMON to the opposite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   397
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   398
=head2 Replaceable()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   399
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   400
Returns non-zero if the OSD metric REPLACEABLE is set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   401
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   402
=head2 SetReplaceable($bool)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   403
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   404
Sets the OSD metric REPLACEABLE if $bool is true. Unsets it if $bool is false.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   405
Also sets the mutually exclusive SYMBIAN to the opposite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   406
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   407
=head2 Symbian()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   408
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   409
Returns non-zero if the OSD metric SYMBIAN is set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   410
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   411
=head2 SetSymbian($bool)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   412
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   413
Sets the OSD metric SYMBIAN if $bool is true. Unsets it if $bool is false. Also
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   414
sets the mutually exclusive REPLACEABLE to the opposite.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   415
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   416
=head2 Test()
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   417
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   418
Returns non-zero if the OSD metric REFERENCE/TEST is set.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   419
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   420
=head2 SetTest($bool)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   421
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   422
Sets the OSD metric REFERENCE/TEST if $bool is true. Unsets it if $bool is
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   423
false.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   424
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   425
=head1 SEE ALSO
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   426
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   427
L<Symbian::DistributionPolicy::Reader> to see how to get your $policy object(s).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   428
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   429
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   430
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   431
 Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   432
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   433
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   434
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   435
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   436
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   437
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   438
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   439
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   440
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   441
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   442
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   443
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   444
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   445
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   446
=cut