Converted metadatatool to use new interfaces.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 25 Jul 2006 20:13:37 +0000 (20:13 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 25 Jul 2006 20:13:37 +0000 (20:13 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1977 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/utils/MetadataTool.java

index fdf19b0..5af30be 100644 (file)
@@ -18,27 +18,35 @@ package edu.internet2.middleware.shibboleth.utils;
 
 import jargs.gnu.CmdLineParser;
 
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.net.URL;
-import java.security.*;
+import java.security.KeyStore;
+import java.security.PrivateKey;
 import java.security.cert.Certificate;
-import java.security.cert.*;
+import java.security.cert.X509Certificate;
 
 import org.apache.log4j.ConsoleAppender;
 import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.log4j.PatternLayout;
-import org.apache.xml.security.c14n.*;
+import org.apache.xml.security.c14n.Canonicalizer;
 import org.apache.xml.security.keys.KeyInfo;
 import org.apache.xml.security.keys.content.X509Data;
-import org.apache.xml.security.signature.*;
-import org.apache.xml.security.transforms.*;
-import org.opensaml.SAMLException;
-import org.w3c.dom.*;
+import org.apache.xml.security.signature.Reference;
+import org.apache.xml.security.signature.SignedInfo;
+import org.apache.xml.security.signature.XMLSignature;
+import org.apache.xml.security.transforms.Transforms;
+import org.opensaml.saml2.metadata.provider.MetadataProviderException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 import edu.internet2.middleware.shibboleth.common.XML;
-import edu.internet2.middleware.shibboleth.metadata.MetadataException;
-import edu.internet2.middleware.shibboleth.metadata.provider.XMLMetadataProvider;
+import edu.internet2.middleware.shibboleth.metadata.DOMMetadataProvider;
 import edu.internet2.middleware.shibboleth.xml.Parser;
 
 /**
@@ -156,7 +164,7 @@ public class MetadataTool {
                }
 
                // Parse file and verify root element.
-               Document doc = Parser.loadDom(new URL(new URL("file:"),infile), true);
+               Document doc = Parser.loadDom(new URL(new URL("file:"), infile), true);
                if (doc == null) {
                        System.out.println("error: unable to read in file (" + infile + ")");
                        System.exit(-1);
@@ -170,19 +178,15 @@ public class MetadataTool {
                                || org.opensaml.XML.isElementNamed(e, XML.SAML2META_NS, "EntitiesDescriptor")) {
                        try {
                                // apply the same validity checks a running system would
-                               new XMLMetadataProvider(e);
-                       } catch (MetadataException me) {
+                               new DOMMetadataProvider(e);
+                       } catch (MetadataProviderException me) {
                                System.err.println("error in metadata: " + me.getMessage());
                                System.exit(1);
-                       } catch (SAMLException se) {
-                               System.err.println("error in metadata: " + se);
-                               System.exit(1);
                        }
                } else if (org.opensaml.XML.isElementNamed(e, XML.SHIB_NS, "Trust")
                                || org.opensaml.XML.isElementNamed(e, XML.TRUST_NS, "Trust")) {
                        /*
-                        * Additional validity checks for legacy trust files
-                        * could be added here.
+                        * Additional validity checks for legacy trust files could be added here.
                         */
                } else {
                        System.err.println("error: root element must be SiteGroup, Trust, EntitiesDescriptor, or EntityDescriptor");