r4541 - trunk/src/perl

walbridge at ecoinformatics.org walbridge at ecoinformatics.org
Mon Nov 10 14:59:16 PST 2008


Author: walbridge
Date: 2008-11-10 14:59:15 -0800 (Mon, 10 Nov 2008)
New Revision: 4541

Modified:
   trunk/src/perl/register-dataset.cgi
Log:
Remove EML2 beta6 document conversion support, the files required for conversion have been deprecated from Metacat.


Modified: trunk/src/perl/register-dataset.cgi
===================================================================
--- trunk/src/perl/register-dataset.cgi	2008-11-10 21:03:35 UTC (rev 4540)
+++ trunk/src/perl/register-dataset.cgi	2008-11-10 22:59:15 UTC (rev 4541)
@@ -122,7 +122,7 @@
 }
 
 # replacements for appconfig values using properties
-my $moderators = $properties->getProperty('ldap.moderators'); # scw TODO: check if this changes to per-skin
+my $moderators = $properties->getProperty('ldap.moderators');
 my $config = $skinProperties->splitToTree(qr/\./, 'registry.config');
 my $templates = $skinProperties->splitToTree(qr/\./, 'registry.templates');
 my $modules = $skinProperties->splitToTree(qr/\./, 'registry.modules');
@@ -1804,89 +1804,19 @@
         $error ="Error in parsing the eml document";
         push(@errorMessages, $error);
     } elsif ($doc=~ /<error/) {
-    if ( $doc=~ /public/){
-          $error ="Error in reading the eml document. Please check if you are logged in.";
-          push(@errorMessages, $error);
-  } else {
+        if ( $doc=~ /public/){
+            $error ="Error in reading the eml document. Please check if you are logged in.";
+            push(@errorMessages, $error);
+        } else {
           $error ="Error in reading the eml document. Please check if you have access to read the document";
           push(@errorMessages, $error); 
-  }
+        }
     } else {
         $findType = $xmldoc->findnodes('//dataset/identifier');
         if ($findType->size() > 0) {
             # This is a eml beta6 document
             # Read the documents mentioned in triples also
-        
-            $findType = $xmldoc->findnodes('//dataset/triple');
-            if ($findType->size() > 0) {
-                foreach $node ($findType->get_nodelist) {
-                    $pushDoc = findValue($node, 'subject');
-            
-                    # If the file is already in @fileArray then do not add it 
-                    $alreadyInArray = 0;
-                    foreach $element (@fileArray) {
-                        $tempfile = $tempDir."/".$pushDoc;
-                        if ($element eq $pushDoc) {
-                            $alreadyInArray = 1;
-                        }
-                    }
-            
-                    if (!$alreadyInArray) {
-                        $tempfile = $tempDir."/".$pushDoc;
-                        $response = "";
-                        $response = $metacat->read($pushDoc);    
-                        if (! $response) {
-                            # could not read
-                            #push(@errorMessages, $response);
-                            push(@errorMessages, $metacat->getMessage());
-                            push(@errorMessages, "Failed during reading.\n");
-                        } else {
-                            my $xdoc = $response->content();
-                            open (TFILE,">$tempfile") || 
-                                die ("Cant open xml file... $tempfile\n");
-                            print TFILE $xdoc;
-                            close(TFILE);
-                            push (@fileArray, $tempfile);
-                        }
-                    }
-                }
-            }
-
-            # Read the main document. 
-
-            $tempfile = $tempDir."/".$docid;
-            open (TFILE,">$tempfile") || die ("Cant open xml file...\n");
-            print TFILE $doc;
-            close(TFILE);
-        
-            # Transforming beta6 to eml 2
-            my $xslt;
-            my $triplesheet;
-            my $results;
-            my $stylesheet;
-            my $resultsheet;
-        
-            $xslt = XML::LibXSLT->new();
-            $tempfile = $tempDir."/"."triple_info.xsl";
-    
-            $triplesheet = $xslt->parse_stylesheet_file($tempfile);
-
-            $results = $triplesheet->transform($xmldoc, packageDir => "\'$tempDir/\'", packageName => "\'$docid\'");
-
-            $tempfile = $tempDir."/"."emlb6toeml2.xsl";
-            $stylesheet = $xslt->parse_stylesheet_file($tempfile);
-            $resultsheet = $stylesheet->transform($results);
-        
-            #$tempfile = "/usr/local/apache2/htdocs/xml/test.xml";;
-            #open (TFILE,">$tempfile") || die ("Cant open xml file...\n");
-            #print TFILE $stylesheet->output_string($resultsheet);
-            #close(TFILE);
-            
-            # Delete the files written earlier. 
-            unlink @fileArray;
-
-            return $resultsheet;
-
+            push(@errorMessages, "EML2 beta6 support deprecated."); 
         }
     }
     return $xmldoc;
@@ -1921,7 +1851,7 @@
 
 ################################################################################
 # 
-# Parse an EML 2.0.0 file and extract the metadata into perl variables for 
+# Parse an EML 2.x file and extract the metadata into perl variables for 
 # processing and returning to the template processor
 #
 ################################################################################
@@ -3708,7 +3638,6 @@
                 $$templateVars{"uploadname_$upNum"} = param("uploadname_$upNum");
                 $$templateVars{"uploadtype_$upNum"} = param("uploadtype_$upNum");
                 $$templateVars{"uploadperm_$upNum"} = param("uploadperm_$upNum");
-                  
             }
         }
     }



More information about the Metacat-cvs mailing list