juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject git commit: JUDDI-840 adding the ability to specify a full path
Date Wed, 24 Sep 2014 13:54:51 GMT
Repository: juddi
Updated Branches:
  refs/heads/master efc89d1c6 -> df037b02f


JUDDI-840 adding the ability to specify a full path


Project: http://git-wip-us.apache.org/repos/asf/juddi/repo
Commit: http://git-wip-us.apache.org/repos/asf/juddi/commit/df037b02
Tree: http://git-wip-us.apache.org/repos/asf/juddi/tree/df037b02
Diff: http://git-wip-us.apache.org/repos/asf/juddi/diff/df037b02

Branch: refs/heads/master
Commit: df037b02fbb92624996e004ae84cfca43f87a769
Parents: efc89d1
Author: Kurt Stam <kstam@apache.org>
Authored: Wed Sep 24 09:54:45 2014 -0400
Committer: Kurt Stam <kstam@apache.org>
Committed: Wed Sep 24 09:54:45 2014 -0400

----------------------------------------------------------------------
 .../juddi/v3/auth/XMLDocAuthenticator.java      | 29 ++++++++++++--------
 1 file changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/juddi/blob/df037b02/juddi-core/src/main/java/org/apache/juddi/v3/auth/XMLDocAuthenticator.java
----------------------------------------------------------------------
diff --git a/juddi-core/src/main/java/org/apache/juddi/v3/auth/XMLDocAuthenticator.java b/juddi-core/src/main/java/org/apache/juddi/v3/auth/XMLDocAuthenticator.java
index 5264885..8b3ad5c 100644
--- a/juddi-core/src/main/java/org/apache/juddi/v3/auth/XMLDocAuthenticator.java
+++ b/juddi-core/src/main/java/org/apache/juddi/v3/auth/XMLDocAuthenticator.java
@@ -17,11 +17,12 @@
 
 package org.apache.juddi.v3.auth;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 
 import javax.persistence.EntityManager;
@@ -100,16 +101,22 @@ public class XMLDocAuthenticator implements Authenticator
 	{
             
 		userTable = new HashMap<String, User> ();
-                String usersFileName = getFilename();
-                if (usersFileName==null || usersFileName.length()==0)
-                    throw new ConfigurationException("usersFileName value is null!");
-		//log.info("Reading jUDDI Users File: " + usersFileName + "...");
-                URL resource = ClassUtil.getResource(usersFileName, this.getClass());
-                if (resource!=null)
-                    log.info("Reading jUDDI Users File: " + usersFileName + "...from " +
resource.toExternalForm());
-                else
-                    log.info("Reading jUDDI Users File: " + usersFileName + "...");
-		InputStream stream = ClassUtil.getResource(usersFileName, this.getClass()).openStream();
+        String usersFileName = getFilename();
+        if (usersFileName==null || usersFileName.length()==0)
+           throw new ConfigurationException("usersFileName value is null!");
+        File file = new File(usersFileName);
+        InputStream stream = null;
+        if (file.exists()) {
+        	log.info("Reading jUDDI Users File: " + usersFileName + "...");
+        	stream = new FileInputStream(file);
+        } else {
+            URL resource = ClassUtil.getResource(usersFileName, this.getClass());
+            if (resource!=null)
+                log.info("Reading jUDDI Users File: " + usersFileName + "...from " + resource.toExternalForm());
+            else
+                log.info("Reading jUDDI Users File: " + usersFileName + "...");
+            stream = ClassUtil.getResource(usersFileName, this.getClass()).openStream();
+        }
 		JAXBContext jaxbContext=JAXBContext.newInstance(JuddiUsers.class);
 		Unmarshaller unMarshaller = jaxbContext.createUnmarshaller();
 		JAXBElement<JuddiUsers> element = unMarshaller.unmarshal(new StreamSource(stream),JuddiUsers.class);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message