/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/globus-info-gip-gram5-glue2-tostorageservice-static
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/globus-info-gip-gram5-glue2-tostorageservice-static

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2531 - (show annotations) (download)
Wed Apr 25 14:32:26 2012 UTC (9 years, 9 months ago) by davidg
File size: 4397 byte(s)
Add verbatim copies of creamce tools to reduce dependencies

1 #!/usr/bin/perl -w
2 #
3 # glite-ce-glue2-tostorageservice-static: an information provider for the
4 # static part of the ToStorageService object, in v 2.0 of the GLUE schema
5 # It can be installed as a gip provider or, even better, it can be called
6 # just once to produce a ldif part to be installed in the ldif
7 # gip directory
8 #
9 # Ref: http://www.ogf.org/documents/GFD.147.pdf
10 # http://glue20.web.cern.ch/glue20/
11 # Copyright (c) Members of the EGEE Collaboration. 2010.
12 # See http://www.eu-egee.org/partners/ for details on the copyright
13 # holders.
14 #
15 # Licensed under the Apache License, Version 2.0 (the "License");
16 # you may not use this file except in compliance with the License.
17 # You may obtain a copy of the License at
18 #
19 # http://www.apache.org/licenses/LICENSE-2.0
20 # Unless required by applicable law or agreed to in writing, software
21 # distributed under the License is distributed on an "AS IS" BASIS,
22 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 # See the License for the specific language governing permissions and
24 # limitations under the License.
25
26 use strict;
27 use FileHandle;
28 use POSIX qw(strftime);
29
30 #
31 # Version number for this code
32 my $version = "1.0";
33
34
35 my $host = `hostname -f`;
36 chomp($host);
37
38 my $confile;
39
40 # Read in the configuration file (first argument)
41
42 my %config = (
43 ComputingServiceId => '',
44 CloseSEs => '',
45 );
46
47 if ($ARGV[0]){
48 $confile = $ARGV[0];
49 my $fh = new FileHandle $confile
50 or die "Error: Can't open configuration file: $ARGV[0]\n";
51 foreach (<$fh>){
52 if ((! m/^\#/) & (m/=/)){
53 # For lines containing an = and not starting with #
54 m/^(.*?)=\s*(.*)\s*$/;
55 # Split on the first =, no leading or trailing whitespace in the value
56 my $key=$1;
57 my $value=$2;
58 $key=~s/\s+//g;
59 $config{$key}=$value;
60 }
61 }
62 }else{
63 print STDERR "Usage: glite-ce-glue2-tostorageservice-static <config-file> \n";
64 exit 1;
65 }
66
67 # Get service id from conf file
68 my $ServiceID = $config{ComputingServiceId};
69
70 # No white space. No "
71 $ServiceID =~ s/\s+//g;
72 $ServiceID =~ s/\"//g;
73
74 my $bind_dn = "GLUE2ServiceID=$ServiceID,GLUE2GroupID=resource,o=glue";
75
76 # Read shares from conf file
77 my $CloseSEs = $config{CloseSEs};
78
79 #No leading and traling spaces. No "
80 $CloseSEs =~ s/^\s+//;
81 $CloseSEs =~ s/\s+$//;
82 $CloseSEs =~ s/\"//g;
83
84 # Get list of close SEs. Separator is ,
85
86 my @list = split /,/, $CloseSEs;
87
88
89 my $SE;
90 my @ItemsofSE;
91
92 # Times are mandated to be UTC only
93 my $TimeNow = strftime("%Y-%m-%dT%H:%M:%SZ", gmtime());
94
95
96 foreach $SE (@list)
97 {
98 #strip (, ), leading and trailing spaces
99 $SE =~ s/\(//g;
100 $SE =~ s/\)//g;
101 $SE =~ s/^\s+//;
102 $SE =~ s/\s+$//;
103
104 # split the elements of a closeSE, which is in the format
105 # SEId, LocalPath, RemotePath
106 @ItemsofSE = split /\s+/, $SE;
107
108 # Now start outputting LDIF lines for the GLUE2ToStorageService object.
109 # Note that once we get here we are committed to printing a
110 # complete, valid object. Start with the DN ...
111
112 # GLUE2ToStorageServiceID: concatenation of serviceid and storageid
113 my $GLUE2ToStorageServiceID = $ServiceID . "_" . $ItemsofSE[0];
114
115
116 print "dn: GLUE2ToStorageServiceID=$GLUE2ToStorageServiceID,$bind_dn\n";
117
118 # Print the boilerplate objectclass declarations and unique ID
119 print "objectClass: GLUE2Entity\n";
120 print "objectClass: GLUE2ToStorageService\n";
121
122 # Id
123 print "GLUE2ToStorageServiceID: $GLUE2ToStorageServiceID\n";
124
125 print "GLUE2EntityCreationTime: $TimeNow\n";
126
127 # No validity, since this is static info
128
129 # Embed some metadata to help with debugging
130 print "GLUE2EntityOtherInfo: InfoProviderName=glite-ce-glue2-tostorageservice-static\n";
131 print "GLUE2EntityOtherInfo: InfoProviderVersion=$version\n";
132 print "GLUE2EntityOtherInfo: InfoProviderHost=$host\n";
133
134 # For name let's use the Id
135 print "Glue2EntityName: $GLUE2ToStorageServiceID\n";
136
137
138 # Local Path
139 print "GLUE2ToStorageServiceLocalPath: $ItemsofSE[1]\n";
140
141 # Remote path
142 print "GLUE2ToStorageServiceRemotePath: $ItemsofSE[2]\n";
143
144 # Finally print the upward links
145 print "GLUE2ToStorageServiceComputingServiceForeignKey: $ServiceID\n";
146 print "GLUE2ToStorageServiceStorageServiceForeignKey: $ItemsofSE[0]\n";
147
148 # Print a newline to finish the object
149 print "\n";
150
151 }
152
153 exit 0;

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28