2002/ws/desc/tools setup-namespaces,1.5,1.6

Update of /sources/public/2002/ws/desc/tools
In directory homer:/tmp/cvs-serv27818

Modified Files:
	setup-namespaces 
Log Message:
Now using templates found under wsdl20/


Index: setup-namespaces
===================================================================
RCS file: /sources/public/2002/ws/desc/tools/setup-namespaces,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** setup-namespaces	30 Jul 2004 08:15:35 -0000	1.5
--- setup-namespaces	30 Jul 2004 09:47:15 -0000	1.6
***************
*** 14,18 ****
  my ($PUBDIR, $DOC, $Y, $M, $D) = @ARGV;
  my $TARGET = "$WWW/$Y/$M/wsdl";
- my $TRLOC = "$Y/$DOC";
  
  if (! -d $WWW) {
--- 14,17 ----
***************
*** 24,28 ****
      my $parser = new XML::DOM::Parser;
      my $doc = $parser->parsefile($f);
!     my $t = $doc->getElementsByTagName('title')->item(0)->getFirstChild()->getNodeValue() || die "$!";
      $t =~ s/\n/ /;
      $t =~ s/ +/ /;
--- 23,27 ----
      my $parser = new XML::DOM::Parser;
      my $doc = $parser->parsefile($f);
!     my $t = $doc->getElementsByTagName('title')->item(0)->getFirstChild()->getNodeValue() || die "$f: $!";
      $t =~ s/\n/ /;
      $t =~ s/ +/ /;
***************
*** 32,35 ****
--- 31,47 ----
  my $TITLE = &getTitle();
  
+ my $ID;
+ if ($DOC =~ m/wsdl20-$Y$M$D/) {
+     $ID = 'PART1';
+ }
+ elsif ($DOC =~ m/wsdl20-extensions-$Y$M$D/) {
+     $ID = 'PART2';
+ }
+ elsif ($DOC =~ m/wsdl20-bindings-$Y$M$D/) {
+     $ID = 'PART3';
+ } else {
+     die "Unknown document type";
+ }
+ 
  ###########################################################################
  
***************
*** 38,41 ****
--- 50,54 ----
      if (! -d $d) {
  	mkdir($d) || die "$!";
+ 	print "Created $d\n";
      }
  }
***************
*** 44,87 ****
  &createDir("$WWW/$Y/$M");
  &createDir("$TARGET");
- &createDir("$TARGET/style");
  
! ###########################################################################
! 
! my $ID;
! if ($DOC =~ m/wsdl20-$Y$M$D/) {
!     $ID = 'PART1';
! }
! elsif ($DOC =~ m/wsdl20-extensions-$Y$M$D/) {
!     $ID = 'PART2';
  }
! elsif ($DOC =~ m/wsdl20-bindings-$Y$M$D/) {
!     $ID = 'PART3';
! } else {
!     die "Unknown document type";
  }
  
! my $htaccessTemplate = "# .htaccess created by setup-namespaces; edit carefully
! RewriteEngine On
! RewriteBase   /$Y/$M/wsdl
  
! # PART1-BEGIN
! # PART1-END
  
! # PART2-BEGIN
! # PART2-END
  
