|
From: <pe...@us...> - 2003-12-19 00:31:34
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv19108/src/java/org/neuclear/id
Modified Files:
InvalidNamedObjectException.java NSTools.java
Added Files:
NameResolutionException.java
Log Message:
Lots of usability changes through out all the passphrase agents and end user tools.
--- NEW FILE: NameResolutionException.java ---
package org.neuclear.id;
import org.neuclear.commons.NeuClearException;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Dec 18, 2003
* Time: 2:03:37 PM
* To change this template use Options | File Templates.
*/
public class NameResolutionException extends NeuClearException{
private final String name;
public NameResolutionException(final String name) {
super(name+" couldnt be resolved");
this.name=name;
}
public String getName() {
return name;
}
}
Index: InvalidNamedObjectException.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/InvalidNamedObjectException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** InvalidNamedObjectException.java 11 Dec 2003 23:57:29 -0000 1.1
--- InvalidNamedObjectException.java 19 Dec 2003 00:31:30 -0000 1.2
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.2 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.1 2003/12/11 23:57:29 pelle
* Trying to test the ReceiverServlet with cactus. Still no luck. Need to return a ElementProxy of some sort.
***************
*** 106,112 ****
public final class InvalidNamedObjectException extends NeuClearException {
! public InvalidNamedObjectException(final String msg) {
! super(msg);
}
}
--- 109,120 ----
public final class InvalidNamedObjectException extends NeuClearException {
! public InvalidNamedObjectException(final String name) {
! super(name+" is an invalid Identity");
! this.name=name;
}
+ public String getName() {
+ return name;
+ }
+ private final String name;
}
Index: NSTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/NSTools.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** NSTools.java 16 Dec 2003 23:44:10 -0000 1.22
--- NSTools.java 19 Dec 2003 00:31:30 -0000 1.23
***************
*** 2,5 ****
--- 2,8 ----
* $Id$
* $Log$
+ * Revision 1.23 2003/12/19 00:31:30 pelle
+ * Lots of usability changes through out all the passphrase agents and end user tools.
+ *
* Revision 1.22 2003/12/16 23:44:10 pelle
* End of work day clean up
***************
*** 188,191 ****
--- 191,195 ----
import org.neuclear.commons.crypto.CryptoTools;
import org.neuclear.id.builders.NamedObjectBuilder;
+ import org.neuclear.id.resolver.NSResolver;
import java.util.regex.Matcher;
***************
*** 261,269 ****
* @param uri a valid NEU Name
* @return Parent URI or null if name is the root
! * @throws NeuClearException if name is invalid
*/
! public static String getSignatoryURI(final String uri) throws NeuClearException {
if (!isValidName(uri))
! throw new InvalidNamedObjectException("Invalid Neu ID: " + uri);
final int bang = uri.indexOf('!');
--- 265,273 ----
* @param uri a valid NEU Name
* @return Parent URI or null if name is the root
! * @throws InvalidNamedObjectException if name is invalid
*/
! public static String getSignatoryURI(final String uri) throws InvalidNamedObjectException {
if (!isValidName(uri))
! throw new InvalidNamedObjectException(uri);
final int bang = uri.indexOf('!');
***************
*** 414,417 ****
--- 418,434 ----
return !Utility.isEmpty(elem.attributeValue(DocumentHelper.createQName("name", NS_NEUID)));
}
+
+ public static String getRepositoryURL(String alias) throws InvalidNamedObjectException {
+ String url=isHttpScheme(alias);
+ if (url==null){
+ try {
+ return NSResolver.resolveIdentity(alias).getRepository();
+ } catch (Exception e) {
+ return getRepositoryURL(getSignatoryURI(alias));
+ }
+ }
+ return url;
+ }
+
private static final String HTTP_SCHEME_EX = "^neu:(neuid:)?\\/\\/(([\\w-]+\\.)+[\\w-]+)$";
private static final Pattern HTTP_SCHEME = Pattern.compile(HTTP_SCHEME_EX);
|