[jboss-cvs] JBossAS SVN: r71644 - in projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml: util and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 2 18:12:12 EDT 2008


Author: anil.saldhana at jboss.com
Date: 2008-04-02 18:12:12 -0400 (Wed, 02 Apr 2008)
New Revision: 71644

Added:
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/core/OpenSAMLUtil.java
Modified:
   projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/util/DOMUtil.java
Log:
utils

Added: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/core/OpenSAMLUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/core/OpenSAMLUtil.java	                        (rev 0)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/core/OpenSAMLUtil.java	2008-04-02 22:12:12 UTC (rev 71644)
@@ -0,0 +1,50 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.security.xacml.saml.integration.opensaml.core;
+
+import javax.xml.namespace.QName;
+
+import org.opensaml.Configuration;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.XMLObjectBuilder;
+ 
+/**
+ *  Utility class
+ *  @author Anil.Saldhana at redhat.com
+ *  @since  Apr 2, 2008 
+ *  @version $Revision$
+ */
+public class OpenSAMLUtil
+{
+   @SuppressWarnings("unchecked")
+   public static XMLObjectBuilder getBuilder(QName qname)
+   {
+     return Configuration.getBuilderFactory().getBuilder(qname);   
+   }
+   
+   public static XMLObject buildXMLObject(QName qname)
+   {
+      XMLObjectBuilder<?> ob = getBuilder(qname);
+      return ob.buildObject(qname.getNamespaceURI(), qname.getLocalPart(), qname.getPrefix());
+   } 
+
+}
\ No newline at end of file

Modified: projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/util/DOMUtil.java
===================================================================
--- projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/util/DOMUtil.java	2008-04-02 22:10:34 UTC (rev 71643)
+++ projects/security/security-xacml/trunk/jboss-xacml-saml/src/main/java/org/jboss/security/xacml/saml/integration/opensaml/util/DOMUtil.java	2008-04-02 22:12:12 UTC (rev 71644)
@@ -23,6 +23,7 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.InputStream;
 
 import org.opensaml.xml.parse.BasicParserPool;
 import org.w3c.dom.Document;
@@ -34,18 +35,15 @@
  *  @version $Revision$
  */
 public class DOMUtil
-{
-
+{ 
    public static Document parse(File xmlFile, boolean validating) throws Exception
    {
       FileInputStream fis = null;
       
       try 
-      {
-         BasicParserPool parser = new BasicParserPool(); 
-         parser.setNamespaceAware(true);
+      { 
          fis = new FileInputStream(xmlFile);
-         return parser.parse(fis); 
+         return parse(fis,validating); 
      } 
      catch (Exception e) 
      {
@@ -57,4 +55,12 @@
            fis.close();
      }
    }
+   
+   public static Document parse(InputStream is, boolean validating)
+   throws Exception
+   {
+      BasicParserPool parser = new BasicParserPool(); 
+      parser.setNamespaceAware(true);
+      return parser.parse(is); 
+   }
 }
\ No newline at end of file




More information about the jboss-cvs-commits mailing list