! # PART3-BEGIN
! # PART3-END
! ";
  
  sub updateHtaccess() {
      my $htaccess = "$TARGET/.htaccess";
-     my $f;
      my $c;
      if (-f $htaccess) {
! 	open($f, "$htaccess") || die "$!";
! 	$c = join('', <$f>);
      } else {
! 	$c = $htaccessTemplate;
      }
      my $v = "# $ID-BEGIN\n";
--- 57,109 ----
  &createDir("$WWW/$Y/$M");
  &createDir("$TARGET");
  
! if ($ID eq 'PART2') {
!     &createDir("$TARGET/style");
!     &createDir("$TARGET/feature");
  }
! elsif ($ID eq 'PART3') {
!     &createDir("$TARGET/style");
  }
  
! ###########################################################################
  
! sub readFromDoc() {
!     my ($fn) = @_;
!     my $f;
!     open($f, $fn) || die "$fn: $!";
!     my $c = join('', <$f>);
!     close($f);
!     return $c;
! }
  
! sub readFromTemplate() {
!     my ($fn) = @_;
!     my $c = &readFromDoc("templates/$fn");
!     $c =~ s|\@TRLOC\@|$DOC|g;
!     $c =~ s|\@TITLE\@|$TITLE|g;
!     $c =~ s|\@Y\@|$Y|g;
!     $c =~ s|\@M\@|$M|g;
!     my $signatureTemplate = &readFromDoc("templates/signature");
!     $c =~ s|\@SIG\@|$signatureTemplate|g;
!     return $c;
! }
  
! sub writeInDoc() {
!     my ($fn, $c) = @_;
!     my $f;
!     open($f, "> $fn") || die "$fn: $!";
!     print $f $c;
!     close($f);
! }
! 
! ###########################################################################
  
  sub updateHtaccess() {
      my $htaccess = "$TARGET/.htaccess";
      my $c;
      if (-f $htaccess) {
! 	$c = &readFromDoc($htaccess);
      } else {
! 	$c = &readFromTemplate("htaccess");
      }
      my $v = "# $ID-BEGIN\n";
***************
*** 102,112 ****
  RewriteRule   ^out-multi-in$            patterns.html
  RewriteRule   ^asynch-out-in$           patterns.html
  ';
      }
      $v .= "\n# $ID-END\n";
      $c =~ s/\# $ID-BEGIN\n.*\# $ID-END\n/$v/s;
!     open($f, "> $htaccess");
!     print $f $c;
!     close($f);
  }
  
--- 124,134 ----
  RewriteRule   ^out-multi-in$            patterns.html
  RewriteRule   ^asynch-out-in$           patterns.html
+ RewriteRule   ^feature/AD/data$         feature/AD.html
  ';
      }
      $v .= "\n# $ID-END\n";
      $c =~ s/\# $ID-BEGIN\n.*\# $ID-END\n/$v/s;
!     &writeInDoc($htaccess, $c);
!     print "Updated .htaccess\n";
  }
  
***************
*** 117,129 ****
  sub moveSchema() {
      my $src = "$PUBDIR/$_[0]";
!     my $dst = "$TARGET/$_[0]";
      move($src, $dst) || die "mv $src $dst: $!";
  }
  
  if ($ID eq 'PART1') {
      &moveSchema("wsdl20.xsd", "wsdl20.xsd");
!     &moveSchema("wsdl-instance.xsd", "../wsdl-instance.xsd");
! }
! elsif ($ID eq 'PART2') {
      &moveSchema("wsdl20-rpc.xsd", "rpc.xsd");
  }
--- 139,150 ----
  sub moveSchema() {
      my $src = "$PUBDIR/$_[0]";
!     my $dst = "$TARGET/$_[1]";
      move($src, $dst) || die "mv $src $dst: $!";
+     print "Installed $_[1]\n";
  }
  
  if ($ID eq 'PART1') {
      &moveSchema("wsdl20.xsd", "wsdl20.xsd");
!     &moveSchema("wsdl20-instance.xsd", "../wsdl20-instance.xsd");
      &moveSchema("wsdl20-rpc.xsd", "rpc.xsd");
  }
***************
*** 134,243 ****
  
  ###########################################################################
