|
From: Pelle B. <pe...@us...> - 2004-04-18 01:05:29
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22052/src/java/org/neuclear/id Modified Files: InvalidNamedObjectException.java Log Message: Forgot to add the <meta name="neu:type" content="Identity"/> tag to files generated by IdentityBuilder and it's sub classes. Index: InvalidNamedObjectException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/InvalidNamedObjectException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InvalidNamedObjectException.java 19 Dec 2003 18:03:34 -0000 1.3 --- InvalidNamedObjectException.java 18 Apr 2004 01:05:16 -0000 1.4 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.4 2004/04/18 01:05:16 pelle + * Forgot to add the <meta name="neu:type" content="Identity"/> tag to files generated by IdentityBuilder and it's sub classes. + * * Revision 1.3 2003/12/19 18:03:34 pelle * Revamped a lot of exception handling throughout the framework, it has been simplified in most places: *************** *** 114,120 **** package org.neuclear.id; - import org.neuclear.commons.NeuClearException; import org.dom4j.Element; import org.dom4j.QName; /** --- 117,124 ---- package org.neuclear.id; import org.dom4j.Element; import org.dom4j.QName; + import org.neuclear.commons.NeuClearException; + import org.neuclear.xml.XMLTools; /** *************** *** 122,136 **** */ public final class InvalidNamedObjectException extends NeuClearException { ! public InvalidNamedObjectException(final String name,final String message) { ! super(name+" is an invalid Identity\nCause: "+message); ! this.name=name; } ! public InvalidNamedObjectException(final String name,Throwable e) { ! super(name+" is an invalid Identity\nCause: "+e.getLocalizedMessage(),e); ! this.name=name; } public InvalidNamedObjectException(final String name) { ! super(name+" is an invalid Identity"); ! this.name=name; } --- 126,142 ---- */ public final class InvalidNamedObjectException extends NeuClearException { ! public InvalidNamedObjectException(final String name, final String message) { ! super(name + " is an invalid Identity\nCause: " + message); ! this.name = name; } ! ! public InvalidNamedObjectException(final String name, Throwable e) { ! super(name + " is an invalid Identity\nCause: " + e.getLocalizedMessage(), e); ! this.name = name; } + public InvalidNamedObjectException(final String name) { ! super(name + " is an invalid Identity"); ! this.name = name; } *************** *** 139,176 **** } ! public static void assertElementQName(SignedNamedCore core,Element elem,QName qname) throws InvalidNamedObjectException{ if (!elem.getQName().equals(qname)) ! throw new InvalidNamedObjectException(core.getName(),"Element: "+elem.getQualifiedName()+ " should be: "+qname.getQualifiedName()); } ! public static Element assertContainsElementQName(SignedNamedCore core,Element elem,QName qname) throws InvalidNamedObjectException{ final Element sub = elem.element(qname); ! if (sub==null) ! throw new InvalidNamedObjectException(core.getName(),"Element: "+elem.getQualifiedName()+ " should be: "+qname.getQualifiedName()); return sub; } ! public static String assertAttributeQName(SignedNamedCore core,Element elem,QName qname) throws InvalidNamedObjectException{ ! if (elem.attribute(qname)==null) ! throw new InvalidNamedObjectException(core.getName(),"Element: "+elem.getQualifiedName()+ " should contain attribute: "+qname.getQualifiedName()); return elem.attributeValue(qname); } ! public static void assertElementQName(Element elem,QName qname) throws InvalidNamedObjectException{ if (!elem.getQName().equals(qname)) ! throw new InvalidNamedObjectException("unknown","Element: "+elem.getQualifiedName()+ " should be: "+qname.getQualifiedName()); } ! public static Element assertContainsElementQName(Element elem,QName qname) throws InvalidNamedObjectException{ final Element sub = elem.element(qname); ! if (sub==null) ! throw new InvalidNamedObjectException("unknown","Element: "+elem.getQualifiedName()+ " should be: "+qname.getQualifiedName()); return sub; } ! public static String assertAttributeQName(Element elem,QName qname) throws InvalidNamedObjectException{ ! if (elem.attribute(qname)==null) ! throw new InvalidNamedObjectException("unknown","Element: "+elem.getQualifiedName()+ " should contain attribute: "+qname.getQualifiedName()); return elem.attributeValue(qname); } private final String name; } --- 145,191 ---- } ! public static void assertElementQName(SignedNamedCore core, Element elem, QName qname) throws InvalidNamedObjectException { if (!elem.getQName().equals(qname)) ! throw new InvalidNamedObjectException(core.getName(), "Element: " + elem.getQualifiedName() + " should be: " + qname.getQualifiedName()); } ! public static Element assertContainsElementQName(SignedNamedCore core, Element elem, QName qname) throws InvalidNamedObjectException { final Element sub = elem.element(qname); ! if (sub == null) ! throw new InvalidNamedObjectException(core.getName(), "Element: " + elem.getQualifiedName() + " should be: " + qname.getQualifiedName()); return sub; } ! public static Element assertContainsElementId(SignedNamedCore core, Element elem, String id) throws InvalidNamedObjectException { ! final Element sub = XMLTools.getByID(elem, id); ! if (sub == null) ! throw new InvalidNamedObjectException(core.getName(), "Element: " + elem.getQualifiedName() + " doesnt contain an element with id: " + id); ! return sub; ! } ! ! public static String assertAttributeQName(SignedNamedCore core, Element elem, QName qname) throws InvalidNamedObjectException { ! if (elem.attribute(qname) == null) ! throw new InvalidNamedObjectException(core.getName(), "Element: " + elem.getQualifiedName() + " should contain attribute: " + qname.getQualifiedName()); return elem.attributeValue(qname); } ! ! public static void assertElementQName(Element elem, QName qname) throws InvalidNamedObjectException { if (!elem.getQName().equals(qname)) ! throw new InvalidNamedObjectException("unknown", "Element: " + elem.getQualifiedName() + " should be: " + qname.getQualifiedName()); } ! public static Element assertContainsElementQName(Element elem, QName qname) throws InvalidNamedObjectException { final Element sub = elem.element(qname); ! if (sub == null) ! throw new InvalidNamedObjectException("unknown", "Element: " + elem.getQualifiedName() + " should be: " + qname.getQualifiedName()); return sub; } ! public static String assertAttributeQName(Element elem, QName qname) throws InvalidNamedObjectException { ! if (elem.attribute(qname) == null) ! throw new InvalidNamedObjectException("unknown", "Element: " + elem.getQualifiedName() + " should contain attribute: " + qname.getQualifiedName()); return elem.attributeValue(qname); } + private final String name; } |