! 
! my $signatureTemplate = <<'SIG_EOF'    
! 
!     <hr />
!     <p>
!       Comments on this document have to be sent to the public <a
!       href="mailto:www-ws-desc@w3.org">www-ws-desc@w3.org</a> mailing
!       list (<a href=
!       "http://lists.w3.org/Archives/Public/www-ws-desc/">public
!       archive</a>).</p>
!     </p>    
!   </body>
! </html>
! SIG_EOF
!     ;
! 
! ###########################################################################
! 
! # patterns.html
! 
! my $patternsTemplate = <<'PATTERNST_EOF'
! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
!     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
! <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
!   <head>
!     <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
!     <title>Web Services Description Language (WSDL) Version 2.0 Patterns</title>
!     <link type="text/css" rel="stylesheet" href=
!       "http://www.w3.org/StyleSheets/TR/base.css" />
!   </head>
!   <body>
!     <div class="head">
!       <p><a href="http://www.w3.org/"><img width="72" height="48" alt=
! 	    "W3C" src="http://www.w3.org/Icons/w3c_home" /></a></p>
!       <h1>Web Services Description Language (WSDL) Version 2.0 Patterns</h1>
!     </div>
! 
!     <p>
!       The Web Services Description Language (WSDL) Version 2.0 message
!       patterns are intended for use with the Web Services Description
!       Language Version 2.0 (WSDL 2.0).
!     </p>
!     <p>
!       For a complete definition of the patterns, refer to <a
!       href='http://www.w3.org/TR/@TRLOC@/'>@TITLE@</a>
!     specification.
!     </p>
! PATTERNST_EOF
!     ;
  
  if ($ID eq 'PART2') {
!     my $c = $patternsTemplate;
!     $c =~ s|\@TRLOC\@|$TRLOC|g;
!     $c =~ s|\@TITLE\@|$TITLE|g;
!     $c .= $signatureTemplate;
!     my $f;
!     open($f, "> $TARGET/patterns.html") || die "$!";
!     print $f $c;
!     close($f);
  }
  
  ###########################################################################
- 
  # Styles
  
- my $styleTemplate = <<'STYLET_EOF'
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
-   <head>
-     <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-     <title>Web Services Description Language (WSDL) Version 2.0 @NAME@ Style</title>
-     <link type="text/css" rel="stylesheet" href=
-       "http://www.w3.org/StyleSheets/TR/base.css" />
-   </head>
-   <body>
-     <div class="head">
-       <p><a href="http://www.w3.org/"><img width="72" height="48" alt=
- 	    "W3C" src="http://www.w3.org/Icons/w3c_home" /></a></p>
-       <h1>Web Services Description Language (WSDL) Version 2.0 @NAME@ Style</h1>
-     </div>
- 
-     <p>
-       The Web Services Description Language (WSDL) Version 2.0 @NAME@
-       Style is intended for use with the Web Services Description
-       Language Version 2.0 (WSDL 2.0).
-     </p>
-     <p>
-       For a complete definition of the @NAME@ Style, refer to <a
-       href='http://www.w3.org/TR/@TRLOC@/'>@TITLE@</a>
-       specification.
-     </p>
- STYLET_EOF
-     ;
- 
  sub genStyleDoc() {
      my ($fn, $name) = @_;
!     my $c = $styleTemplate;
      $c =~ s|\@NAME\@|$name|g;
!     $c =~ s|\@TRLOC\@|$TRLOC|g;
!     $c =~ s|\@TITLE\@|$TITLE|g;
!     $c .= $signatureTemplate;
!     my $f;
!     open($f, "> $TARGET/style/$fn") || die "$!";
!     print $f $c;
!     close($f);
  }
  
--- 155,175 ----
  
  ###########################################################################
! # Patterns
  
  if ($ID eq 'PART2') {
!     my $c = &readFromTemplate("patterns.html");
!     &writeInDoc("$TARGET/patterns.html", $c);
!     print "Generated patterns.html\n";
  }
  
  ###########################################################################
  # Styles
  
  sub genStyleDoc() {
      my ($fn, $name) = @_;
!     my $c = &readFromTemplate("style.html");
      $c =~ s|\@NAME\@|$name|g;
!     &writeInDoc("$TARGET/style/$fn", $c);
!     print "Generated style/$fn\n";
  }
  
***************
*** 249,250 ****
--- 181,197 ----
      &genStyleDoc('multipart.html', 'Multipart');
  }
+ 
+ ###########################################################################
+ # Features
+ 
+ sub genFeatureDoc() {
+     my ($fn, $name) = @_;
+     my $c = &readFromTemplate("feature.html");
+     $c =~ s|\@NAME\@|$name|g;
+     &writeInDoc("$TARGET/feature/$fn", $c);
+     print "Generated feature/$fn\n";
+ }
+ 
+ if ($ID eq 'PART2') {
+     &genFeatureDoc('AD.html', 'Application Data');
+ }

Received on Friday, 30 July 2004 05:47:18 UTC