diff --git a/asn1/config/checkstyle/checkstyle.xml b/asn1/config/checkstyle/checkstyle.xml deleted file mode 100644 index 55e59d2..0000000 --- a/asn1/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/asn1/config/maven/repo-settings.xml b/asn1/config/maven/repo-settings.xml deleted file mode 100644 index 5968882..0000000 --- a/asn1/config/maven/repo-settings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - ~/.m2/repository - - xbib - - - - xbib - - - xbib - http://xbib.org/repository - - true - always - - - true - - - - - - \ No newline at end of file diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1BitString.java b/asn1/src/main/java/org/xbib/asn1/ASN1BitString.java index 8461a5a..4ce2663 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1BitString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1BitString.java @@ -51,8 +51,8 @@ public final class ASN1BitString extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != BIT_STRING_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != BIT_STRING_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.getTag() + " expected " + BIT_STRING_TAG + "\n"); } if (berEncoding instanceof BERPrimitive) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Boolean.java b/asn1/src/main/java/org/xbib/asn1/ASN1Boolean.java index db68a4b..cfd8173 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Boolean.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Boolean.java @@ -48,9 +48,9 @@ public final class ASN1Boolean extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { + if (checkTag && (berEncoding.getTag() != TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { throw new ASN1EncodingException - ("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.tagGet() + + ("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.getTag() + " expected " + "TAG\n"); } if (berEncoding instanceof BERPrimitive) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Decoder.java b/asn1/src/main/java/org/xbib/asn1/ASN1Decoder.java index 067503b..8afbe41 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Decoder.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Decoder.java @@ -13,8 +13,8 @@ public class ASN1Decoder { } public static ASN1Any toASN1(BEREncoding ber) throws ASN1Exception { - if (ber.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) { - switch (ber.tagGet()) { + if (ber.getTagType() == BEREncoding.UNIVERSAL_TAG) { + switch (ber.getTag()) { case ASN1Boolean.TAG: return new ASN1Boolean(ber, true); case ASN1Integer.INTEGER_TAG: diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Enumerated.java b/asn1/src/main/java/org/xbib/asn1/ASN1Enumerated.java index d214ea7..8823a9f 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Enumerated.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Enumerated.java @@ -52,9 +52,9 @@ public final class ASN1Enumerated extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != ENUMERATED_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != ENUMERATED_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + ENUMERATED_TAG + "\n"); } if (!(berEncoding instanceof BERPrimitive)) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1External.java b/asn1/src/main/java/org/xbib/asn1/ASN1External.java index 8943769..f6293a8 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1External.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1External.java @@ -76,8 +76,8 @@ public final class ASN1External extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1Exception { - if (checkTag && (berEncoding.tagGet() != EXTERNAL_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != EXTERNAL_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + EXTERNAL_TAG + "\n"); } if (berEncoding instanceof BERPrimitive) { @@ -96,31 +96,31 @@ public final class ASN1External extends ASN1Any { } int part = 0; BEREncoding p = ber.elementAt(part); - if (p.tagGet() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG && - p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) { + if (p.getTag() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG && + p.getTagType() == BEREncoding.UNIVERSAL_TAG) { sDirectReference = new ASN1ObjectIdentifier(p, true); if (numParts <= ++part) { throw new ASN1EncodingException("incomplete"); } p = ber.elementAt(part); } - if (p.tagGet() == ASN1Integer.INTEGER_TAG && - p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) { + if (p.getTag() == ASN1Integer.INTEGER_TAG && + p.getTagType() == BEREncoding.UNIVERSAL_TAG) { sIndirectReference = new ASN1Integer(p, true); if (numParts <= ++part) { throw new ASN1EncodingException("incomplete"); } p = ber.elementAt(part); } - if (p.tagGet() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG && - p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) { + if (p.getTag() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG && + p.getTagType() == BEREncoding.UNIVERSAL_TAG) { sDataValueDescriptor = new ASN1ObjectDescriptor(p, true); if (numParts <= ++part) { throw new ASN1EncodingException("incomplete"); } p = ber.elementAt(part); } - switch (p.tagGet()) { + switch (p.getTag()) { case 0: if (!(p instanceof BERConstructed)) { throw new ASN1EncodingException("singleASN1type: bad form, primitive"); @@ -132,20 +132,20 @@ public final class ASN1External extends ASN1Any { break; case 1: // octetAligned [1] IMPLICIT OCTET STRING - if (p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("encoding: bad tag type " + p); } cOctetAligned = new ASN1OctetString(p, false); break; case 2: // arbitrary [2] IMPLICIT BIT STRING - if (p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("encoding: bad tag type " + p); } cArbitrary = new ASN1BitString(p, false); break; default: - throw new ASN1EncodingException("encoding: tag = " + p.tagGet()); + throw new ASN1EncodingException("encoding: tag = " + p.getTag()); } if (part != (numParts - 1)) { throw new ASN1Exception("extra element(s)"); diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1GeneralString.java b/asn1/src/main/java/org/xbib/asn1/ASN1GeneralString.java index 5b3dd8d..5f45a09 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1GeneralString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1GeneralString.java @@ -31,8 +31,8 @@ public class ASN1GeneralString extends ASN1OctetString { public ASN1GeneralString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != GENERAL_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != GENERAL_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + GENERAL_STRING_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1GeneralizedTime.java b/asn1/src/main/java/org/xbib/asn1/ASN1GeneralizedTime.java index 6316257..c4d31c1 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1GeneralizedTime.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1GeneralizedTime.java @@ -31,8 +31,8 @@ public final class ASN1GeneralizedTime extends ASN1VisibleString { public ASN1GeneralizedTime(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != GENERALIZED_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != GENERALIZED_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + GENERALIZED_TIME_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1GraphicString.java b/asn1/src/main/java/org/xbib/asn1/ASN1GraphicString.java index ff106b3..7f34514 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1GraphicString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1GraphicString.java @@ -32,8 +32,8 @@ public class ASN1GraphicString extends ASN1OctetString { */ public ASN1GraphicString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != GRAPHIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != GRAPHIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + GRAPHIC_STRING_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1IA5String.java b/asn1/src/main/java/org/xbib/asn1/ASN1IA5String.java index 8e4cfed..a3b3839 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1IA5String.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1IA5String.java @@ -31,8 +31,8 @@ public final class ASN1IA5String extends ASN1OctetString { */ public ASN1IA5String(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != IA5_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != IA5_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + IA5_STRING_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Integer.java b/asn1/src/main/java/org/xbib/asn1/ASN1Integer.java index 3dbdb75..91397b4 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Integer.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Integer.java @@ -54,9 +54,9 @@ public final class ASN1Integer extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != INTEGER_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != INTEGER_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + INTEGER_TAG + "\n"); } if (!(berEncoding instanceof BERPrimitive)) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Null.java b/asn1/src/main/java/org/xbib/asn1/ASN1Null.java index 939e488..137b964 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Null.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Null.java @@ -40,9 +40,9 @@ public final class ASN1Null extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != NULL_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != NULL_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + NULL_TAG + "\n"); } if (!(berEncoding instanceof BERPrimitive)) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1NumericString.java b/asn1/src/main/java/org/xbib/asn1/ASN1NumericString.java index 62de801..f0f8a11 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1NumericString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1NumericString.java @@ -31,8 +31,8 @@ public class ASN1NumericString extends ASN1OctetString { public ASN1NumericString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != NUMERIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != NUMERIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + NUMERIC_STRING_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1ObjectDescriptor.java b/asn1/src/main/java/org/xbib/asn1/ASN1ObjectDescriptor.java index 5062655..66ec537 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1ObjectDescriptor.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1ObjectDescriptor.java @@ -32,9 +32,9 @@ public final class ASN1ObjectDescriptor extends ASN1GraphicString { public ASN1ObjectDescriptor(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != OBJECT_DESCRIPTOR_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { + if (checkTag && (ber.getTag() != OBJECT_DESCRIPTOR_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { throw new ASN1EncodingException - ("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.tagGet() + + ("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.getTag() + " expected " + OBJECT_DESCRIPTOR_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1ObjectIdentifier.java b/asn1/src/main/java/org/xbib/asn1/ASN1ObjectIdentifier.java index 237fde8..dae2e1a 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1ObjectIdentifier.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1ObjectIdentifier.java @@ -49,9 +49,9 @@ public final class ASN1ObjectIdentifier extends ASN1Any { */ @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != OBJECT_IDENTIFIER_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != OBJECT_IDENTIFIER_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + OBJECT_IDENTIFIER_TAG + "\n"); } if (!(berEncoding instanceof BERPrimitive)) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1OctetString.java b/asn1/src/main/java/org/xbib/asn1/ASN1OctetString.java index 0a1aa22..f5bcb61 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1OctetString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1OctetString.java @@ -68,9 +68,9 @@ public class ASN1OctetString extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException { - if (checkTag && (berEncoding.tagGet() != OCTET_STRING_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + + if (checkTag && (berEncoding.getTag() != OCTET_STRING_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + OCTET_STRING_TAG + "\n"); } if (berEncoding instanceof BERPrimitive) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1PrintableString.java b/asn1/src/main/java/org/xbib/asn1/ASN1PrintableString.java index 434eec0..4846049 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1PrintableString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1PrintableString.java @@ -49,8 +49,8 @@ public final class ASN1PrintableString extends ASN1OctetString { public ASN1PrintableString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != PRINTABLE_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.tagGet() + + if (checkTag && (ber.getTag() != PRINTABLE_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.getTag() + " expected " + PRINTABLE_STRING_TAG + "\n"); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Sequence.java b/asn1/src/main/java/org/xbib/asn1/ASN1Sequence.java index bb8823e..08d1989 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Sequence.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Sequence.java @@ -54,9 +54,9 @@ public final class ASN1Sequence extends ASN1Any { @Override public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1Exception { - if (checkTag && (berEncoding.tagGet() != SEQUENCE_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { + if (checkTag && (berEncoding.getTag() != SEQUENCE_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { throw new ASN1EncodingException - ("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.tagGet() + + ("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.getTag() + " expected " + SEQUENCE_TAG + "\n"); } if (berEncoding instanceof BERPrimitive) { diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1Set.java b/asn1/src/main/java/org/xbib/asn1/ASN1Set.java index b1ff076..3b0085b 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1Set.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1Set.java @@ -53,12 +53,10 @@ public final class ASN1Set extends ASN1Any { * @throws ASN1Exception If the BER encoding is incorrect. */ @Override - public void berDecode(BEREncoding berEncoding, boolean checkTag) - throws ASN1Exception { - if (checkTag && (berEncoding.tagGet() != SET_TAG || - berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() + - " expected " + SET_TAG + "\n"); + public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1Exception { + if (checkTag && (berEncoding.getTag() != SET_TAG || + berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + SET_TAG); } if (berEncoding instanceof BERPrimitive) { throw new ASN1EncodingException("bad form, primitive"); diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1T61String.java b/asn1/src/main/java/org/xbib/asn1/ASN1T61String.java index c8e08e9..13d4347 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1T61String.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1T61String.java @@ -35,10 +35,8 @@ public final class ASN1T61String extends ASN1OctetString { public ASN1T61String(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != T61_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException - ("ASN.1 T61String: bad BER: tag=" + ber.tagGet() + - " expected " + T61_STRING_TAG + "\n"); + if (checkTag && (ber.getTag() != T61_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("ASN.1 T61String: bad BER: tag=" + ber.getTag() + " expected " + T61_STRING_TAG); } } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1UTCTime.java b/asn1/src/main/java/org/xbib/asn1/ASN1UTCTime.java index b2b3500..c933ce0 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1UTCTime.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1UTCTime.java @@ -39,13 +39,10 @@ public final class ASN1UTCTime extends ASN1VisibleString { * @param checkTag If true, it checks the tag. Use false if is implicitly tagged. * @throws ASN1Exception If the BER encoding is incorrect. */ - public ASN1UTCTime(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public ASN1UTCTime(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != UTC_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException - ("ASN.1 UTCTime: bad BER: tag=" + ber.tagGet() + - " expected " + UTC_TIME_TAG + "\n"); + if (checkTag && (ber.getTag() != UTC_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + UTC_TIME_TAG); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1VideotexString.java b/asn1/src/main/java/org/xbib/asn1/ASN1VideotexString.java index 6fdfa41..f089ea8 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1VideotexString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1VideotexString.java @@ -30,9 +30,8 @@ public class ASN1VideotexString extends ASN1OctetString { */ public ASN1VideotexString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != VIDEOTEX_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + - " expected " + VIDEOTEX_STRING_TAG + "\n"); + if (checkTag && (ber.getTag() != VIDEOTEX_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + VIDEOTEX_STRING_TAG); } } diff --git a/asn1/src/main/java/org/xbib/asn1/ASN1VisibleString.java b/asn1/src/main/java/org/xbib/asn1/ASN1VisibleString.java index 5ccf849..401f079 100644 --- a/asn1/src/main/java/org/xbib/asn1/ASN1VisibleString.java +++ b/asn1/src/main/java/org/xbib/asn1/ASN1VisibleString.java @@ -33,9 +33,8 @@ public class ASN1VisibleString extends ASN1OctetString { public ASN1VisibleString(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, false); - if (checkTag && (ber.tagGet() != TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) { - throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() + - " expected " + TAG + "\n"); + if (checkTag && (ber.getTag() != TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + TAG); } } diff --git a/asn1/src/main/java/org/xbib/asn1/BERConstructed.java b/asn1/src/main/java/org/xbib/asn1/BERConstructed.java index 55850b3..d1c8215 100644 --- a/asn1/src/main/java/org/xbib/asn1/BERConstructed.java +++ b/asn1/src/main/java/org/xbib/asn1/BERConstructed.java @@ -29,7 +29,7 @@ public class BERConstructed extends BEREncoding { throws ASN1Exception { int contentLength = 0; for (BEREncoding element : elements) { - contentLength += element.iTotalLength; + contentLength += element.totalLength; } init(asn1Class, true, tag, contentLength); contentElements = elements; @@ -65,7 +65,7 @@ public class BERConstructed extends BEREncoding { @Override public String toString() { StringBuilder str = new StringBuilder("["); - switch (iTagType) { + switch (tagType) { case BEREncoding.UNIVERSAL_TAG: str.append("UNIVERSAL "); break; @@ -81,7 +81,7 @@ public class BERConstructed extends BEREncoding { default: break; } - str.append(String.valueOf(iTag)).append("]{"); + str.append(String.valueOf(tag)).append("]{"); for (int x = 0; x < contentElements.length; x++) { if (x != 0) { str.append(','); @@ -96,10 +96,10 @@ public class BERConstructed extends BEREncoding { * This protected method is used to implement the "get_encoding" method. */ @Override - protected int iEncodingGet(int offset, byte[] data) { - int i = iGetHead(offset, data); + protected int getEncoding(int offset, byte[] data) { + int i = getHead(offset, data); for (BEREncoding contentElement : contentElements) { - i = contentElement.iEncodingGet(i, data); + i = contentElement.getEncoding(i, data); } return i; } diff --git a/asn1/src/main/java/org/xbib/asn1/BEREncoding.java b/asn1/src/main/java/org/xbib/asn1/BEREncoding.java index c879256..6be9cea 100644 --- a/asn1/src/main/java/org/xbib/asn1/BEREncoding.java +++ b/asn1/src/main/java/org/xbib/asn1/BEREncoding.java @@ -50,20 +50,20 @@ public abstract class BEREncoding { * the same as that encoded in the identiferEncoding. * This is an internal member. You should not use this. */ - protected int iTagType; + protected int tagType; /** * The tag number of this BER encoded object. This value must be * the same as that encoded in the identiferEncoding. * This is an internal member. You should not use this. */ - protected int iTag; + protected int tag; /** * The total length of this BER object (the identifier octets, plus * length octets, plus content octects). This variable must be * set up before this object is used (using the init method). * This is an internal member. You should not use this. */ - protected int iTotalLength; + protected int totalLength; /** * Storage for the identifier octets. This variable is set up by * calling the make_identifer method. @@ -85,53 +85,28 @@ public abstract class BEREncoding { return lengthEncoding; } - public int getITag() { - return iTag; - } - - public int getITagType() { - return iTagType; - } - - public int getITotalLength() { - return iTotalLength; - } - - /** - * Returns the BER encoded object as an array of bytes. This routine - * may be of use if you want to use the encoding rather than sending - * it off. If you want to just output it, it is more efficient to - * use the output method. - * @return byte array - */ - public byte[] encodingGet() { - byte[] result = new byte[iTotalLength]; - iEncodingGet(0, result); - return result; - } - /** * Method to examine the tag type of the BER encoded ASN.1 object. * @return integer */ - public int tagTypeGet() { - return iTagType; + public int getTagType() { + return tagType; } /** * Method to examine the tag number of the BER encoded ASN.1 object. * @return integer */ - public int tagGet() { - return iTag; + public int getTag() { + return tag; } /** * Returns the total number of bytes the encoding occupies. * @return integer */ - public int totalLength() { - return iTotalLength; + public int getTotalLength() { + return totalLength; } /** @@ -149,7 +124,7 @@ public abstract class BEREncoding { throws ASN1Exception { makeIdentifier(tagType, isConstructed, tag); makeLength(length); - iTotalLength = identifierEncoding.length + lengthEncoding.length + length; + totalLength = identifierEncoding.length + lengthEncoding.length + length; } /* @@ -158,7 +133,7 @@ public abstract class BEREncoding { * This is used by the superclasses to implement the "encodingGet" * method. */ - protected int iGetHead(int offset, byte[] data) { + protected int getHead(int offset, byte[] data) { for (int anIdentifierEncoding : identifierEncoding) { data[offset++] = (byte) anIdentifierEncoding; } @@ -174,7 +149,7 @@ public abstract class BEREncoding { * array (as bytes), starting at offset into the array. The * offset of the last element used plus one is returned. */ - protected abstract int iEncodingGet(int offset, byte[] data); + protected abstract int getEncoding(int offset, byte[] data); /** * This private method encodes the identifier octets. When a BER @@ -201,12 +176,12 @@ public abstract class BEREncoding { if (tag < 0) { throw new ASN1Exception("ASN.1 tag value is negative"); } - iTagType = tagType & 0xC0; - b = iTagType; + this.tagType = tagType & 0xC0; + b = this.tagType; if (isConstructed) { b |= 0x20; } - iTag = tag; + this.tag = tag; if (tag <= 30) { b |= (tag & 0x1F); identifierEncoding = new int[1]; diff --git a/asn1/src/main/java/org/xbib/asn1/BERPrimitive.java b/asn1/src/main/java/org/xbib/asn1/BERPrimitive.java index 5b59a47..1c5a990 100644 --- a/asn1/src/main/java/org/xbib/asn1/BERPrimitive.java +++ b/asn1/src/main/java/org/xbib/asn1/BERPrimitive.java @@ -31,10 +31,18 @@ public class BERPrimitive extends BEREncoding { * classes. It is not intended that higher level classes create * BERPrimitives directly. * + * @param asn1Class ASN.1 class + * @param tag tag + * @param contents contents + * + * @throws ASN1Exception if BER primitive fails + * * @see org.xbib.asn1.BEREncoding#UNIVERSAL_TAG * @see org.xbib.asn1.BEREncoding#APPLICATION_TAG * @see org.xbib.asn1.BEREncoding#CONTEXT_SPECIFIC_TAG * @see org.xbib.asn1.BEREncoding#PRIVATE_TAG + * + * */ public BERPrimitive(int asn1Class, int tag, int[] contents) throws ASN1Exception { init(asn1Class, false, tag, contents.length); @@ -44,6 +52,7 @@ public class BERPrimitive extends BEREncoding { /** * This method allows the content octets to be examined. * Once again, only the ASN.1 standard objects should be using this. + * @return content octets */ public int[] getContentOctets() { return contentsOctets; @@ -52,11 +61,12 @@ public class BERPrimitive extends BEREncoding { /** * Returns a new String object representing this BER encoded * ASN.1 object's value. + * @return string */ @Override public String toString() { StringBuilder str = new StringBuilder("["); - switch (iTagType) { + switch (tagType) { case BEREncoding.UNIVERSAL_TAG: str.append("UNIVERSAL "); break; @@ -72,7 +82,7 @@ public class BERPrimitive extends BEREncoding { default: break; } - str.append(String.valueOf(iTag)).append("] '"); + str.append(String.valueOf(tag)).append("] '"); for (int octet : contentsOctets) { str.append(hex[(octet >> 4) & 0x0f]); str.append(hex[octet & 0x0f]); @@ -83,10 +93,12 @@ public class BERPrimitive extends BEREncoding { /** * This protected method is used to implement the "get_encoding" method. + * + * @return integer */ @Override - protected int iEncodingGet(int offset, byte[] data) { - int i = iGetHead(offset, data); + protected int getEncoding(int offset, byte[] data) { + int i = getHead(offset, data); for (int contentsOctet : contentsOctets) { data[i++] = (byte) contentsOctet; } diff --git a/asn1/src/main/java/org/xbib/asn1/io/InputStreamBERReader.java b/asn1/src/main/java/org/xbib/asn1/io/InputStreamBERReader.java index 926acb1..7901122 100644 --- a/asn1/src/main/java/org/xbib/asn1/io/InputStreamBERReader.java +++ b/asn1/src/main/java/org/xbib/asn1/io/InputStreamBERReader.java @@ -147,8 +147,8 @@ public class InputStreamBERReader implements BERReader { if (chunk == null) { throw new ASN1EncodingException(ERROR); } - if (chunk.getITag() == 0 && chunk.getITagType() == BEREncoding.UNIVERSAL_TAG && - chunk.getITotalLength() == 2) { + if (chunk.getTag() == 0 && chunk.getTagType() == BEREncoding.UNIVERSAL_TAG && + chunk.getTotalLength() == 2) { break; } else { chunks.add(chunk); diff --git a/build.gradle b/build.gradle index 58dec43..4ca44a0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ plugins { + id "com.github.spotbugs" version "1.6.2" id "org.sonarqube" version '2.6.1' id "io.codearte.nexus-staging" version "0.11.0" } @@ -17,18 +18,22 @@ printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGradle: %s Groovy: %s Java: %s GroovySystem.getVersion(), JavaVersion.current() + +apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'checkstyle' +apply plugin: 'pmd' +apply plugin: 'jacoco' +apply plugin: "com.github.spotbugs" + + +apply from: "${rootProject.projectDir}/gradle/ext.gradle" +apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle" + subprojects { apply plugin: 'java' apply plugin: 'maven' apply plugin: 'signing' - apply plugin: 'findbugs' - apply plugin: 'pmd' - apply plugin: 'checkstyle' - apply plugin: 'jacoco' - - repositories { - mavenCentral() - } configurations { wagon @@ -82,8 +87,6 @@ subprojects { sign configurations.archives } } - - apply from: "${rootProject.projectDir}/gradle/ext.gradle" apply from: "${rootProject.projectDir}/gradle/publish.gradle" - apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle" + } diff --git a/gradle.properties b/gradle.properties index ed6e0d5..bf534e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,11 @@ group = org.xbib name = z3950 -version = 1.2.0 +version = 1.2.1 xbib-cql.version = 1.2.0 netty.version = 4.1.29.Final junit.version = 4.12 -wagon.version = 3.0.0 \ No newline at end of file +wagon.version = 3.0.0 + +org.gradle.warning.mode = all diff --git a/gradle/sonarqube.gradle b/gradle/sonarqube.gradle index df61702..84b3414 100644 --- a/gradle/sonarqube.gradle +++ b/gradle/sonarqube.gradle @@ -1,9 +1,19 @@ -tasks.withType(FindBugs) { + + +spotbugs { + toolVersion = '3.1.3' + sourceSets = [sourceSets.main] ignoreFailures = true - reports { - xml.enabled = false - html.enabled = true - } + effort = "max" + reportLevel = "high" +} +spotbugsMain.reports { + xml.enabled = false + html.enabled = true +} +spotbugsTest.reports { + xml.enabled = false + html.enabled = true } tasks.withType(Pmd) { ignoreFailures = true diff --git a/z3950/config/checkstyle/checkstyle.xml b/z3950/config/checkstyle/checkstyle.xml deleted file mode 100644 index 55e59d2..0000000 --- a/z3950/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,323 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/z3950/config/maven/repo-settings.xml b/z3950/config/maven/repo-settings.xml deleted file mode 100644 index 5968882..0000000 --- a/z3950/config/maven/repo-settings.xml +++ /dev/null @@ -1,24 +0,0 @@ - - ~/.m2/repository - - xbib - - - - xbib - - - xbib - http://xbib.org/repository - - true - always - - - true - - - - - - \ No newline at end of file diff --git a/z3950/src/main/java/org/xbib/io/iso23950/ScanListener.java b/z3950/src/main/java/org/xbib/io/iso23950/ScanListener.java new file mode 100644 index 0000000..854fd7b --- /dev/null +++ b/z3950/src/main/java/org/xbib/io/iso23950/ScanListener.java @@ -0,0 +1,12 @@ +package org.xbib.io.iso23950; + +import org.xbib.asn1.BEREncoding; + +/** + * + */ +@FunctionalInterface +public interface ScanListener { + + void onScan(BEREncoding result); +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/ResponseListener.java b/z3950/src/main/java/org/xbib/io/iso23950/SearchListener.java similarity index 84% rename from z3950/src/main/java/org/xbib/io/iso23950/ResponseListener.java rename to z3950/src/main/java/org/xbib/io/iso23950/SearchListener.java index 43c90e8..fc8bf14 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/ResponseListener.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/SearchListener.java @@ -6,7 +6,7 @@ import java.io.IOException; * */ @FunctionalInterface -public interface ResponseListener { +public interface SearchListener { void onResponse(int status, int total, int returned, long elapsedMillis) throws IOException; } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/ZClient.java b/z3950/src/main/java/org/xbib/io/iso23950/ZClient.java index 0479b5c..8e2fec7 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/ZClient.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/ZClient.java @@ -1,27 +1,18 @@ package org.xbib.io.iso23950; -import org.xbib.asn1.ASN1Exception; -import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.io.InputStreamBERReader; import org.xbib.asn1.io.OutputStreamBERWriter; -import org.xbib.cql.CQLParser; -import org.xbib.io.iso23950.cql.CQLRPNGenerator; +import org.xbib.io.iso23950.operations.CloseOperation; import org.xbib.io.iso23950.operations.InitOperation; import org.xbib.io.iso23950.operations.PresentOperation; +import org.xbib.io.iso23950.operations.ScanOperation; import org.xbib.io.iso23950.operations.SearchOperation; -import org.xbib.io.iso23950.pqf.PQFParser; -import org.xbib.io.iso23950.pqf.PQFRPNGenerator; -import org.xbib.io.iso23950.v3.Close; -import org.xbib.io.iso23950.v3.CloseReason; -import org.xbib.io.iso23950.v3.PDU; -import org.xbib.io.iso23950.v3.RPNQuery; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.io.StringReader; import java.net.InetSocketAddress; import java.net.Socket; import java.text.MessageFormat; @@ -136,9 +127,9 @@ public class ZClient implements AutoCloseable { } } - public int executeCQL(String query, int offset, int length, - ResponseListener responseListener, - RecordListener recordListener) throws IOException { + public int searchCQL(String query, int offset, int length, + SearchListener searchListener, + RecordListener recordListener) throws IOException { if (query == null) { throw new IllegalArgumentException("no query"); } @@ -146,12 +137,12 @@ public class ZClient implements AutoCloseable { try { lock.lock(); SearchOperation searchOperation = new SearchOperation(berReader, berWriter, resultSetName, databases, host); - boolean success = searchOperation.execute(createRPNQueryFromCQL(query)); + boolean success = searchOperation.executeCQL(query); if (!success) { logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query)); } else { - if (responseListener == null) { - responseListener = (status, total, returned, elapsedMillis) -> { + if (searchListener == null) { + searchListener = (status, total, returned, elapsedMillis) -> { logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]", elapsedMillis, total, returned, query)); }; @@ -167,7 +158,7 @@ public class ZClient implements AutoCloseable { // avoid condition 13 "Present request out-of-range" length = searchOperation.getCount(); } - present.execute(offset, length, searchOperation.getCount(), responseListener, recordListener); + present.execute(offset, length, searchOperation.getCount(), searchListener, recordListener); } } return searchOperation.getCount(); @@ -176,9 +167,9 @@ public class ZClient implements AutoCloseable { } } - public int executePQF(String query, int offset, int length, - ResponseListener responseListener, - RecordListener recordListener) throws IOException { + public int searchPQF(String query, int offset, int length, + SearchListener searchListener, + RecordListener recordListener) throws IOException { if (query == null) { throw new IllegalArgumentException("no query"); } @@ -186,18 +177,18 @@ public class ZClient implements AutoCloseable { try { lock.lock(); SearchOperation search = new SearchOperation(berReader, berWriter, resultSetName, databases, host); - search.execute(createRPNQueryFromPQF(query)); + search.executePQF(query); if (!search.isSuccess()) { logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query)); } else { - if (responseListener == null) { - responseListener = (status, total, returned, elapsedMillis) -> { + if (searchListener == null) { + searchListener = (status, total, returned, elapsedMillis) -> { logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]", elapsedMillis, total, returned, query)); }; } if (search.getCount() > 0) { - logger.log(Level.INFO, "search returned " + search.getCount()); + logger.log(Level.FINE, "search returned " + search.getCount()); PresentOperation present = new PresentOperation(berReader, berWriter, resultSetName, elementSetName, preferredRecordSyntax); if (offset < 1) { @@ -208,7 +199,7 @@ public class ZClient implements AutoCloseable { // avoid condition 13 "Present request out-of-range" length = search.getCount(); } - present.execute(offset, length, search.getCount(), responseListener, recordListener); + present.execute(offset, length, search.getCount(), searchListener, recordListener); } } return search.getCount(); @@ -217,6 +208,18 @@ public class ZClient implements AutoCloseable { } } + public void scanPQF(String query, int nTerms, int step, int position, + ScanListener scanListener) throws IOException { + ensureConnected(); + try { + lock.lock(); + ScanOperation scanOperation = new ScanOperation(berReader, berWriter, databases); + scanOperation.executePQF(nTerms, step, position, query, scanListener); + } finally { + lock.unlock(); + } + } + public String getHost() { return host; } @@ -265,56 +268,6 @@ public class ZClient implements AutoCloseable { return databases; } - private RPNQuery createRPNQueryFromCQL(String query) { - CQLRPNGenerator generator = new CQLRPNGenerator(); - CQLParser parser = new CQLParser(query); - parser.parse(); - parser.getCQLQuery().accept(generator); - return generator.getQueryResult(); - } - - - private RPNQuery createRPNQueryFromPQF(String query) { - PQFRPNGenerator generator = new PQFRPNGenerator(); - PQFParser parser = new PQFParser(new StringReader(query)); - parser.parse(); - parser.getResult().accept(generator); - return generator.getResult(); - } - - /** - * Send a close request to the server. - * - * @param reason reason Reason codes are: - * 0=finished 1=shutdown 2=system problem 3=cost limits - * 4=resources 5=security violation 6=protocol error 7=lack of activity - * 8=peer abort 9=unspecified - * @throws IOException if close fails - */ - private void sendClose(int reason) throws IOException { - if (!isConnected()) { - return; - } - try { - lock.lock(); - PDU pdu = new PDU(); - pdu.c_close = new Close(); - pdu.c_close.sCloseReason = new CloseReason(); - pdu.c_close.sCloseReason.value = new ASN1Integer(reason); - pdu.c_close.sReferenceId = null; - try { - berWriter.write(pdu.berEncode()); - } catch (ASN1Exception ex) { - throw new IOException(ex); - } - // do not wait, it may hang - //waitClosePDU(); - } finally { - lock.unlock(); - } - } - - private void connect() throws IOException { try { lock.lock(); @@ -330,6 +283,7 @@ public class ZClient implements AutoCloseable { if (initOperation.execute(preferredMessageSize, initListener)) { throw new IOException("could not initiate connection"); } + logger.log(Level.INFO, initOperation.getTargetInfo()); } finally { lock.unlock(); } @@ -349,6 +303,28 @@ public class ZClient implements AutoCloseable { return new Builder(); } + /** + * Send a close request to the server. + * + * @param reason reason Reason codes are: + * 0=finished 1=shutdown 2=system problem 3=cost limits + * 4=resources 5=security violation 6=protocol error 7=lack of activity + * 8=peer abort 9=unspecified + * @throws IOException if close fails + */ + private void sendClose(int reason) throws IOException { + if (!isConnected()) { + return; + } + try { + lock.lock(); + CloseOperation closeOperation = new CloseOperation(berReader, berWriter); + closeOperation.execute(reason); + } finally { + lock.unlock(); + } + } + /** * */ diff --git a/z3950/src/main/java/org/xbib/io/iso23950/cql/CQLRPNGenerator.java b/z3950/src/main/java/org/xbib/io/iso23950/cql/CQLRPNGenerator.java index cc791e5..63cd26e 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/cql/CQLRPNGenerator.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/cql/CQLRPNGenerator.java @@ -46,27 +46,15 @@ import java.util.Stack; */ public final class CQLRPNGenerator implements Visitor { - /** - * BIB-1 Use attributes resource bundle. - */ - private static final ResourceBundle bib = - ResourceBundle.getBundle("org.xbib.io.iso23950.cql.bib-1"); - - /** - * Dublin Core Use attributes resource bundle. - */ - private static final ResourceBundle dc = - ResourceBundle.getBundle("org.xbib.io.iso23950.cql.dc"); - /** * Context map. */ private final Map contexts = new HashMap() { private static final long serialVersionUID = 8199395368653216950L; - { - put("bib", bib); - put("dc", dc); + put("bib", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.bib-1")); + put("dc", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.dc")); + put("gbv", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.gbv")); } }; private Stack result; @@ -90,10 +78,10 @@ public final class CQLRPNGenerator implements Visitor { } if (!result.isEmpty()) { this.rpnQuery = new RPNQuery(); - rpnQuery.s_rpn = (RPNStructure) result.pop(); + rpnQuery.rpn = (RPNStructure) result.pop(); // Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1 - rpnQuery.s_attributeSet = new AttributeSetId(); - rpnQuery.s_attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1}); + rpnQuery.attributeSet = new AttributeSetId(); + rpnQuery.attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1}); } else { throw new SyntaxException("unable to generate RPN from CQL"); } @@ -154,13 +142,13 @@ public final class CQLRPNGenerator implements Visitor { BooleanOperator op = node.getBooleanGroup().getOperator(); switch (op) { case AND: - rpn.c_rpnRpnOp.s_op.c_and = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.andOp = new ASN1Null(); break; case OR: - rpn.c_rpnRpnOp.s_op.c_or = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.orOp = new ASN1Null(); break; case NOT: - rpn.c_rpnRpnOp.s_op.c_and_not = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.andNotOp = new ASN1Null(); break; default: break; @@ -193,17 +181,17 @@ public final class CQLRPNGenerator implements Visitor { node.getRelation().accept(this); } Operand operand = new Operand(); - operand.c_attrTerm = new AttributesPlusTerm(); - operand.c_attrTerm.sTerm = new org.xbib.io.iso23950.v3.Term(); - operand.c_attrTerm.sTerm.c_general = new ASN1OctetString(node.getTerm().getValue()); + operand.attrTerm = new AttributesPlusTerm(); + operand.attrTerm.term = new org.xbib.io.iso23950.v3.Term(); + operand.attrTerm.term.c_general = new ASN1OctetString(node.getTerm().getValue()); Stack attrs = new Stack<>(); ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null; while (any != null) { attrs.push((AttributeElement) any); any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null; } - operand.c_attrTerm.sAttributes = new AttributeList(); - operand.c_attrTerm.sAttributes.value = attrs.toArray(new AttributeElement[attrs.size()]); + operand.attrTerm.attributes = new AttributeList(); + operand.attrTerm.attributes.value = attrs.toArray(new AttributeElement[attrs.size()]); RPNStructure rpn = new RPNStructure(); rpn.c_op = operand; result.push(rpn); @@ -248,9 +236,9 @@ public final class CQLRPNGenerator implements Visitor { } if (n != 3) { AttributeElement ae = new AttributeElement(); - ae.sAttributeType = new ASN1Integer(t); + ae.attributeType = new ASN1Integer(t); ae.attributeValue = new AttributeElementAttributeValue(); - ae.attributeValue.cNumeric = new ASN1Integer(n); + ae.attributeValue.numeric = new ASN1Integer(n); result.push(ae); } } @@ -289,9 +277,9 @@ public final class CQLRPNGenerator implements Visitor { } if (n != 100) { AttributeElement ae = new AttributeElement(); - ae.sAttributeType = new ASN1Integer(t); + ae.attributeType = new ASN1Integer(t); ae.attributeValue = new AttributeElementAttributeValue(); - ae.attributeValue.cNumeric = new ASN1Integer(n); + ae.attributeValue.numeric = new ASN1Integer(n); result.push(ae); v = v.replaceAll("\\*", ""); } @@ -318,9 +306,9 @@ public final class CQLRPNGenerator implements Visitor { int t = 1; int n = getUseAttr(context, node.getName()); AttributeElement ae = new AttributeElement(); - ae.sAttributeType = new ASN1Integer(t); + ae.attributeType = new ASN1Integer(t); ae.attributeValue = new AttributeElementAttributeValue(); - ae.attributeValue.cNumeric = new ASN1Integer(n); + ae.attributeValue.numeric = new ASN1Integer(n); result.push(ae); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/netty/Client.java b/z3950/src/main/java/org/xbib/io/iso23950/netty/NettyZClient.java similarity index 85% rename from z3950/src/main/java/org/xbib/io/iso23950/netty/Client.java rename to z3950/src/main/java/org/xbib/io/iso23950/netty/NettyZClient.java index d99010b..b4a5cdf 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/netty/Client.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/netty/NettyZClient.java @@ -1,6 +1,7 @@ package org.xbib.io.iso23950.netty; import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelHandlerContext; @@ -11,17 +12,18 @@ import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.util.CharsetUtil; -import org.xbib.io.iso23950.v3.PDU; -import java.io.IOException; import java.net.InetSocketAddress; -public class Client { +/** + * + */ +public class NettyZClient { private final EventLoopGroup group; private final Bootstrap clientBootstrap; - public Client() { + public NettyZClient() { this.group = new NioEventLoopGroup(); clientBootstrap = new Bootstrap(); clientBootstrap.group(group); @@ -40,15 +42,12 @@ public class Client { } - public void writePDU(PDU pdu) throws IOException { - - } public void shutdown() throws InterruptedException { group.shutdownGracefully().sync(); } - class Handler extends SimpleChannelInboundHandler { + class Handler extends SimpleChannelInboundHandler { @Override public void channelActive(ChannelHandlerContext channelHandlerContext){ @@ -62,7 +61,7 @@ public class Client { } @Override - protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { + protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception { } } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/AbstractOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/AbstractOperation.java index 4e68918..2a19d74 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/operations/AbstractOperation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/AbstractOperation.java @@ -1,14 +1,57 @@ package org.xbib.io.iso23950.operations; +import org.xbib.asn1.ASN1Any; import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.BEREncoding; import org.xbib.asn1.io.BERReader; import org.xbib.asn1.io.BERWriter; -import org.xbib.io.iso23950.v3.PDU; +import org.xbib.io.iso23950.v3.Close; +import org.xbib.io.iso23950.v3.InitializeRequest; +import org.xbib.io.iso23950.v3.InitializeResponse; +import org.xbib.io.iso23950.v3.PresentRequest; +import org.xbib.io.iso23950.v3.PresentResponse; +import org.xbib.io.iso23950.v3.ScanRequest; +import org.xbib.io.iso23950.v3.ScanResponse; +import org.xbib.io.iso23950.v3.SearchRequest; +import org.xbib.io.iso23950.v3.SearchResponse; import java.io.IOException; -public class AbstractOperation { +/** + * Class for representing a PDU from Z39-50-APDU-1995. + *
+ * PDU ::=
+ * CHOICE {
+ *   initRequest [20] IMPLICIT InitializeRequest
+ *   initResponse [21] IMPLICIT InitializeResponse
+ *   searchRequest [22] IMPLICIT SearchRequest
+ *   searchResponse [23] IMPLICIT SearchResponse
+ *   presentRequest [24] IMPLICIT PresentRequest
+ *   presentResponse [25] IMPLICIT PresentResponse
+ *   deleteResultSetRequest [26] IMPLICIT DeleteResultSetRequest
+ *   deleteResultSetResponse [27] IMPLICIT DeleteResultSetResponse
+ *   accessControlRequest [28] IMPLICIT AccessControlRequest
+ *   accessControlResponse [29] IMPLICIT AccessControlResponse
+ *   resourceControlRequest [30] IMPLICIT ResourceControlRequest
+ *   resourceControlResponse [31] IMPLICIT ResourceControlResponse
+ *   triggerResourceControlRequest [32] IMPLICIT TriggerResourceControlRequest
+ *   resourceReportRequest [33] IMPLICIT ResourceReportRequest
+ *   resourceReportResponse [34] IMPLICIT ResourceReportResponse
+ *   scanRequest [35] IMPLICIT ScanRequest
+ *   scanResponse [36] IMPLICIT ScanResponse
+ *   sortRequest [43] IMPLICIT SortRequest
+ *   sortResponse [44] IMPLICIT SortResponse
+ *   segmentRequest [45] IMPLICIT Segment
+ *   extendedServicesRequest [46] IMPLICIT ExtendedServicesRequest
+ *   extendedServicesResponse [47] IMPLICIT ExtendedServicesResponse
+ *   close [48] IMPLICIT Close
+ * }
+ * 
+ * + * @param input parameter + * @param output parameter + */ +public class AbstractOperation { protected final BERReader reader; @@ -19,21 +62,21 @@ public class AbstractOperation { this.writer = writer; } - protected void writePDU(PDU pdu) throws IOException { + protected void write(OUT protocolDataUnit) throws IOException { try { - writer.write(pdu.berEncode()); + writer.write(encode(protocolDataUnit)); } catch (ASN1Exception ex) { throw new IOException(ex); } } - protected PDU readPDU() throws IOException { + protected IN read() throws IOException { try { BEREncoding ber = reader.read(); if (ber == null) { throw new IOException("read PDU error"); } - return new PDU(ber, true); + return decode(ber); } catch (ASN1Exception ex) { throw new IOException(ex); } catch (NullPointerException ex) { @@ -41,4 +84,77 @@ public class AbstractOperation { } } + private BEREncoding encode(OUT data) throws ASN1Exception { + if (data instanceof InitializeRequest) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 20); + } + if (data instanceof InitializeResponse) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 21); + } + if (data instanceof SearchRequest) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 22); + } + if (data instanceof SearchResponse) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 23); + } + if (data instanceof PresentRequest) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24); + } + if (data instanceof PresentResponse) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25); + } + if (data instanceof ScanRequest) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 35); + } + if (data instanceof ScanResponse) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 36); + } + if (data instanceof Close) { + return data.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 48); + } + throw new ASN1Exception("bad PDU to write"); + } + + @SuppressWarnings("unchecked") + private IN decode(BEREncoding ber) throws ASN1Exception { + if (ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1Exception("bad BER encoding: choice not matched"); + } + switch (ber.getTag()) { + case 20: + return (IN)new InitializeRequest(ber, false); + case 21: + return (IN)new InitializeResponse(ber, false); + case 22: + return (IN)new SearchRequest(ber, false); + case 23: + return (IN)new SearchResponse(ber, false); + case 24: + return (IN)new PresentRequest(ber, false); + case 25: + return (IN)new PresentResponse(ber, false); + // 26 new DeleteResultSetRequest(ber, false); + // 27 new DeleteResultSetResponse(ber, false); + // 28 new AccessControlRequest(ber, false); + // 29 new AccessControlResponse(ber, false); + // 30 new ResourceControlRequest(ber, false); + // 31 new ResourceControlResponse(ber, false); + // 32 new TriggerResourceControlRequest(ber, false); + // 33 new ResourceReportRequest(ber, false); + // 34 new ResourceReportResponse(ber, false); + case 35: + return (IN) new ScanRequest(ber, false); + case 36: + return (IN) new ScanResponse(ber, false); + // 43 new SortRequest(ber, false); + // 44 new SortResponse(ber, false); + // 45 new Segment(ber, false); + // 46 new ExtendedServicesRequest(ber, false); + // 47 new ExtendedServicesResponse(ber, false); + case 48: + return (IN) new Close(ber, false); + } + throw new ASN1Exception("bad BER encoding: choice not matched"); + } + } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/CloseOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/CloseOperation.java new file mode 100644 index 0000000..244d8dc --- /dev/null +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/CloseOperation.java @@ -0,0 +1,26 @@ +package org.xbib.io.iso23950.operations; + +import org.xbib.asn1.ASN1Integer; +import org.xbib.asn1.io.BERReader; +import org.xbib.asn1.io.BERWriter; +import org.xbib.io.iso23950.v3.Close; +import org.xbib.io.iso23950.v3.CloseReason; + +import java.io.IOException; + +public class CloseOperation extends AbstractOperation { + + public CloseOperation(BERReader reader, BERWriter writer) { + super(reader, writer); + } + + public void execute(int reason) throws IOException { + Close close = new Close(); + close.closeReason = new CloseReason(); + close.closeReason.value = new ASN1Integer(reason); + close.referenceId = null; + write(close); + // do not wait, it may hang + //waitClosePDU(); + } +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/InitOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/InitOperation.java index e565863..66c6863 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/operations/InitOperation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/InitOperation.java @@ -12,39 +12,42 @@ import org.xbib.io.iso23950.v3.InitializeRequest; import org.xbib.io.iso23950.v3.InitializeResponse; import org.xbib.io.iso23950.v3.InternationalString; import org.xbib.io.iso23950.v3.Options; -import org.xbib.io.iso23950.v3.PDU; import org.xbib.io.iso23950.v3.ProtocolVersion; import java.io.IOException; +import java.util.logging.Logger; /** * A Z39.50 Init operation. */ -public class InitOperation extends AbstractOperation { +public class InitOperation extends AbstractOperation { + + private static final Logger logger = Logger.getLogger(InitOperation.class.getName()); private final String user; private final String pass; + private String targetInfo; + public InitOperation(BERReader reader, BERWriter writer, String user, String pass) { super(reader, writer); this.user = user; this.pass = pass; } - public boolean execute(Integer preferredMessageSize, - InitListener initListener) throws IOException { + public boolean execute(Integer preferredMessageSize, InitListener initListener) throws IOException { InitializeRequest init = new InitializeRequest(); boolean[] version = new boolean[3]; version[0] = true; // any version, should alwasy be true version[1] = true; // Z39.50 version 2 version[2] = true; // Z39.50 version 3 - init.s_protocolVersion = new ProtocolVersion(); - init.s_protocolVersion.value = new ASN1BitString(version); + init.protocolVersion = new ProtocolVersion(); + init.protocolVersion.value = new ASN1BitString(version); boolean[] options = new boolean[15]; options[0] = true; // search options[1] = true; // present - options[2] = true; // delete set + options[2] = false; // delete set options[3] = false; // resource-report options[4] = false; // trigger resource control options[5] = false; // resource control @@ -57,48 +60,44 @@ public class InitOperation extends AbstractOperation { options[12] = false; // level 2 segmentation options[13] = false; // concurrent operations options[14] = true; // named result sets - init.s_options = new Options(); - init.s_options.value = new ASN1BitString(options); - init.s_preferredMessageSize = new ASN1Integer(preferredMessageSize); - init.s_exceptionalRecordSize = new ASN1Integer(preferredMessageSize * 2); - init.s_implementationId = new InternationalString(); - init.s_implementationId.value = new ASN1GeneralString("1"); - init.s_implementationName = new InternationalString(); - init.s_implementationName.value = new ASN1GeneralString("Java ZClient"); - init.s_implementationVersion = new InternationalString(); - init.s_implementationVersion.value = new ASN1GeneralString("1.00"); + init.options = new Options(); + init.options.value = new ASN1BitString(options); + init.preferredMessageSize = new ASN1Integer(preferredMessageSize); + init.exceptionalRecordSize = new ASN1Integer(preferredMessageSize * 2); + init.implementationId = new InternationalString(); + init.implementationId.value = new ASN1GeneralString("1"); + init.implementationName = new InternationalString(); + init.implementationName.value = new ASN1GeneralString("Java ZClient"); + init.implementationVersion = new InternationalString(); + init.implementationVersion.value = new ASN1GeneralString("1.00"); if (user != null) { - init.s_idAuthentication = new IdAuthentication(); - init.s_idAuthentication.c_idPass = new IdAuthenticationIdPass(); - init.s_idAuthentication.c_idPass.s_userId = new InternationalString(); - init.s_idAuthentication.c_idPass.s_userId.value = new ASN1GeneralString(user); + init.idAuthentication = new IdAuthentication(); + init.idAuthentication.idPass = new IdAuthenticationIdPass(); + init.idAuthentication.idPass.s_userId = new InternationalString(); + init.idAuthentication.idPass.s_userId.value = new ASN1GeneralString(user); if (pass != null) { - init.s_idAuthentication.c_idPass.s_password = new InternationalString(); - init.s_idAuthentication.c_idPass.s_password.value = new ASN1GeneralString(pass); + init.idAuthentication.idPass.s_password = new InternationalString(); + init.idAuthentication.idPass.s_password.value = new ASN1GeneralString(pass); } /*if (group != null) { init.s_idAuthentication.c_idPass.s_groupId = new InternationalString(); init.s_idAuthentication.c_idPass.s_groupId.value = new ASN1GeneralString(group); }*/ } - PDU pduOut = new PDU(); - pduOut.c_initRequest = init; - writePDU(pduOut); - PDU pduIn = readPDU(); - InitializeResponse initResp = pduIn.c_initResponse; - String targetInfo; - if (initResp.s_implementationName != null) { - targetInfo = initResp.s_implementationName.toString(); - if (initResp.s_implementationVersion != null) { - targetInfo += " - " + initResp.s_implementationVersion.toString(); + write(init); + InitializeResponse initResp = read(); + if (initResp.implementationName != null) { + targetInfo = initResp.implementationName.toString(); + if (initResp.implementationVersion != null) { + targetInfo += " - " + initResp.implementationVersion.toString(); } } else { targetInfo = "server"; } int targetVersion = 0; - if (initResp.s_protocolVersion != null) { - for (int n = 0; n < initResp.s_protocolVersion.value.get().length; n++) { - if (initResp.s_protocolVersion.value.get()[n]) { + if (initResp.protocolVersion != null) { + for (int n = 0; n < initResp.protocolVersion.value.get().length; n++) { + if (initResp.protocolVersion.value.get()[n]) { targetVersion = n + 1; } } @@ -108,18 +107,20 @@ public class InitOperation extends AbstractOperation { } else { targetInfo += " (Version unknown)"; } - if (initResp.s_userInformationField != null) { - if (initResp.s_userInformationField.getSingleASN1Type() != null) { - targetInfo += "\n" + initResp.s_userInformationField.getSingleASN1Type().toString(); - } + if (initResp.userInformationField != null && initResp.userInformationField.getSingleASN1Type() != null) { + targetInfo += "\n" + initResp.userInformationField.getSingleASN1Type().toString(); } - if (initResp.s_otherInfo != null) { - targetInfo += "\n" + initResp.s_otherInfo.toString(); + if (initResp.otherInfo != null) { + targetInfo += "\n" + initResp.otherInfo.toString(); } targetInfo = targetInfo.replaceAll("\"", ""); if (initListener != null) { initListener.onInit(targetVersion, targetInfo); } - return !initResp.s_result.get(); + return !initResp.result.get(); + } + + public String getTargetInfo() { + return targetInfo; } } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/PresentOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/PresentOperation.java index f469191..c7c0252 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/operations/PresentOperation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/PresentOperation.java @@ -7,19 +7,20 @@ import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.ASN1ObjectIdentifier; import org.xbib.asn1.io.BERReader; import org.xbib.asn1.io.BERWriter; +import org.xbib.io.iso23950.Diagnostics; import org.xbib.io.iso23950.ErrorRecord; import org.xbib.io.iso23950.Record; import org.xbib.io.iso23950.RecordListener; -import org.xbib.io.iso23950.ResponseListener; +import org.xbib.io.iso23950.SearchListener; import org.xbib.io.iso23950.exceptions.MessageSizeTooSmallException; import org.xbib.io.iso23950.exceptions.NoRecordsReturnedException; import org.xbib.io.iso23950.exceptions.RequestTerminatedByAccessControlException; import org.xbib.io.iso23950.exceptions.RequestTerminatedException; import org.xbib.io.iso23950.exceptions.ZException; +import org.xbib.io.iso23950.v3.DefaultDiagFormat; import org.xbib.io.iso23950.v3.ElementSetNames; import org.xbib.io.iso23950.v3.InternationalString; import org.xbib.io.iso23950.v3.NamePlusRecord; -import org.xbib.io.iso23950.v3.PDU; import org.xbib.io.iso23950.v3.PresentRequest; import org.xbib.io.iso23950.v3.PresentRequestRecordComposition; import org.xbib.io.iso23950.v3.PresentResponse; @@ -27,11 +28,16 @@ import org.xbib.io.iso23950.v3.PresentStatus; import org.xbib.io.iso23950.v3.ResultSetId; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Present operation for Z39.50. */ -public class PresentOperation extends AbstractOperation { +public class PresentOperation extends AbstractOperation { + + private static final Logger logger = Logger.getLogger(PresentOperation.class.getName()); private final String resultSetName; @@ -50,49 +56,55 @@ public class PresentOperation extends AbstractOperation { } public void execute(int offset, int length, int total, - ResponseListener responseListener, RecordListener recordListener) throws IOException { - PresentRequest pr = new PresentRequest(); - pr.s_resultSetId = new ResultSetId(); - pr.s_resultSetId.value = new InternationalString(); - pr.s_resultSetId.value.value = new ASN1GeneralString(resultSetName); - pr.s_resultSetStartPoint = new ASN1Integer(offset); - pr.s_numberOfRecordsRequested = new ASN1Integer(length); - pr.s_recordComposition = new PresentRequestRecordComposition(); - pr.s_recordComposition.c_simple = new ElementSetNames(); - pr.s_recordComposition.c_simple.cGenericElementSetName = new InternationalString(); - pr.s_recordComposition.c_simple.cGenericElementSetName.value = new ASN1GeneralString(elementSetName); - pr.s_preferredRecordSyntax = new ASN1ObjectIdentifier(makeOID(preferredRecordSyntax)); - PDU pdu = new PDU(); - pdu.c_presentRequest = pr; + SearchListener searchListener, RecordListener recordListener) throws IOException { + PresentRequest presentRequest = new PresentRequest(); + presentRequest.resultSetId = new ResultSetId(); + presentRequest.resultSetId.value = new InternationalString(); + presentRequest.resultSetId.value.value = new ASN1GeneralString(resultSetName); + presentRequest.resultSetStartPoint = new ASN1Integer(offset); + presentRequest.numberOfRecordsRequested = new ASN1Integer(length); + presentRequest.recordComposition = new PresentRequestRecordComposition(); + presentRequest.recordComposition.simple = new ElementSetNames(); + presentRequest.recordComposition.simple.cGenericElementSetName = new InternationalString(); + presentRequest.recordComposition.simple.cGenericElementSetName.value = new ASN1GeneralString(elementSetName); + presentRequest.preferredRecordSyntax = new ASN1ObjectIdentifier(makeOID(preferredRecordSyntax)); long millis = System.currentTimeMillis(); - writePDU(pdu); - pdu = readPDU(); - PresentResponse response = pdu.c_presentResponse; - int nReturned = response.s_numberOfRecordsReturned != null ? response.s_numberOfRecordsReturned.get() : 0; - int status = response.s_presentStatus.value != null ? response.s_presentStatus.value.get() : 0; - if (responseListener != null) { - responseListener.onResponse(status, total, nReturned, System.currentTimeMillis() - millis); + write(presentRequest); + PresentResponse response = read(); + int nReturned = response.numberOfRecordsReturned != null ? response.numberOfRecordsReturned.get() : 0; + int status = response.presentStatus.value != null ? response.presentStatus.value.get() : 0; + if (searchListener != null) { + searchListener.onResponse(status, total, nReturned, System.currentTimeMillis() - millis); } if (status == PresentStatus.E_success) { for (int n = 0; n < nReturned; n++) { - NamePlusRecord nr = response.s_records.c_responseRecords[n]; + NamePlusRecord nr = response.records.c_responseRecords[n]; try { - if (nr.s_record.c_retrievalRecord != null) { - ASN1External asn1External = new ASN1External(nr.s_record.c_retrievalRecord.berEncode(), true); + if (nr.record.retrievalRecord != null) { + ASN1External asn1External = new ASN1External(nr.record.retrievalRecord.berEncode(), true); Record record = new Record(offset + n, asn1External.getcOctetAligned().getBytes()); if (recordListener != null) { recordListener.onRecord(record); } - } else if (nr.s_record.c_surrogateDiagnostic != null) { - ASN1External asn1External = - new ASN1External(nr.s_record.c_surrogateDiagnostic.cDefaultFormat.berEncode(), true); - ErrorRecord record = new ErrorRecord(offset + n, asn1External.getcOctetAligned().getBytes()); - if (recordListener != null) { - recordListener.onRecord(record); + } else if (nr.record.surrogateDiagnostic != null) { + DefaultDiagFormat diagFormat = nr.record.surrogateDiagnostic.defaultFormat; + if (diagFormat != null) { + logger.log(Level.WARNING, diagFormat.toString()); + } + ASN1External asn1External = nr.record.surrogateDiagnostic.externallyDefined; + if (asn1External != null) { + ErrorRecord record = new ErrorRecord(offset + n, asn1External.getcOctetAligned().getBytes()); + if (recordListener != null) { + recordListener.onRecord(record); + } } } } catch (ASN1Exception e) { - throw new IOException("Present error: " + e.getMessage()); + logger.log(Level.WARNING, e.getMessage(), e); + if (recordListener != null) { + ErrorRecord record = new ErrorRecord(offset + n, e.getMessage().getBytes(StandardCharsets.UTF_8)); + recordListener.onRecord(record); + } } } } else { diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/ScanOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/ScanOperation.java new file mode 100644 index 0000000..d8b8b33 --- /dev/null +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/ScanOperation.java @@ -0,0 +1,75 @@ +package org.xbib.io.iso23950.operations; + +import org.xbib.asn1.ASN1GeneralString; +import org.xbib.asn1.ASN1Integer; +import org.xbib.asn1.ASN1ObjectIdentifier; +import org.xbib.asn1.io.BERReader; +import org.xbib.asn1.io.BERWriter; +import org.xbib.io.iso23950.ScanListener; +import org.xbib.io.iso23950.pqf.PQFParser; +import org.xbib.io.iso23950.pqf.PQFRPNGenerator; +import org.xbib.io.iso23950.v3.AttributeSetId; +import org.xbib.io.iso23950.v3.AttributesPlusTerm; +import org.xbib.io.iso23950.v3.DatabaseName; +import org.xbib.io.iso23950.v3.InternationalString; +import org.xbib.io.iso23950.v3.RPNQuery; +import org.xbib.io.iso23950.v3.ScanRequest; +import org.xbib.io.iso23950.v3.ScanResponse; + +import java.io.IOException; +import java.io.StringReader; +import java.util.List; + +public class ScanOperation extends AbstractOperation { + + private final List databases; + + public ScanOperation(BERReader reader, BERWriter writer, + List databases) { + super(reader, writer); + this.databases = databases; + } + + public void executePQF(int nTerms, int step, int position, String pqf, ScanListener listener) throws IOException { + execute(nTerms, step, position, createRPNQueryFromPQF(pqf).rpn.c_op.attrTerm, listener); + } + + public void execute(int nTerms, int step, int position, AttributesPlusTerm term, ScanListener listener) throws IOException { + ScanRequest scanRequest = new ScanRequest(); + scanRequest.attributeSet = new AttributeSetId(); + // Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1 + scanRequest.attributeSet.value = + new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1}); + DatabaseName[] databaseNames = new DatabaseName[databases.size()]; + for (int n = 0; n < databases.size(); n++) { + databaseNames[n] = new DatabaseName(); + databaseNames[n].value = new InternationalString(); + databaseNames[n].value.value = new ASN1GeneralString(databases.get(n)); + } + scanRequest.databaseNames = databaseNames; + scanRequest.numberOfTermsRequested = new ASN1Integer(nTerms); + scanRequest.stepSize = new ASN1Integer(step); + scanRequest.preferredPositionInResponse = new ASN1Integer(position); + scanRequest.termListAndStartPoint = term; + write(scanRequest); + ScanResponse scanResponse = read(); + if (scanResponse != null) { + if (scanResponse.scanStatus.get() == 0) { + for (int n = 0; n < scanResponse.entries.s_entries.length; n++) { + if (listener != null) { + listener.onScan(scanResponse.entries.s_entries[n].cTermInfo.berEncode()); + } + } + } + } + } + + private RPNQuery createRPNQueryFromPQF(String query) { + PQFRPNGenerator generator = new PQFRPNGenerator(); + PQFParser parser = new PQFParser(new StringReader(query)); + parser.parse(); + parser.getResult().accept(generator); + return generator.getResult(); + } + +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/operations/SearchOperation.java b/z3950/src/main/java/org/xbib/io/iso23950/operations/SearchOperation.java index 28fe693..4667364 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/operations/SearchOperation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/operations/SearchOperation.java @@ -8,10 +8,14 @@ import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.ASN1Sequence; import org.xbib.asn1.io.BERReader; import org.xbib.asn1.io.BERWriter; +import org.xbib.cql.CQLParser; +import org.xbib.io.iso23950.Diagnostics; +import org.xbib.io.iso23950.cql.CQLRPNGenerator; +import org.xbib.io.iso23950.pqf.PQFParser; +import org.xbib.io.iso23950.pqf.PQFRPNGenerator; import org.xbib.io.iso23950.v3.DatabaseName; import org.xbib.io.iso23950.v3.InternationalString; import org.xbib.io.iso23950.v3.OtherInformation1; -import org.xbib.io.iso23950.v3.PDU; import org.xbib.io.iso23950.v3.PresentStatus; import org.xbib.io.iso23950.v3.Query; import org.xbib.io.iso23950.v3.RPNQuery; @@ -19,15 +23,19 @@ import org.xbib.io.iso23950.v3.SearchRequest; import org.xbib.io.iso23950.v3.SearchResponse; import java.io.IOException; -import java.net.SocketTimeoutException; +import java.io.StringReader; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; /** * Base class for Z39.50 Search operation. */ -public class SearchOperation extends AbstractOperation { +public class SearchOperation extends AbstractOperation { + + private static final Logger logger = Logger.getLogger(SearchOperation.class.getName()); private int count = -1; @@ -52,73 +60,81 @@ public class SearchOperation extends AbstractOperation { this.results = new HashMap<>(); } + public boolean executePQF(String pqf) throws IOException { + return execute(createRPNQueryFromPQF(pqf)); + } + + public boolean executeCQL(String cql) throws IOException { + return execute(createRPNQueryFromCQL(cql)); + } + public boolean execute(RPNQuery rpn) throws IOException { try { SearchRequest search = new SearchRequest(); - search.s_query = new Query(); - search.s_query.c_type_1 = rpn; - search.s_smallSetUpperBound = new ASN1Integer(0); - search.s_largeSetLowerBound = new ASN1Integer(1); - search.s_mediumSetPresentNumber = new ASN1Integer(0); - search.s_replaceIndicator = new ASN1Boolean(true); - search.s_resultSetName = new InternationalString(); - search.s_resultSetName.value = new ASN1GeneralString(resultSetName); + search.query = new Query(); + search.query.c_type_1 = rpn; + search.smallSetUpperBound = new ASN1Integer(0); + search.largeSetLowerBound = new ASN1Integer(1); + search.mediumSetPresentNumber = new ASN1Integer(0); + search.replaceIndicator = new ASN1Boolean(true); + search.resultSetName = new InternationalString(); + search.resultSetName.value = new ASN1GeneralString(resultSetName); DatabaseName dbs[] = new DatabaseName[databases.size()]; for (int n = 0; n < databases.size(); n++) { dbs[n] = new DatabaseName(); dbs[n].value = new InternationalString(); dbs[n].value.value = new ASN1GeneralString(databases.get(n)); } - search.s_databaseNames = dbs; - PDU pduRequest = new PDU(); - pduRequest.c_searchRequest = search; - writePDU(pduRequest); - PDU pduResponse = readPDU(); - SearchResponse response = pduResponse.c_searchResponse; - count = response.s_resultCount.get(); - ASN1Boolean b = response.s_searchStatus; - status = b != null && b.get(); - if (!status) { - String message = "no message"; - if (response.s_records != null && response.s_records.c_nonSurrogateDiagnostic != null) { - try { - message = "ASN error, non-surrogate diagnostics: " + - response.s_records.c_nonSurrogateDiagnostic.berEncode(); - } catch (ASN1Exception e) { - // - } + search.databaseNames = dbs; + write(search); + SearchResponse response = read(); + if (response != null) { + if (response.resultCount != null) { + count = response.resultCount.get(); } - throw new IOException(host + ": " + message); - } - PresentStatus presentStatus = response.s_presentStatus; - if (presentStatus != null && presentStatus.value != null && presentStatus.value.get() == 5) { - throw new IOException("present status is failure"); - } - if (response.s_additionalSearchInfo != null && response.s_additionalSearchInfo.value[0] != null) { - OtherInformation1 info = response.s_additionalSearchInfo.value[0]; - ASN1Sequence targetSeq = (ASN1Sequence) info.s_information.c_externallyDefinedInfo.getSingleASN1Type(); - ASN1Any[] targets = targetSeq.get(); - DatabaseName dbName; - for (int i = 0; i < targets.length; i++) { - ASN1Sequence target = (ASN1Sequence) targets[i]; - try { - ASN1Any[] details = target.get(); - dbName = new DatabaseName(details[0].berEncode(), false); - if (!dbName.value.value.get().equalsIgnoreCase(databases.get(i))) { - String message = "database name listed in additional search info " + - "doesn't match database name in names set."; - throw new IOException(host + ": " + message); + ASN1Boolean b = response.s_searchStatus; + status = b != null && b.get(); + if (!status) { + String message = "no message"; + if (response.s_records != null && response.s_records.c_nonSurrogateDiagnostic != null) { + int code = response.s_records.c_nonSurrogateDiagnostic.condition.get(); + String addInfo = response.s_records.c_nonSurrogateDiagnostic.addinfo.v2Addinfo.get(); + throw new Diagnostics(code, addInfo); + } + throw new IOException(host + ": error, without diagnostic"); + } + PresentStatus presentStatus = response.s_presentStatus; + if (presentStatus != null && presentStatus.value != null && presentStatus.value.get() == 5) { + throw new IOException("present status is failure"); + } + if (response.s_additionalSearchInfo != null && response.s_additionalSearchInfo.value[0] != null) { + OtherInformation1 info = response.s_additionalSearchInfo.value[0]; + ASN1Sequence targetSeq = (ASN1Sequence) info.information.c_externallyDefinedInfo.getSingleASN1Type(); + ASN1Any[] targets = targetSeq.get(); + DatabaseName dbName; + for (int i = 0; i < targets.length; i++) { + ASN1Sequence target = (ASN1Sequence) targets[i]; + try { + ASN1Any[] details = target.get(); + dbName = new DatabaseName(details[0].berEncode(), false); + if (!dbName.value.value.get().equalsIgnoreCase(databases.get(i))) { + String message = "database name listed in additional search info " + + "doesn't match database name in names set."; + throw new IOException(host + ": " + message); + } + ASN1Integer res = (ASN1Integer) details[1]; + results.put(target, res.get()); + } catch (ASN1Exception ex) { + logger.log(Level.WARNING, ex.getMessage(), ex); + // non-fatal, e.g. String message = "Error in accessing additional search info."; + results.put(target, -1); } - ASN1Integer res = (ASN1Integer) details[1]; - results.put(target, res.get()); - } catch (ASN1Exception ex) { - // non-fatal String message = "Error in accessing additional search info."; - results.put(target, -1); } } } - } catch (SocketTimeoutException e) { - throw new IOException(host + ": timeout", e); + } catch (IOException e) { + // set host in IOException message + throw new IOException(host + ": " + e.getMessage(), e); } return status; } @@ -135,4 +151,19 @@ public class SearchOperation extends AbstractOperation { return results; } + private RPNQuery createRPNQueryFromCQL(String query) { + CQLRPNGenerator generator = new CQLRPNGenerator(); + CQLParser parser = new CQLParser(query); + parser.parse(); + parser.getCQLQuery().accept(generator); + return generator.getQueryResult(); + } + + private RPNQuery createRPNQueryFromPQF(String query) { + PQFRPNGenerator generator = new PQFRPNGenerator(); + PQFParser parser = new PQFParser(new StringReader(query)); + parser.parse(); + parser.getResult().accept(generator); + return generator.getResult(); + } } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/pqf/PQFRPNGenerator.java b/z3950/src/main/java/org/xbib/io/iso23950/pqf/PQFRPNGenerator.java index b4235d9..232e5bd 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/pqf/PQFRPNGenerator.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/pqf/PQFRPNGenerator.java @@ -39,11 +39,11 @@ public class PQFRPNGenerator implements Visitor { public void visit(PQF pqf) { if (!result.isEmpty()) { this.rpnQuery = new RPNQuery(); - rpnQuery.s_rpn = (RPNStructure) result.pop(); + rpnQuery.rpn = (RPNStructure) result.pop(); if (pqf.getAttrSet() == null) { // Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1 - rpnQuery.s_attributeSet = new AttributeSetId(); - rpnQuery.s_attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1}); + rpnQuery.attributeSet = new AttributeSetId(); + rpnQuery.attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1}); } } else { throw new SyntaxException("no valid PQF found"); @@ -53,17 +53,17 @@ public class PQFRPNGenerator implements Visitor { @Override public void visit(Query query) { Operand operand = new Operand(); - operand.c_attrTerm = new AttributesPlusTerm(); - operand.c_attrTerm.sTerm = new org.xbib.io.iso23950.v3.Term(); - operand.c_attrTerm.sTerm.c_general = new ASN1OctetString(query.getTerm().getValue()); + operand.attrTerm = new AttributesPlusTerm(); + operand.attrTerm.term = new org.xbib.io.iso23950.v3.Term(); + operand.attrTerm.term.c_general = new ASN1OctetString(query.getTerm().getValue()); Stack attrs = new Stack<>(); ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null; while (any != null) { attrs.push((AttributeElement) any); any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null; } - operand.c_attrTerm.sAttributes = new AttributeList(); - operand.c_attrTerm.sAttributes.value = attrs.toArray(new AttributeElement[attrs.size()]); + operand.attrTerm.attributes = new AttributeList(); + operand.attrTerm.attributes.value = attrs.toArray(new AttributeElement[attrs.size()]); RPNStructure rpn = new RPNStructure(); rpn.c_op = operand; if (attrs.size() > 0) { @@ -78,13 +78,13 @@ public class PQFRPNGenerator implements Visitor { rpn.c_rpnRpnOp = new RPNStructureRpnRpnOp(); rpn.c_rpnRpnOp.s_op = new Operator(); if ("@and".equals(op)) { - rpn.c_rpnRpnOp.s_op.c_and = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.andOp = new ASN1Null(); } if ("@or".equals(op)) { - rpn.c_rpnRpnOp.s_op.c_or = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.orOp = new ASN1Null(); } if ("@not".equals(op)) { - rpn.c_rpnRpnOp.s_op.c_and_not = new ASN1Null(); + rpn.c_rpnRpnOp.s_op.andNotOp = new ASN1Null(); } rpn.c_rpnRpnOp.s_rpn1 = (RPNStructure) result.pop(); rpn.c_rpnRpnOp.s_rpn2 = (RPNStructure) result.pop(); @@ -94,9 +94,9 @@ public class PQFRPNGenerator implements Visitor { @Override public void visit(AttrStr attrspec) { AttributeElement ae = new AttributeElement(); - ae.sAttributeType = (ASN1Integer) result.pop(); + ae.attributeType = (ASN1Integer) result.pop(); ae.attributeValue = new AttributeElementAttributeValue(); - ae.attributeValue.cNumeric = (ASN1Integer) result.pop(); + ae.attributeValue.numeric = (ASN1Integer) result.pop(); result.push(ae); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlRequestSecurityChallenge.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlRequestSecurityChallenge.java index 7a49907..690e8ea 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlRequestSecurityChallenge.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlRequestSecurityChallenge.java @@ -52,13 +52,13 @@ public final class AccessControlRequestSecurityChallenge extends ASN1Any { BERConstructed tagwrapper; cSimpleForm = null; cExternallyDefined = null; - if (ber.tagGet() == 37 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 37 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { cSimpleForm = new ASN1OctetString(ber, false); return; } - if (ber.tagGet() == 0 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 0 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponse.java index 9b23f8b..bfe2181 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponse.java @@ -92,8 +92,8 @@ public final class AccessControlResponse extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 223 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 223 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponseSecurityChallengeResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponseSecurityChallengeResponse.java index 900a6b9..023f0fe 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponseSecurityChallengeResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AccessControlResponseSecurityChallengeResponse.java @@ -54,13 +54,13 @@ public final class AccessControlResponseSecurityChallengeResponse extends ASN1An BERConstructed tagwrapper; cSimpleForm = null; cExternallyDefined = null; - if (ber.tagGet() == 38 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 38 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { cSimpleForm = new ASN1OctetString(ber, false); return; } - if (ber.tagGet() == 0 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 0 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElement.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElement.java index c839c5a..226aa0e 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElement.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElement.java @@ -23,14 +23,13 @@ public final class AttributeElement extends ASN1Any { public AttributeSetId attributeSetId; // optional - public ASN1Integer sAttributeType; + public ASN1Integer attributeType; public AttributeElementAttributeValue attributeValue; /** * Default constructor for a AttributeElement. */ - public AttributeElement() { } @@ -56,6 +55,7 @@ public final class AttributeElement extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -70,8 +70,8 @@ public final class AttributeElement extends ASN1Any { throw new ASN1Exception("AttributeElement: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { attributeSetId = new AttributeSetId(p, false); part++; } @@ -79,11 +79,11 @@ public final class AttributeElement extends ASN1Any { throw new ASN1Exception("AttributeElement: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 120 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 120 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("AttributeElement: bad tag in s_attributeType\n"); } - sAttributeType = new ASN1Integer(p, false); + attributeType = new ASN1Integer(p, false); part++; if (numParts <= part) { throw new ASN1Exception("AttributeElement: incomplete"); @@ -102,6 +102,7 @@ public final class AttributeElement extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -118,6 +119,7 @@ public final class AttributeElement extends ASN1Any { * @see org.xbib.asn1.BEREncoding#CONTEXT_SPECIFIC_TAG * @see org.xbib.asn1.BEREncoding#PRIVATE_TAG */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; if (attributeSetId != null) { @@ -128,7 +130,7 @@ public final class AttributeElement extends ASN1Any { if (attributeSetId != null) { fields[x++] = attributeSetId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); } - fields[x++] = sAttributeType.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 120); + fields[x++] = attributeType.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 120); fields[x] = attributeValue.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -137,6 +139,7 @@ public final class AttributeElement extends ASN1Any { * Returns a new String object containing a text representing * of the AttributeElement. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -149,7 +152,7 @@ public final class AttributeElement extends ASN1Any { str.append(", "); } str.append("attributeType "); - str.append(sAttributeType); + str.append(attributeType); outputted++; if (0 < outputted) { str.append(", "); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValue.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValue.java index 841eae2..f49c286 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValue.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValue.java @@ -18,9 +18,9 @@ import org.xbib.asn1.BEREncoding; */ public final class AttributeElementAttributeValue extends ASN1Any { - public ASN1Integer cNumeric; + public ASN1Integer numeric; - public AttributeElementAttributeValueComplex attributeValueComplex; + public AttributeElementAttributeValueComplex complex; /** * Default constructor for a AttributeElement_attributeValue. @@ -52,16 +52,16 @@ public final class AttributeElementAttributeValue extends ASN1Any { * @throws ASN1Exception if the BER encoding is bad. */ public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { - cNumeric = null; - attributeValueComplex = null; - if (ber.tagGet() == 121 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - cNumeric = new ASN1Integer(ber, false); + numeric = null; + complex = null; + if (ber.getTag() == 121 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + numeric = new ASN1Integer(ber, false); return; } - if (ber.tagGet() == 224 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - attributeValueComplex = new AttributeElementAttributeValueComplex(ber, false); + if (ber.getTag() == 224 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + complex = new AttributeElementAttributeValueComplex(ber, false); return; } throw new ASN1Exception("AttributeElement_attributeValue: bad BER encoding: choice not matched"); @@ -75,14 +75,14 @@ public final class AttributeElementAttributeValue extends ASN1Any { */ public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; - if (cNumeric != null) { - chosen = cNumeric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 121); + if (numeric != null) { + chosen = numeric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 121); } - if (attributeValueComplex != null) { + if (complex != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = attributeValueComplex.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 224); + chosen = complex.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 224); } if (chosen == null) { throw new ASN1Exception("CHOICE not set"); @@ -101,17 +101,17 @@ public final class AttributeElementAttributeValue extends ASN1Any { public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; - if (cNumeric != null) { + if (numeric != null) { found = true; str.append("numeric "); - str.append(cNumeric); + str.append(numeric); } - if (attributeValueComplex != null) { + if (complex != null) { if (found) { str.append(" "); } str.append("complex "); - str.append(attributeValueComplex); + str.append(complex); } str.append("}"); return str.toString(); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValueComplex.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValueComplex.java index 262b51a..d621c2b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValueComplex.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeElementAttributeValueComplex.java @@ -20,8 +20,8 @@ import org.xbib.asn1.BEREncoding; */ public final class AttributeElementAttributeValueComplex extends ASN1Any { - public StringOrNumeric[] sList; - public ASN1Integer[] sSemanticAction; // optional + public StringOrNumeric[] list; + public ASN1Integer[] semanticAction; // optional /** * Constructor for a AttributeElement_attributeValue_complex from a BER encoding. @@ -32,8 +32,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public AttributeElementAttributeValueComplex(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public AttributeElementAttributeValueComplex(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -46,6 +45,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -60,36 +60,36 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { throw new ASN1Exception("AttributeElement_attributeValue_complex: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("AttributeElement_attributeValue_complex: bad tag in s_list\n"); } try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); - sList = new StringOrNumeric[parts]; + list = new StringOrNumeric[parts]; int n; for (n = 0; n < parts; n++) { - sList[n] = new StringOrNumeric(cons.elementAt(n), true); + list[n] = new StringOrNumeric(cons.elementAt(n), true); } } catch (ClassCastException e) { throw new ASN1EncodingException("Bad BER"); } part++; - sSemanticAction = null; + semanticAction = null; if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); - sSemanticAction = new ASN1Integer[parts]; + semanticAction = new ASN1Integer[parts]; int n; for (n = 0; n < parts; n++) { - sSemanticAction[n] = new ASN1Integer(cons.elementAt(n), true); + semanticAction[n] = new ASN1Integer(cons.elementAt(n), true); } } catch (ClassCastException e) { throw new ASN1EncodingException("Bad BER"); @@ -108,6 +108,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -120,24 +121,25 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; - if (sSemanticAction != null) { + if (semanticAction != null) { numFields++; } BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; BEREncoding f2[]; int p; - f2 = new BEREncoding[sList.length]; - for (p = 0; p < sList.length; p++) { - f2[p] = sList[p].berEncode(); + f2 = new BEREncoding[list.length]; + for (p = 0; p < list.length; p++) { + f2[p] = list[p].berEncode(); } fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, f2); - if (sSemanticAction != null) { - f2 = new BEREncoding[sSemanticAction.length]; - for (p = 0; p < sSemanticAction.length; p++) { - f2[p] = sSemanticAction[p].berEncode(); + if (semanticAction != null) { + f2 = new BEREncoding[semanticAction.length]; + for (p = 0; p < semanticAction.length; p++) { + f2[p] = semanticAction[p].berEncode(); } fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 2, f2); } @@ -148,31 +150,32 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any { * Returns a new String object containing a text representing * of the AttributeElement_attributeValue_complex. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("list "); str.append("{"); - for (p = 0; p < sList.length; p++) { + for (p = 0; p < list.length; p++) { if (p != 0) { str.append(", "); } - str.append(sList[p]); + str.append(list[p]); } str.append("}"); outputted++; - if (sSemanticAction != null) { + if (semanticAction != null) { if (0 < outputted) { str.append(", "); } str.append("semanticAction "); str.append("{"); - for (p = 0; p < sSemanticAction.length; p++) { + for (p = 0; p < semanticAction.length; p++) { if (p != 0) { str.append(", "); } - str.append(sSemanticAction[p]); + str.append(semanticAction[p]); } str.append("}"); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeList.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeList.java index e7a1d77..c4fbf6a 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeList.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeList.java @@ -46,11 +46,12 @@ public final class AttributeList extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { if (checkTag) { - if (ber.tagGet() != 44 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("AttributeList: bad BER: tag=" + ber.tagGet() + " expected 44\n"); + if (ber.getTag() != 44 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("AttributeList: bad BER: tag=" + ber.getTag() + " expected 44\n"); } } BERConstructed berConstructed; @@ -73,6 +74,7 @@ public final class AttributeList extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 44); } @@ -85,6 +87,7 @@ public final class AttributeList extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { BEREncoding fields[] = new BERConstructed[value.length]; int p; @@ -98,6 +101,7 @@ public final class AttributeList extends ASN1Any { * Returns a new String object containing a text representing * of the AttributeList. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int p; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeSetId.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeSetId.java index d186ffa..ea20d03 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeSetId.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributeSetId.java @@ -45,6 +45,7 @@ public final class AttributeSetId extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { value = new ASN1ObjectIdentifier(ber, checkTag); } @@ -55,6 +56,7 @@ public final class AttributeSetId extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return value.berEncode(); } @@ -67,6 +69,7 @@ public final class AttributeSetId extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -75,6 +78,7 @@ public final class AttributeSetId extends ASN1Any { * Returns a new String object containing a text representing * of the AttributeSetId. */ + @Override public String toString() { return value.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributesPlusTerm.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributesPlusTerm.java index 8756da2..0e6f97d 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributesPlusTerm.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/AttributesPlusTerm.java @@ -18,14 +18,13 @@ import org.xbib.asn1.BEREncoding; */ public final class AttributesPlusTerm extends ASN1Any { - public AttributeList sAttributes; + public AttributeList attributes; - public Term sTerm; + public Term term; /** * Default constructor for a AttributesPlusTerm. */ - public AttributesPlusTerm() { } @@ -38,9 +37,7 @@ public final class AttributesPlusTerm extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public AttributesPlusTerm(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public AttributesPlusTerm(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -53,38 +50,37 @@ public final class AttributesPlusTerm extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { if (checkTag) { - if (ber.tagGet() != 102 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("AttributesPlusTerm: bad BER: tag=" + ber.tagGet() + " expected 102\n"); + if (ber.getTag() != 102 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 102"); } } BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("AttributesPlusTerm: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("AttributesPlusTerm: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sAttributes = new AttributeList(p, true); + attributes = new AttributeList(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("AttributesPlusTerm: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sTerm = new Term(p, true); + term = new Term(p, true); part++; if (part < numParts) { - throw new ASN1Exception("AttributesPlusTerm: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -94,6 +90,7 @@ public final class AttributesPlusTerm extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 102); } @@ -106,12 +103,13 @@ public final class AttributesPlusTerm extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; - fields[x++] = sAttributes.berEncode(); - fields[x] = sTerm.berEncode(); + fields[x++] = attributes.berEncode(); + fields[x] = term.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -119,17 +117,18 @@ public final class AttributesPlusTerm extends ASN1Any { * Returns a new String object containing a text representing * of the AttributesPlusTerm. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("attributes "); - str.append(sAttributes); + str.append(attributes); outputted++; if (0 < outputted) { str.append(", "); } str.append("term "); - str.append(sTerm); + str.append(term); str.append("}"); return str.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Close.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Close.java index cbf14b0..459402d 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Close.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Close.java @@ -25,17 +25,17 @@ import org.xbib.asn1.BEREncoding; public final class Close extends ASN1Any { - public ReferenceId sReferenceId; // optional + public ReferenceId referenceId; // optional - public CloseReason sCloseReason; + public CloseReason closeReason; - public InternationalString sDiagnosticInformation; // optional + public InternationalString diagnosticInformation; // optional - public ResourceReportId sResourceReportFormat; // optional + public ResourceReportId resourceReportFormat; // optional - public ResourceReport sResourceReport; // optional + public ResourceReport resourceReport; // optional - public OtherInformation sOtherInfo; // optional + public OtherInformation otherInformation; // optional /** * Default constructor for a Close. @@ -66,6 +66,7 @@ public final class Close extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -82,45 +83,45 @@ public final class Close extends ASN1Any { } p = berConstructed.elementAt(part); try { - sReferenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; } catch (ASN1Exception e) { - sReferenceId = null; + referenceId = null; } if (numParts <= part) { throw new ASN1Exception("Close: incomplete"); } p = berConstructed.elementAt(part); - sCloseReason = new CloseReason(p, true); + closeReason = new CloseReason(p, true); part++; - sDiagnosticInformation = null; - sResourceReportFormat = null; - sResourceReport = null; - sOtherInfo = null; + diagnosticInformation = null; + resourceReportFormat = null; + resourceReport = null; + otherInformation = null; if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - sDiagnosticInformation = new InternationalString(p, false); + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + diagnosticInformation = new InternationalString(p, false); part++; } if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 4 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - sResourceReportFormat = new ResourceReportId(p, false); + if (p.getTag() == 4 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + resourceReportFormat = new ResourceReportId(p, false); part++; } if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 5 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 5 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { @@ -129,7 +130,7 @@ public final class Close extends ASN1Any { if (tagged.numberComponents() != 1) { throw new ASN1EncodingException("Close: bad BER encoding: s_resourceReport tag bad"); } - sResourceReport = new ResourceReport(tagged.elementAt(0), true); + resourceReport = new ResourceReport(tagged.elementAt(0), true); part++; } if (numParts <= part) { @@ -137,10 +138,10 @@ public final class Close extends ASN1Any { } p = berConstructed.elementAt(part); try { - sOtherInfo = new OtherInformation(p, true); + otherInformation = new OtherInformation(p, true); part++; } catch (ASN1Exception e) { - sOtherInfo = null; + otherInformation = null; } if (part < numParts) { throw new ASN1Exception("Close: bad BER: extra data " + part + "/" + numParts + " processed"); @@ -153,6 +154,7 @@ public final class Close extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -165,43 +167,44 @@ public final class Close extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; - if (sReferenceId != null) { + if (referenceId != null) { numFields++; } - if (sDiagnosticInformation != null) { + if (diagnosticInformation != null) { numFields++; } - if (sResourceReportFormat != null) { + if (resourceReportFormat != null) { numFields++; } - if (sResourceReport != null) { + if (resourceReport != null) { numFields++; } - if (sOtherInfo != null) { + if (otherInformation != null) { numFields++; } BEREncoding[] fields = new BEREncoding[numFields]; int x = 0; BEREncoding[] enc; - if (sReferenceId != null) { - fields[x++] = sReferenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } - fields[x++] = sCloseReason.berEncode(); - if (sDiagnosticInformation != null) { - fields[x++] = sDiagnosticInformation.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3); + fields[x++] = closeReason.berEncode(); + if (diagnosticInformation != null) { + fields[x++] = diagnosticInformation.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3); } - if (sResourceReportFormat != null) { - fields[x++] = sResourceReportFormat.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4); + if (resourceReportFormat != null) { + fields[x++] = resourceReportFormat.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4); } - if (sResourceReport != null) { + if (resourceReport != null) { enc = new BEREncoding[1]; - enc[0] = sResourceReport.berEncode(); + enc[0] = resourceReport.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc); } - if (sOtherInfo != null) { - fields[x] = sOtherInfo.berEncode(); + if (otherInformation != null) { + fields[x] = otherInformation.berEncode(); } return new BERConstructed(tagType, tag, fields); } @@ -210,50 +213,51 @@ public final class Close extends ASN1Any { * Returns a new String object containing a text representing * of the Close. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (sReferenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(sReferenceId); + str.append(referenceId); outputted++; } if (0 < outputted) { str.append(", "); } str.append("closeReason "); - str.append(sCloseReason); + str.append(closeReason); outputted++; - if (sDiagnosticInformation != null) { + if (diagnosticInformation != null) { if (0 < outputted) { str.append(", "); } str.append("diagnosticInformation "); - str.append(sDiagnosticInformation); + str.append(diagnosticInformation); outputted++; } - if (sResourceReportFormat != null) { + if (resourceReportFormat != null) { if (0 < outputted) { str.append(", "); } str.append("resourceReportFormat "); - str.append(sResourceReportFormat); + str.append(resourceReportFormat); outputted++; } - if (sResourceReport != null) { + if (resourceReport != null) { if (0 < outputted) { str.append(", "); } str.append("resourceReport "); - str.append(sResourceReport); + str.append(resourceReport); outputted++; } - if (sOtherInfo != null) { + if (otherInformation != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(sOtherInfo); + str.append(otherInformation); } str.append("}"); return str.toString(); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/CloseReason.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/CloseReason.java index c688943..c945394 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/CloseReason.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/CloseReason.java @@ -55,11 +55,12 @@ public final class CloseReason extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { if (checkTag) { - if (ber.tagGet() != 211 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("CloseReason: bad BER: tag=" + ber.tagGet() + " expected 211"); + if (ber.getTag() != 211 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("CloseReason: bad BER: tag=" + ber.getTag() + " expected 211"); } } value = new ASN1Integer(ber, false); @@ -71,6 +72,7 @@ public final class CloseReason extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 211); } @@ -83,6 +85,7 @@ public final class CloseReason extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -91,6 +94,7 @@ public final class CloseReason extends ASN1Any { * Returns a new String object containing a text representing * of the CloseReason. */ + @Override public String toString() { return value.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpec.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpec.java index 25f8722..2941d4c 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpec.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpec.java @@ -23,18 +23,14 @@ import org.xbib.asn1.BEREncoding; */ public final class CompSpec extends ASN1Any { - public ASN1Boolean sSelectAlternativeSyntax; - + public ASN1Boolean selectAlternativeSyntax; public Specification sGeneric; // optional - public CompSpecDbSpecific[] dbSpecifics; // optional - - public ASN1ObjectIdentifier[] objectIdentifiers; // optional + public ASN1ObjectIdentifier[] recordSyntax; // optional /** * Default constructor for a CompSpec. */ - public CompSpec() { } @@ -60,6 +56,7 @@ public final class CompSpec extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -74,21 +71,21 @@ public final class CompSpec extends ASN1Any { throw new ASN1Exception("CompSpec: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("CompSpec: bad tag in s_selectAlternativeSyntax\n"); } - sSelectAlternativeSyntax = new ASN1Boolean(p, false); + selectAlternativeSyntax = new ASN1Boolean(p, false); part++; sGeneric = null; dbSpecifics = null; - objectIdentifiers = null; + recordSyntax = null; if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sGeneric = new Specification(p, false); part++; } @@ -96,8 +93,8 @@ public final class CompSpec extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); @@ -115,15 +112,15 @@ public final class CompSpec extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 4 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 4 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); - objectIdentifiers = new ASN1ObjectIdentifier[parts]; + recordSyntax = new ASN1ObjectIdentifier[parts]; int n; for (n = 0; n < parts; n++) { - objectIdentifiers[n] = new ASN1ObjectIdentifier(cons.elementAt(n), true); + recordSyntax[n] = new ASN1ObjectIdentifier(cons.elementAt(n), true); } } catch (ClassCastException e) { throw new ASN1EncodingException("Bad BER"); @@ -141,6 +138,7 @@ public final class CompSpec extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -153,6 +151,7 @@ public final class CompSpec extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; if (sGeneric != null) { @@ -161,14 +160,14 @@ public final class CompSpec extends ASN1Any { if (dbSpecifics != null) { numFields++; } - if (objectIdentifiers != null) { + if (recordSyntax != null) { numFields++; } BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; BEREncoding f2[]; int p; - fields[x++] = sSelectAlternativeSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); + fields[x++] = selectAlternativeSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); if (sGeneric != null) { fields[x++] = sGeneric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2); } @@ -179,10 +178,10 @@ public final class CompSpec extends ASN1Any { } fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, f2); } - if (objectIdentifiers != null) { - f2 = new BEREncoding[objectIdentifiers.length]; - for (p = 0; p < objectIdentifiers.length; p++) { - f2[p] = objectIdentifiers[p].berEncode(); + if (recordSyntax != null) { + f2 = new BEREncoding[recordSyntax.length]; + for (p = 0; p < recordSyntax.length; p++) { + f2[p] = recordSyntax[p].berEncode(); } fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 4, f2); } @@ -193,12 +192,13 @@ public final class CompSpec extends ASN1Any { * Returns a new String object containing a text representing * of the CompSpec. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("selectAlternativeSyntax "); - str.append(sSelectAlternativeSyntax); + str.append(selectAlternativeSyntax); outputted++; if (sGeneric != null) { if (0 < outputted) { @@ -223,17 +223,17 @@ public final class CompSpec extends ASN1Any { str.append("}"); outputted++; } - if (objectIdentifiers != null) { + if (recordSyntax != null) { if (0 < outputted) { str.append(", "); } str.append("recordSyntax "); str.append("{"); - for (p = 0; p < objectIdentifiers.length; p++) { + for (p = 0; p < recordSyntax.length; p++) { if (p != 0) { str.append(", "); } - str.append(objectIdentifiers[p]); + str.append(recordSyntax[p]); } str.append("}"); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpecDbSpecific.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpecDbSpecific.java index 3856034..be50d93 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpecDbSpecific.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/CompSpecDbSpecific.java @@ -45,6 +45,7 @@ public final class CompSpecDbSpecific extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -60,8 +61,8 @@ public final class CompSpecDbSpecific extends ASN1Any { throw new ASN1Exception("CompSpec_dbSpecific: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("CompSpec_dbSpecific: bad tag in s_db\n"); } @@ -81,8 +82,8 @@ public final class CompSpecDbSpecific extends ASN1Any { throw new ASN1Exception("CompSpec_dbSpecific: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("CompSpec_dbSpecific: bad tag in s_spec\n"); } @@ -99,6 +100,7 @@ public final class CompSpecDbSpecific extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -111,6 +113,7 @@ public final class CompSpecDbSpecific extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; BEREncoding fields[] = new BEREncoding[numFields]; @@ -127,6 +130,7 @@ public final class CompSpecDbSpecific extends ASN1Any { * Returns a new String object containing a text representing * of the CompSpec_dbSpecific. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DatabaseName.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DatabaseName.java index e7439f9..97f5cdd 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DatabaseName.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DatabaseName.java @@ -45,16 +45,15 @@ public final class DatabaseName extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Check tag matches - if (checkTag) { - if (ber.tagGet() != 105 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("DatabaseName: bad BER: tag=" + ber.tagGet() + " expected 105\n"); + if (ber.getTag() != 105 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("DatabaseName: bad BER: tag=" + ber.getTag() + " expected 105\n"); } } - value = new InternationalString(ber, false); } @@ -64,6 +63,7 @@ public final class DatabaseName extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 105); } @@ -76,6 +76,7 @@ public final class DatabaseName extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -84,7 +85,7 @@ public final class DatabaseName extends ASN1Any { * Returns a new String object containing a text representing * of the DatabaseName. */ - + @Override public String toString() { return value.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormat.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormat.java index c8c0817..8917ccd 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormat.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormat.java @@ -22,9 +22,9 @@ import org.xbib.asn1.BEREncoding; */ public final class DefaultDiagFormat extends ASN1Any { - public ASN1ObjectIdentifier sDiagnosticSetId; - public ASN1Integer sCondition; - public DefaultDiagFormatAddinfo sAddinfo; + public ASN1ObjectIdentifier diagnosticSetId; + public ASN1Integer condition; + public DefaultDiagFormatAddinfo addinfo; /** * Constructor for a DefaultDiagFormat from a BER encoding. @@ -35,7 +35,6 @@ public final class DefaultDiagFormat extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public DefaultDiagFormat(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -49,36 +48,37 @@ public final class DefaultDiagFormat extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("DefaultDiagFormat: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("DefaultDiagFormat: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sDiagnosticSetId = new ASN1ObjectIdentifier(p, true); + diagnosticSetId = new ASN1ObjectIdentifier(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("DefaultDiagFormat: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sCondition = new ASN1Integer(p, true); + condition = new ASN1Integer(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("DefaultDiagFormat: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sAddinfo = new DefaultDiagFormatAddinfo(p, true); + addinfo = new DefaultDiagFormatAddinfo(p, true); part++; if (part < numParts) { - throw new ASN1Exception("DefaultDiagFormat: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -88,6 +88,7 @@ public final class DefaultDiagFormat extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -100,13 +101,14 @@ public final class DefaultDiagFormat extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 3; // number of mandatories BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; - fields[x++] = sDiagnosticSetId.berEncode(); - fields[x++] = sCondition.berEncode(); - fields[x] = sAddinfo.berEncode(); + fields[x++] = diagnosticSetId.berEncode(); + fields[x++] = condition.berEncode(); + fields[x] = addinfo.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -114,23 +116,24 @@ public final class DefaultDiagFormat extends ASN1Any { * Returns a new String object containing a text representing * of the DefaultDiagFormat. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("diagnosticSetId "); - str.append(sDiagnosticSetId); + str.append(diagnosticSetId); outputted++; if (0 < outputted) { str.append(", "); } str.append("condition "); - str.append(sCondition); + str.append(condition); outputted++; if (0 < outputted) { str.append(", "); } str.append("addinfo "); - str.append(sAddinfo); + str.append(addinfo); str.append("}"); return str.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormatAddinfo.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormatAddinfo.java index 8a4699b..b377449 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormatAddinfo.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DefaultDiagFormatAddinfo.java @@ -18,8 +18,8 @@ import org.xbib.asn1.BEREncoding; */ public final class DefaultDiagFormatAddinfo extends ASN1Any { - public ASN1VisibleString cV2Addinfo; - public InternationalString cV3Addinfo; + public ASN1VisibleString v2Addinfo; + public InternationalString v3Addinfo; /** * Constructor for a DefaultDiagFormat_addinfo from a BER encoding. @@ -43,22 +43,23 @@ public final class DefaultDiagFormatAddinfo extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { - cV2Addinfo = null; - cV3Addinfo = null; + v2Addinfo = null; + v3Addinfo = null; try { - cV2Addinfo = new ASN1VisibleString(ber, checkTag); + v2Addinfo = new ASN1VisibleString(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on } try { - cV3Addinfo = new InternationalString(ber, checkTag); + v3Addinfo = new InternationalString(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on } - throw new ASN1Exception("DefaultDiagFormat_addinfo: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -67,16 +68,17 @@ public final class DefaultDiagFormatAddinfo extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; - if (cV2Addinfo != null) { - chosen = cV2Addinfo.berEncode(); + if (v2Addinfo != null) { + chosen = v2Addinfo.berEncode(); } - if (cV3Addinfo != null) { + if (v3Addinfo != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = cV3Addinfo.berEncode(); + chosen = v3Addinfo.berEncode(); } if (chosen == null) { throw new ASN1Exception("CHOICE not set"); @@ -84,28 +86,30 @@ public final class DefaultDiagFormatAddinfo extends ASN1Any { return chosen; } + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { - throw new ASN1EncodingException("DefaultDiagFormat_addinfo: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the DefaultDiagFormat_addinfo. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; - if (cV2Addinfo != null) { + if (v2Addinfo != null) { found = true; str.append("v2Addinfo "); - str.append(cV2Addinfo); + str.append(v2Addinfo); } - if (cV3Addinfo != null) { + if (v3Addinfo != null) { if (found) { str.append(" "); } str.append("v3Addinfo "); - str.append(cV3Addinfo); + str.append(v3Addinfo); } str.append("}"); return str.toString(); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetRequest.java index eebb84c..d229d24 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetRequest.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetRequest.java @@ -53,18 +53,19 @@ public final class DeleteResultSetRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("DeleteResultSetRequest: bad BER form"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("DeleteResultSetRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { @@ -74,12 +75,12 @@ public final class DeleteResultSetRequest extends ASN1Any { referenceId = null; } if (numParts <= part) { - throw new ASN1Exception("DeleteResultSetRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 32 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("DeleteResultSetRequest: bad tag in s_deleteFunction"); + if (p.getTag() != 32 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_deleteFunction"); } sDeleteFunction = new ASN1Integer(p, false); part++; @@ -99,7 +100,7 @@ public final class DeleteResultSetRequest extends ASN1Any { sResultSetList[n] = new ResultSetId(cons.elementAt(n), true); } } catch (ClassCastException e) { - throw new ASN1EncodingException("Bad BER"); + throw new ASN1EncodingException("bad BER"); } part++; } catch (ASN1Exception e) { @@ -116,7 +117,7 @@ public final class DeleteResultSetRequest extends ASN1Any { sOtherInfo = null; // no, not present } if (part < numParts) { - throw new ASN1Exception("DeleteResultSetRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -126,6 +127,7 @@ public final class DeleteResultSetRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -138,6 +140,7 @@ public final class DeleteResultSetRequest extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; if (referenceId != null) { @@ -174,6 +177,7 @@ public final class DeleteResultSetRequest extends ASN1Any { * Returns a new String object containing a text representing * of the DeleteResultSetRequest. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); @@ -214,5 +218,4 @@ public final class DeleteResultSetRequest extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetResponse.java index 65fe995..143e1f5 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteResultSetResponse.java @@ -56,6 +56,7 @@ public final class DeleteResultSetResponse extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -81,8 +82,8 @@ public final class DeleteResultSetResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 0 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 0 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("DeleteResultSetResponse: bad tag in s_deleteOperationStatus\n"); } sDeleteOperationStatus = new DeleteSetStatus(p, false); @@ -96,8 +97,8 @@ public final class DeleteResultSetResponse extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sDeleteListStatuses = new ListStatuses(p, false); part++; } @@ -105,8 +106,8 @@ public final class DeleteResultSetResponse extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 34 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 34 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sNumberNotDeleted = new ASN1Integer(p, false); part++; } @@ -114,8 +115,8 @@ public final class DeleteResultSetResponse extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 35 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 35 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sBulkStatuses = new ListStatuses(p, false); part++; } @@ -123,8 +124,8 @@ public final class DeleteResultSetResponse extends ASN1Any { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 36 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 36 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sDeleteMessage = new InternationalString(p, false); part++; } @@ -149,6 +150,7 @@ public final class DeleteResultSetResponse extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -161,6 +163,7 @@ public final class DeleteResultSetResponse extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; if (sReferenceId != null) { @@ -209,6 +212,7 @@ public final class DeleteResultSetResponse extends ASN1Any { * Returns a new String object containing a text representing * of the DeleteResultSetResponse. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteSetStatus.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteSetStatus.java index 821ba31..a522c4d 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteSetStatus.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DeleteSetStatus.java @@ -28,6 +28,7 @@ public final class DeleteSetStatus extends ASN1Any { public static final int E_NOT_ALL_REQUESTED_RESULT_SETS_DELETED = 9; public static final int E_RESULT_SET_IN_USE = 10; public ASN1Integer value; + /** * Constructor for a DeleteSetStatus from a BER encoding. * @@ -37,7 +38,6 @@ public final class DeleteSetStatus extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public DeleteSetStatus(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -51,11 +51,12 @@ public final class DeleteSetStatus extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { if (checkTag) { - if (ber.tagGet() != 33 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("DeleteSetStatus: bad BER: tag=" + ber.tagGet() + " expected 33\n"); + if (ber.getTag() != 33 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 33"); } } value = new ASN1Integer(ber, false); @@ -67,7 +68,7 @@ public final class DeleteSetStatus extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 33); } @@ -80,6 +81,7 @@ public final class DeleteSetStatus extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -88,10 +90,8 @@ public final class DeleteSetStatus extends ASN1Any { * Returns a new String object containing a text representing * of the DeleteSetStatus. */ - - public String - toString() { + @Override + public String toString() { return value.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/DiagRec.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/DiagRec.java index 907ef38..f37d950 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/DiagRec.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/DiagRec.java @@ -19,8 +19,8 @@ import org.xbib.asn1.BEREncoding; public final class DiagRec extends ASN1Any { - public DefaultDiagFormat cDefaultFormat; - public ASN1External cExternallyDefined; + public DefaultDiagFormat defaultFormat; + public ASN1External externallyDefined; /** * Constructor for a DiagRec from a BER encoding. @@ -44,22 +44,23 @@ public final class DiagRec extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { - cDefaultFormat = null; - cExternallyDefined = null; + defaultFormat = null; + externallyDefined = null; try { - cDefaultFormat = new DefaultDiagFormat(ber, checkTag); + defaultFormat = new DefaultDiagFormat(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on } try { - cExternallyDefined = new ASN1External(ber, checkTag); + externallyDefined = new ASN1External(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on } - throw new ASN1Exception("DiagRec: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -68,16 +69,17 @@ public final class DiagRec extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; - if (cDefaultFormat != null) { - chosen = cDefaultFormat.berEncode(); + if (defaultFormat != null) { + chosen = defaultFormat.berEncode(); } - if (cExternallyDefined != null) { + if (externallyDefined != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = cExternallyDefined.berEncode(); + chosen = externallyDefined.berEncode(); } if (chosen == null) { throw new ASN1Exception("CHOICE not set"); @@ -85,28 +87,30 @@ public final class DiagRec extends ASN1Any { return chosen; } + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { - throw new ASN1EncodingException("DiagRec: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the DiagRec. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; - if (cDefaultFormat != null) { + if (defaultFormat != null) { found = true; str.append("defaultFormat "); - str.append(cDefaultFormat); + str.append(defaultFormat); } - if (cExternallyDefined != null) { + if (externallyDefined != null) { if (found) { str.append(" "); } str.append("externallyDefined "); - str.append(cExternallyDefined); + str.append(externallyDefined); } str.append("}"); return str.toString(); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetName.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetName.java index 4eebab1..c870644 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetName.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetName.java @@ -25,9 +25,7 @@ public final class ElementSetName extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public ElementSetName(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public ElementSetName(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -40,16 +38,15 @@ public final class ElementSetName extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Check tag matches - if (checkTag) { - if (ber.tagGet() != 103 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ElementSetName: bad BER: tag=" + ber.tagGet() + " expected 103\n"); + if (ber.getTag() != 103 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 103"); } } - value = new InternationalString(ber, false); } @@ -59,6 +56,7 @@ public final class ElementSetName extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 103); } @@ -71,6 +69,7 @@ public final class ElementSetName extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -79,9 +78,8 @@ public final class ElementSetName extends ASN1Any { * Returns a new String object containing a text representing * of the ElementSetName. */ - + @Override public String toString() { return value.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNames.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNames.java index c63b076..d465140 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNames.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNames.java @@ -19,12 +19,12 @@ import org.xbib.asn1.BEREncoding; public final class ElementSetNames extends ASN1Any { public InternationalString cGenericElementSetName; + public ElementSetNamesDatabaseSpecific[] cDatabaseSpecific; /** * Default constructor for a ElementSetNames. */ - public ElementSetNames() { } @@ -37,7 +37,6 @@ public final class ElementSetNames extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ElementSetNames(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -51,23 +50,24 @@ public final class ElementSetNames extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { cGenericElementSetName = null; cDatabaseSpecific = null; - if (ber.tagGet() == 0 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 0 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { cGenericElementSetName = new InternationalString(ber, false); return; } - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { BEREncoding berData; berData = ber; BERConstructed berConstructed; try { berConstructed = (BERConstructed) berData; } catch (ClassCastException e) { - throw new ASN1EncodingException("ElementSetNames: bad BER form"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int p; @@ -77,7 +77,7 @@ public final class ElementSetNames extends ASN1Any { } return; } - throw new ASN1Exception("ElementSetNames: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -86,6 +86,7 @@ public final class ElementSetNames extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; BEREncoding[] f2; @@ -109,14 +110,16 @@ public final class ElementSetNames extends ASN1Any { return chosen; } + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { - throw new ASN1EncodingException("ElementSetNames: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the ElementSetNames. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNamesDatabaseSpecific.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNamesDatabaseSpecific.java index 33d8c31..081e46b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNamesDatabaseSpecific.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ElementSetNamesDatabaseSpecific.java @@ -20,13 +20,12 @@ import org.xbib.asn1.BEREncoding; public final class ElementSetNamesDatabaseSpecific extends ASN1Any { - public DatabaseName sDbName; + public DatabaseName dbName; public ElementSetName elementSetName; /** * Default constructor for a ElementSetNames_databaseSpecific. */ - public ElementSetNamesDatabaseSpecific() { } @@ -39,7 +38,6 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ElementSetNamesDatabaseSpecific(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -53,32 +51,31 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("ElementSetNames_databaseSpecific: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("ElementSetNames_databaseSpecific: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - sDbName = new DatabaseName(p, true); + dbName = new DatabaseName(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("ElementSetNames_databaseSpecific: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); elementSetName = new ElementSetName(p, true); part++; if (part < numParts) { - throw new ASN1Exception("ElementSetNames_databaseSpecific: bad BER: extra data " + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -89,6 +86,7 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -101,11 +99,12 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; - fields[x++] = sDbName.berEncode(); + fields[x++] = dbName.berEncode(); fields[x] = elementSetName.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -114,11 +113,12 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any { * Returns a new String object containing a text representing * of the ElementSetNames_databaseSpecific. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("dbName "); - str.append(sDbName); + str.append(dbName); outputted++; if (0 < outputted) { str.append(", "); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Entry.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Entry.java index 9150931..f19d6b1 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Entry.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Entry.java @@ -30,9 +30,7 @@ public final class Entry extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Entry(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Entry(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -45,31 +43,30 @@ public final class Entry extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed tagwrapper; cTermInfo = null; cSurrogateDiagnostic = null; - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { cTermInfo = new TermInfo(ber, false); return; } - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("Entry: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("Entry: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } cSurrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true); return; } - throw new ASN1Exception("Entry: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -78,6 +75,7 @@ public final class Entry extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; BEREncoding[] enc; @@ -98,14 +96,16 @@ public final class Entry extends ASN1Any { return chosen; } + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { - throw new ASN1EncodingException("Entry: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the Entry. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesRequest.java index 55d742b..bbad350 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesRequest.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesRequest.java @@ -62,7 +62,6 @@ public final class ExtendedServicesRequest extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ExtendedServicesRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -76,19 +75,19 @@ public final class ExtendedServicesRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("ExtendedServicesRequest: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { @@ -99,88 +98,86 @@ public final class ExtendedServicesRequest extends ASN1Any { } if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 3 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("ExtendedServicesRequest: bad tag in s_function\n"); + if (p.getTag() != 3 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_function"); } sFunction = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 4 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("ExtendedServicesRequest: bad tag in s_packageType\n"); + if (p.getTag() != 4 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_packageType"); } sPackageType = new ASN1ObjectIdentifier(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 5 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 5 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sPackageName = new InternationalString(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 6 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 6 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sUserId = new InternationalString(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 7 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 7 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sRetentionTime = new IntUnit(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 8 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 8 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sPermissions = new Permissions(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 9 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 9 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sDescription = new InternationalString(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 10 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 10 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sTaskSpecificParameters = new ASN1External(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 11 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ExtendedServicesRequest: bad tag in s_waitAction\n"); + if (p.getTag() != 11 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in waitAction"); } sWaitAction = new ASN1Integer(p, false); part++; @@ -207,7 +204,7 @@ public final class ExtendedServicesRequest extends ASN1Any { sOtherInfo = null; // no, not present } if (part < numParts) { - throw new ASN1Exception("ExtendedServicesRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -217,6 +214,7 @@ public final class ExtendedServicesRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -229,6 +227,7 @@ public final class ExtendedServicesRequest extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 3; if (sReferenceId != null) { @@ -297,6 +296,7 @@ public final class ExtendedServicesRequest extends ASN1Any { * Returns a new String object containing a text representing * of the ExtendedServicesRequest. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesResponse.java index 7c34ffb..7e26fea 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ExtendedServicesResponse.java @@ -42,7 +42,6 @@ public final class ExtendedServicesResponse extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ExtendedServicesResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -57,19 +56,20 @@ public final class ExtendedServicesResponse extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("ExtendedServicesResponse: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ExtendedServicesResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { @@ -79,12 +79,12 @@ public final class ExtendedServicesResponse extends ASN1Any { sReferenceId = null; // no, not present } if (numParts <= part) { - throw new ASN1Exception("ExtendedServicesResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 3 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ExtendedServicesResponse: bad tag in s_operationStatus\n"); + if (p.getTag() != 3 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in operationStatus"); } sOperationStatus = new ASN1Integer(p, false); part++; @@ -95,8 +95,8 @@ public final class ExtendedServicesResponse extends ASN1Any { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - if (p.tagGet() == 4 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 4 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); @@ -114,8 +114,8 @@ public final class ExtendedServicesResponse extends ASN1Any { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - if (p.tagGet() == 5 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 5 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { sTaskPackage = new ASN1External(p, false); part++; } @@ -130,7 +130,7 @@ public final class ExtendedServicesResponse extends ASN1Any { sOtherInfo = null; // no, not present } if (part < numParts) { - throw new ASN1Exception("ExtendedServicesResponse: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -140,6 +140,7 @@ public final class ExtendedServicesResponse extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -152,6 +153,7 @@ public final class ExtendedServicesResponse extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 1; if (sReferenceId != null) { @@ -194,7 +196,7 @@ public final class ExtendedServicesResponse extends ASN1Any { * Returns a new String object containing a text representing * of the ExtendedServicesResponse. */ - + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/FragmentSyntax.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/FragmentSyntax.java index 2d8802c..4e31c3c 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/FragmentSyntax.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/FragmentSyntax.java @@ -44,7 +44,7 @@ public final class FragmentSyntax extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { c_externallyTagged = null; c_notExternallyTagged = null; @@ -69,6 +69,7 @@ public final class FragmentSyntax extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; if (c_externallyTagged != null) { @@ -100,7 +101,7 @@ public final class FragmentSyntax extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! @@ -109,17 +110,15 @@ public final class FragmentSyntax extends ASN1Any { // permitted to allow something else to apply an implicit // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - - throw new ASN1EncodingException("FragmentSyntax: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the FragmentSyntax. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; if (c_externallyTagged != null) { @@ -137,5 +136,4 @@ public final class FragmentSyntax extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthentication.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthentication.java index e0f2e3e..8dcd2c9 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthentication.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthentication.java @@ -23,15 +23,14 @@ import org.xbib.asn1.BEREncoding; public final class IdAuthentication extends ASN1Any { - public ASN1VisibleString c_open; - public IdAuthenticationIdPass c_idPass; - public ASN1Null c_anonymous; - public ASN1External c_other; + public ASN1VisibleString open; + public IdAuthenticationIdPass idPass; + public ASN1Null anonymous; + public ASN1External other; /** * Default constructor for a IdAuthentication. */ - public IdAuthentication() { } @@ -44,7 +43,6 @@ public final class IdAuthentication extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public IdAuthentication(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -59,20 +57,18 @@ public final class IdAuthentication extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices - c_open = null; - c_idPass = null; - c_anonymous = null; - c_other = null; + open = null; + idPass = null; + anonymous = null; + other = null; // Try choice open try { - c_open = new ASN1VisibleString(ber, checkTag); + open = new ASN1VisibleString(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on @@ -80,7 +76,7 @@ public final class IdAuthentication extends ASN1Any { // Try choice idPass try { - c_idPass = new IdAuthenticationIdPass(ber, checkTag); + idPass = new IdAuthenticationIdPass(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on @@ -88,7 +84,7 @@ public final class IdAuthentication extends ASN1Any { // Try choice anonymous try { - c_anonymous = new ASN1Null(ber, checkTag); + anonymous = new ASN1Null(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on @@ -96,13 +92,13 @@ public final class IdAuthentication extends ASN1Any { // Try choice other try { - c_other = new ASN1External(ber, checkTag); + other = new ASN1External(ber, checkTag); return; } catch (ASN1Exception e) { // failed to decode, continue on } - throw new ASN1Exception("IdAuthentication: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -111,46 +107,43 @@ public final class IdAuthentication extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; // Encoding choice: c_open - if (c_open != null) { - chosen = c_open.berEncode(); + if (open != null) { + chosen = open.berEncode(); } // Encoding choice: c_idPass - if (c_idPass != null) { + if (idPass != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = c_idPass.berEncode(); + chosen = idPass.berEncode(); } // Encoding choice: c_anonymous - if (c_anonymous != null) { + if (anonymous != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = c_anonymous.berEncode(); + chosen = anonymous.berEncode(); } // Encoding choice: c_other - if (c_other != null) { + if (other != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } - chosen = c_other.berEncode(); + chosen = other.berEncode(); } // Check for error of having none of the choices set if (chosen == null) { throw new ASN1Exception("CHOICE not set"); } - return chosen; } @@ -168,10 +161,8 @@ public final class IdAuthentication extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -179,56 +170,52 @@ public final class IdAuthentication extends ASN1Any { // permitted to allow something else to apply an implicit // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - - throw new ASN1EncodingException("IdAuthentication: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the IdAuthentication. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); - boolean found = false; - if (c_open != null) { + if (open != null) { found = true; str.append("open "); - str.append(c_open); + str.append(open); } - if (c_idPass != null) { + if (idPass != null) { if (found) { str.append(" "); } found = true; str.append("idPass "); - str.append(c_idPass); + str.append(idPass); } - if (c_anonymous != null) { + if (anonymous != null) { if (found) { str.append(" "); } found = true; str.append("anonymous "); - str.append(c_anonymous); + str.append(anonymous); } - if (c_other != null) { + if (other != null) { if (found) { str.append(" "); } str.append("other "); - str.append(c_other); + str.append(other); } str.append("}"); return str.toString(); } - -} \ No newline at end of file +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthenticationIdPass.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthenticationIdPass.java index 9c81f70..44efca9 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthenticationIdPass.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/IdAuthenticationIdPass.java @@ -27,7 +27,6 @@ public final class IdAuthenticationIdPass extends ASN1Any { /** * Default constructor for a IdAuthentication_idPass. */ - public IdAuthenticationIdPass() { } @@ -40,9 +39,7 @@ public final class IdAuthenticationIdPass extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public IdAuthenticationIdPass(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public IdAuthenticationIdPass(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -55,10 +52,8 @@ public final class IdAuthenticationIdPass extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // IdAuthentication_idPass should be encoded by a constructed BER BERConstructed berConstructed; @@ -88,8 +83,8 @@ public final class IdAuthenticationIdPass extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 0 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 0 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_groupId = new InternationalString(p, false); part++; } @@ -101,8 +96,8 @@ public final class IdAuthenticationIdPass extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_userId = new InternationalString(p, false); part++; } @@ -114,8 +109,8 @@ public final class IdAuthenticationIdPass extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_password = new InternationalString(p, false); part++; } @@ -133,6 +128,7 @@ public final class IdAuthenticationIdPass extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -145,6 +141,7 @@ public final class IdAuthenticationIdPass extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -189,12 +186,10 @@ public final class IdAuthenticationIdPass extends ASN1Any { * Returns a new String object containing a text representing * of the IdAuthentication_idPass. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_groupId != null) { str.append("groupId "); str.append(s_groupId); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/InfoCategory.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/InfoCategory.java index c6e46f2..717d06b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/InfoCategory.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/InfoCategory.java @@ -33,7 +33,6 @@ public final class InfoCategory extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public InfoCategory(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -71,8 +70,8 @@ public final class InfoCategory extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_categoryTypeId = new ASN1ObjectIdentifier(p, false); part++; } @@ -85,8 +84,8 @@ public final class InfoCategory extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("InfoCategory: bad tag in s_categoryValue\n"); } @@ -106,6 +105,7 @@ public final class InfoCategory extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -118,10 +118,8 @@ public final class InfoCategory extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 1; // number of mandatories @@ -151,9 +149,8 @@ public final class InfoCategory extends ASN1Any { * Returns a new String object containing a text representing * of the InfoCategory. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeRequest.java index ebaaf56..7813ec9 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeRequest.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeRequest.java @@ -30,22 +30,24 @@ import org.xbib.asn1.BEREncoding; */ public final class InitializeRequest extends ASN1Any { - public ReferenceId s_referenceId; // optional - public ProtocolVersion s_protocolVersion; - public Options s_options; - public ASN1Integer s_preferredMessageSize; - public ASN1Integer s_exceptionalRecordSize; - public IdAuthentication s_idAuthentication; // optional - public InternationalString s_implementationId; // optional - public InternationalString s_implementationName; // optional - public InternationalString s_implementationVersion; // optional - public ASN1External s_userInformationField; // optional - public OtherInformation s_otherInfo; // optional + public ReferenceId referenceId; // optional + public ProtocolVersion protocolVersion; + public Options options; + public ASN1Integer preferredMessageSize; + public ASN1Integer exceptionalRecordSize; + public IdAuthentication idAuthentication; // optional + public InternationalString implementationId; // optional + public InternationalString implementationName; // optional + public InternationalString implementationVersion; // optional + public ASN1External userInformationField; // optional + public OtherInformation otherInfo; // optional + /** * Default constructor for a InitializeRequest. */ public InitializeRequest() { } + /** * Constructor for a InitializeRequest from a BER encoding. * @@ -55,9 +57,7 @@ public final class InitializeRequest extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public InitializeRequest(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public InitializeRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -70,17 +70,14 @@ public final class InitializeRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // InitializeRequest should be encoded by a constructed BER - BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("InitializeRequest: bad BER form"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -94,80 +91,80 @@ public final class InitializeRequest extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } // Decoding: protocolVersion ProtocolVersion if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - s_protocolVersion = new ProtocolVersion(p, true); + protocolVersion = new ProtocolVersion(p, true); part++; // Decoding: options Options if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - s_options = new Options(p, true); + options = new Options(p, true); part++; // Decoding: preferredMessageSize [5] IMPLICIT INTEGER if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 5 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("InitializeRequest: bad tag in s_preferredMessageSize"); + if (p.getTag() != 5 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in preferredMessageSize"); } - s_preferredMessageSize = new ASN1Integer(p, false); + preferredMessageSize = new ASN1Integer(p, false); part++; // Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 6 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("InitializeRequest: bad tag in s_exceptionalRecordSize"); + if (p.getTag() != 6 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in exceptionalRecordSize"); } - s_exceptionalRecordSize = new ASN1Integer(p, false); + exceptionalRecordSize = new ASN1Integer(p, false); part++; // Remaining elements are optional, set variables // to null (not present) so can return at endStream of BER - s_idAuthentication = null; - s_implementationId = null; - s_implementationName = null; - s_implementationVersion = null; - s_userInformationField = null; - s_otherInfo = null; + idAuthentication = null; + implementationId = null; + implementationName = null; + implementationVersion = null; + userInformationField = null; + otherInfo = null; // Decoding: idAuthentication [7] EXPLICIT IdAuthentication OPTIONAL @@ -176,44 +173,38 @@ public final class InitializeRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 7 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 7 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("InitializeRequest: bad BER encoding: s_idAuthentication tag bad"); + throw new ASN1EncodingException("bad BER encoding: idAuthentication tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("InitializeRequest: bad BER encoding: s_idAuthentication tag bad"); + throw new ASN1EncodingException("bad BER encoding: idAuthentication tag bad"); } - - s_idAuthentication = new IdAuthentication(tagged.elementAt(0), true); + idAuthentication = new IdAuthentication(tagged.elementAt(0), true); part++; } - // Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - - if (p.tagGet() == 110 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationId = new InternationalString(p, false); + if (p.getTag() == 110 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationId = new InternationalString(p, false); part++; } - // Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - if (p.tagGet() == 111 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationName = new InternationalString(p, false); + if (p.getTag() == 111 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationName = new InternationalString(p, false); part++; } @@ -224,9 +215,9 @@ public final class InitializeRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 112 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationVersion = new InternationalString(p, false); + if (p.getTag() == 112 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationVersion = new InternationalString(p, false); part++; } @@ -237,18 +228,17 @@ public final class InitializeRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 11 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 11 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("InitializeRequest: bad BER encoding: s_userInformationField tag bad"); + throw new ASN1EncodingException("bad BER encoding: s_userInformationField tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("InitializeRequest: bad BER encoding: s_userInformationField tag bad"); + throw new ASN1EncodingException("bad BER encoding: s_userInformationField tag bad"); } - - s_userInformationField = new ASN1External(tagged.elementAt(0), true); + userInformationField = new ASN1External(tagged.elementAt(0), true); part++; } @@ -260,16 +250,14 @@ public final class InitializeRequest extends ASN1Any { p = berConstructed.elementAt(part); try { - s_otherInfo = new OtherInformation(p, true); + otherInfo = new OtherInformation(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_otherInfo = null; // no, not present + otherInfo = null; // no, not present } - // Should not be any more parts - if (part < numParts) { - throw new ASN1Exception("InitializeRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -279,10 +267,8 @@ public final class InitializeRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -299,102 +285,76 @@ public final class InitializeRequest extends ASN1Any { * @see org.xbib.asn1.BEREncoding#PRIVATE_TAG */ - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding - int numFields = 4; // number of mandatories - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } - if (s_idAuthentication != null) { + if (idAuthentication != null) { numFields++; } - if (s_implementationId != null) { + if (implementationId != null) { numFields++; } - if (s_implementationName != null) { + if (implementationName != null) { numFields++; } - if (s_implementationVersion != null) { + if (implementationVersion != null) { numFields++; } - if (s_userInformationField != null) { + if (userInformationField != null) { numFields++; } - if (s_otherInfo != null) { + if (otherInfo != null) { numFields++; } - // Encode it - BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; BEREncoding enc[]; - // Encoding s_referenceId: ReferenceId OPTIONAL - - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } - // Encoding s_protocolVersion: ProtocolVersion - - fields[x++] = s_protocolVersion.berEncode(); - + fields[x++] = protocolVersion.berEncode(); // Encoding s_options: Options - - fields[x++] = s_options.berEncode(); - + fields[x++] = options.berEncode(); // Encoding s_preferredMessageSize: INTEGER - - fields[x++] = s_preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); - + fields[x++] = preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); // Encoding s_exceptionalRecordSize: INTEGER - - fields[x++] = s_exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); - + fields[x++] = exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); // Encoding s_idAuthentication: IdAuthentication OPTIONAL - - if (s_idAuthentication != null) { + if (idAuthentication != null) { enc = new BEREncoding[1]; - enc[0] = s_idAuthentication.berEncode(); + enc[0] = idAuthentication.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 7, enc); } - // Encoding s_implementationId: InternationalString OPTIONAL - - if (s_implementationId != null) { - fields[x++] = s_implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110); + if (implementationId != null) { + fields[x++] = implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110); } - // Encoding s_implementationName: InternationalString OPTIONAL - - if (s_implementationName != null) { - fields[x++] = s_implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111); + if (implementationName != null) { + fields[x++] = implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111); } - // Encoding s_implementationVersion: InternationalString OPTIONAL - - if (s_implementationVersion != null) { - fields[x++] = s_implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112); + if (implementationVersion != null) { + fields[x++] = implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112); } - // Encoding s_userInformationField: EXTERNAL OPTIONAL - if (s_userInformationField != null) { + if (userInformationField != null) { enc = new BEREncoding[1]; - enc[0] = s_userInformationField.berEncode(); + enc[0] = userInformationField.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc); } - // Encoding s_otherInfo: OtherInformation OPTIONAL - - if (s_otherInfo != null) { - fields[x++] = s_otherInfo.berEncode(); + if (otherInfo != null) { + fields[x] = otherInfo.berEncode(); } - return new BERConstructed(tagType, tag, fields); } @@ -402,100 +362,87 @@ public final class InitializeRequest extends ASN1Any { * Returns a new String object containing a text representing * of the InitializeRequest. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } - if (0 < outputted) { str.append(", "); } str.append("protocolVersion "); - str.append(s_protocolVersion); + str.append(protocolVersion); outputted++; - if (0 < outputted) { str.append(", "); } str.append("options "); - str.append(s_options); + str.append(options); outputted++; - if (0 < outputted) { str.append(", "); } str.append("preferredMessageSize "); - str.append(s_preferredMessageSize); + str.append(preferredMessageSize); outputted++; - if (0 < outputted) { str.append(", "); } str.append("exceptionalRecordSize "); - str.append(s_exceptionalRecordSize); + str.append(exceptionalRecordSize); outputted++; - - if (s_idAuthentication != null) { + if (idAuthentication != null) { if (0 < outputted) { str.append(", "); } str.append("idAuthentication "); - str.append(s_idAuthentication); + str.append(idAuthentication); outputted++; } - - if (s_implementationId != null) { + if (implementationId != null) { if (0 < outputted) { str.append(", "); } str.append("implementationId "); - str.append(s_implementationId); + str.append(implementationId); outputted++; } - - if (s_implementationName != null) { + if (implementationName != null) { if (0 < outputted) { str.append(", "); } str.append("implementationName "); - str.append(s_implementationName); + str.append(implementationName); outputted++; } - - if (s_implementationVersion != null) { + if (implementationVersion != null) { if (0 < outputted) { str.append(", "); } str.append("implementationVersion "); - str.append(s_implementationVersion); + str.append(implementationVersion); outputted++; } - - if (s_userInformationField != null) { + if (userInformationField != null) { if (0 < outputted) { str.append(", "); } str.append("userInformationField "); - str.append(s_userInformationField); + str.append(userInformationField); outputted++; } - - if (s_otherInfo != null) { + if (otherInfo != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(s_otherInfo); + str.append(otherInfo); } str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeResponse.java index 140aede..cef1658 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/InitializeResponse.java @@ -32,17 +32,18 @@ import org.xbib.asn1.BEREncoding; */ public final class InitializeResponse extends ASN1Any { - public ReferenceId s_referenceId; // optional - public ProtocolVersion s_protocolVersion; - public Options s_options; - public ASN1Integer s_preferredMessageSize; - public ASN1Integer s_exceptionalRecordSize; - public ASN1Boolean s_result; - public InternationalString s_implementationId; // optional - public InternationalString s_implementationName; // optional - public InternationalString s_implementationVersion; // optional - public ASN1External s_userInformationField; // optional - public OtherInformation s_otherInfo; // optional + public ReferenceId referenceId; // optional + public ProtocolVersion protocolVersion; + public Options options; + public ASN1Integer preferredMessageSize; + public ASN1Integer exceptionalRecordSize; + public ASN1Boolean result; + public InternationalString implementationId; // optional + public InternationalString implementationName; // optional + public InternationalString implementationVersion; // optional + public ASN1External userInformationField; // optional + public OtherInformation otherInfo; // optional + /** * Constructor for a InitializeResponse from a BER encoding. * @@ -52,7 +53,6 @@ public final class InitializeResponse extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public InitializeResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -66,204 +66,154 @@ public final class InitializeResponse extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // InitializeResponse should be encoded by a constructed BER - BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("InitializeResponse: bad BER form\n"); + throw new ASN1EncodingException("bad BER form\n"); } - // Prepare to decode the components - int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; BERConstructed tagged; - // Decoding: referenceId ReferenceId OPTIONAL - if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } - // Decoding: protocolVersion ProtocolVersion - if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - - s_protocolVersion = new ProtocolVersion(p, true); + protocolVersion = new ProtocolVersion(p, true); part++; - // Decoding: options Options - if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - - s_options = new Options(p, true); + options = new Options(p, true); part++; - // Decoding: preferredMessageSize [5] IMPLICIT INTEGER if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - - if (p.tagGet() != 5 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("InitializeResponse: bad tag in s_preferredMessageSize\n"); + if (p.getTag() != 5 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in preferredMessageSize"); } - - s_preferredMessageSize = new ASN1Integer(p, false); + preferredMessageSize = new ASN1Integer(p, false); part++; - // Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER - if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - - if (p.tagGet() != 6 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("InitializeResponse: bad tag in s_exceptionalRecordSize\n"); + if (p.getTag() != 6 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in exceptionalRecordSize"); } - - s_exceptionalRecordSize = new ASN1Integer(p, false); + exceptionalRecordSize = new ASN1Integer(p, false); part++; - // Decoding: result [12] IMPLICIT BOOLEAN - if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("InitializeResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - - if (p.tagGet() != 12 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("InitializeResponse: bad tag in s_result\n"); + if (p.getTag() != 12 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in result"); } - - s_result = new ASN1Boolean(p, false); + result = new ASN1Boolean(p, false); part++; - // Remaining elements are optional, set variables // to null (not present) so can return at endStream of BER - - s_implementationId = null; - s_implementationName = null; - s_implementationVersion = null; - s_userInformationField = null; - s_otherInfo = null; - + implementationId = null; + implementationName = null; + implementationVersion = null; + userInformationField = null; + otherInfo = null; // Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - - if (p.tagGet() == 110 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationId = new InternationalString(p, false); + if (p.getTag() == 110 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationId = new InternationalString(p, false); part++; } - // Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - - if (p.tagGet() == 111 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationName = new InternationalString(p, false); + if (p.getTag() == 111 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationName = new InternationalString(p, false); part++; } - // Decoding: implementationVersion [112] IMPLICIT InternationalString OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - - if (p.tagGet() == 112 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_implementationVersion = new InternationalString(p, false); + if (p.getTag() == 112 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + implementationVersion = new InternationalString(p, false); part++; } - // Decoding: userInformationField [11] EXPLICIT EXTERNAL OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - - if (p.tagGet() == 11 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 11 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("InitializeResponse: bad BER encoding: s_userInformationField tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: userInformationField tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException - ("InitializeResponse: bad BER encoding: s_userInformationField tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_userInformationField tag bad"); } - - s_userInformationField = new ASN1External(tagged.elementAt(0), true); + userInformationField = new ASN1External(tagged.elementAt(0), true); part++; } - // Decoding: otherInfo OtherInformation OPTIONAL - if (numParts <= part) { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - try { - s_otherInfo = new OtherInformation(p, true); + otherInfo = new OtherInformation(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_otherInfo = null; // no, not present + otherInfo = null; // no, not present } - // Should not be any more parts - if (part < numParts) { - throw new ASN1Exception("InitializeResponse: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -273,10 +223,8 @@ public final class InitializeResponse extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -288,96 +236,68 @@ public final class InitializeResponse extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding - int numFields = 5; // number of mandatories - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } - if (s_implementationId != null) { + if (implementationId != null) { numFields++; } - if (s_implementationName != null) { + if (implementationName != null) { numFields++; } - if (s_implementationVersion != null) { + if (implementationVersion != null) { numFields++; } - if (s_userInformationField != null) { + if (userInformationField != null) { numFields++; } - if (s_otherInfo != null) { + if (otherInfo != null) { numFields++; } - // Encode it - BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; BEREncoding enc[]; - // Encoding s_referenceId: ReferenceId OPTIONAL - - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } - // Encoding s_protocolVersion: ProtocolVersion - - fields[x++] = s_protocolVersion.berEncode(); - + fields[x++] = protocolVersion.berEncode(); // Encoding s_options: Options - - fields[x++] = s_options.berEncode(); - + fields[x++] = options.berEncode(); // Encoding s_preferredMessageSize: INTEGER - - fields[x++] = s_preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); - + fields[x++] = preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); // Encoding s_exceptionalRecordSize: INTEGER - - fields[x++] = s_exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); - + fields[x++] = exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); // Encoding s_result: BOOLEAN - - fields[x++] = s_result.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 12); - + fields[x++] = result.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 12); // Encoding s_implementationId: InternationalString OPTIONAL - - if (s_implementationId != null) { - fields[x++] = s_implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110); + if (implementationId != null) { + fields[x++] = implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110); } - // Encoding s_implementationName: InternationalString OPTIONAL - - if (s_implementationName != null) { - fields[x++] = s_implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111); + if (implementationName != null) { + fields[x++] = implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111); } - // Encoding s_implementationVersion: InternationalString OPTIONAL - - if (s_implementationVersion != null) { - fields[x++] = s_implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112); + if (implementationVersion != null) { + fields[x++] = implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112); } - // Encoding s_userInformationField: EXTERNAL OPTIONAL - - if (s_userInformationField != null) { + if (userInformationField != null) { enc = new BEREncoding[1]; - enc[0] = s_userInformationField.berEncode(); + enc[0] = userInformationField.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc); } - // Encoding s_otherInfo: OtherInformation OPTIONAL - - if (s_otherInfo != null) { - fields[x] = s_otherInfo.berEncode(); + if (otherInfo != null) { + fields[x] = otherInfo.berEncode(); } - return new BERConstructed(tagType, tag, fields); } @@ -385,100 +305,85 @@ public final class InitializeResponse extends ASN1Any { * Returns a new String object containing a text representing * of the InitializeResponse. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } - if (0 < outputted) { str.append(", "); } str.append("protocolVersion "); - str.append(s_protocolVersion); + str.append(protocolVersion); outputted++; - if (0 < outputted) { str.append(", "); } str.append("options "); - str.append(s_options); + str.append(options); outputted++; - if (0 < outputted) { str.append(", "); } str.append("preferredMessageSize "); - str.append(s_preferredMessageSize); + str.append(preferredMessageSize); outputted++; - if (0 < outputted) { str.append(", "); } str.append("exceptionalRecordSize "); - str.append(s_exceptionalRecordSize); + str.append(exceptionalRecordSize); outputted++; - if (0 < outputted) { str.append(", "); } str.append("result "); - str.append(s_result); + str.append(result); outputted++; - - if (s_implementationId != null) { + if (implementationId != null) { if (0 < outputted) { str.append(", "); } str.append("implementationId "); - str.append(s_implementationId); + str.append(implementationId); outputted++; } - - if (s_implementationName != null) { + if (implementationName != null) { if (0 < outputted) { str.append(", "); } str.append("implementationName "); - str.append(s_implementationName); + str.append(implementationName); outputted++; } - - if (s_implementationVersion != null) { + if (implementationVersion != null) { if (0 < outputted) { str.append(", "); } str.append("implementationVersion "); - str.append(s_implementationVersion); + str.append(implementationVersion); outputted++; } - - if (s_userInformationField != null) { + if (userInformationField != null) { if (0 < outputted) { str.append(", "); } str.append("userInformationField "); - str.append(s_userInformationField); + str.append(userInformationField); outputted++; } - - if (s_otherInfo != null) { + if (otherInfo != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(s_otherInfo); + str.append(otherInfo); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/IntUnit.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/IntUnit.java index a7a8e0a..848651b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/IntUnit.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/IntUnit.java @@ -33,9 +33,7 @@ public final class IntUnit extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public IntUnit(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public IntUnit(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -48,10 +46,8 @@ public final class IntUnit extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // IntUnit should be encoded by a constructed BER BERConstructed berConstructed; @@ -75,8 +71,8 @@ public final class IntUnit extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("IntUnit: bad tag in s_value\n"); } @@ -91,8 +87,8 @@ public final class IntUnit extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("IntUnit: bad tag in s_unitUsed\n"); } @@ -112,10 +108,8 @@ public final class IntUnit extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -127,10 +121,8 @@ public final class IntUnit extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 2; // number of mandatories @@ -155,9 +147,8 @@ public final class IntUnit extends ASN1Any { * Returns a new String object containing a text representing * of the IntUnit. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("value "); @@ -171,5 +162,4 @@ public final class IntUnit extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/InternationalString.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/InternationalString.java index 8a058b5..0c64162 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/InternationalString.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/InternationalString.java @@ -52,6 +52,7 @@ public final class InternationalString extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return value.berEncode(); } @@ -64,10 +65,8 @@ public final class InternationalString extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -75,9 +74,8 @@ public final class InternationalString extends ASN1Any { * Returns a new String object containing a text representing * of the InternationalString. */ - + @Override public String toString() { return value.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/KnownProximityUnit.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/KnownProximityUnit.java index 61d063f..3946f24 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/KnownProximityUnit.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/KnownProximityUnit.java @@ -36,7 +36,6 @@ public final class KnownProximityUnit extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public KnownProximityUnit(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -51,10 +50,8 @@ public final class KnownProximityUnit extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { value = new ASN1Integer(ber, checkTag); } @@ -64,10 +61,8 @@ public final class KnownProximityUnit extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return value.berEncode(); } @@ -79,6 +74,7 @@ public final class KnownProximityUnit extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -87,6 +83,7 @@ public final class KnownProximityUnit extends ASN1Any { * Returns a new String object containing a text representing * of the KnownProximityUnit. */ + @Override public String toString() { return value.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListEntries.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListEntries.java index f60d26f..47f4eb8 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListEntries.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListEntries.java @@ -20,9 +20,8 @@ import org.xbib.asn1.BEREncoding; */ public final class ListEntries extends ASN1Any { - public Entry s_entries[]; // optional - public DiagRec s_nonsurrogateDiagnostics[]; // optional - + public Entry[] s_entries; // optional + public DiagRec[] s_nonsurrogateDiagnostics; // optional /** * Constructor for a ListEntries from a BER encoding. @@ -46,17 +45,14 @@ public final class ListEntries extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // ListEntries should be encoded by a constructed BER BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; - } catch (ClassCastException e) { - throw new ASN1EncodingException("ListEntries: bad BER form\n"); + } catch (ClassCastException e) { throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -78,8 +74,8 @@ public final class ListEntries extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); @@ -89,7 +85,7 @@ public final class ListEntries extends ASN1Any { s_entries[n] = new Entry(cons.elementAt(n), true); } } catch (ClassCastException e) { - throw new ASN1EncodingException("Bad BER"); + throw new ASN1EncodingException("bad BER"); } part++; } @@ -101,8 +97,8 @@ public final class ListEntries extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); @@ -112,7 +108,7 @@ public final class ListEntries extends ASN1Any { s_nonsurrogateDiagnostics[n] = new DiagRec(cons.elementAt(n), true); } } catch (ClassCastException e) { - throw new ASN1EncodingException("Bad BER"); + throw new ASN1EncodingException("bad BER"); } part++; } @@ -120,7 +116,7 @@ public final class ListEntries extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("ListEntries: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -130,10 +126,8 @@ public final class ListEntries extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -145,6 +139,7 @@ public final class ListEntries extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -193,6 +188,7 @@ public final class ListEntries extends ASN1Any { * Returns a new String object containing a text representing * of the ListEntries. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses.java index 316942e..9cf4f71 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses.java @@ -29,7 +29,6 @@ public final class ListStatuses extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ListStatuses(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -44,6 +43,7 @@ public final class ListStatuses extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // ListStatuses should be encoded by a constructed BER @@ -71,6 +71,7 @@ public final class ListStatuses extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -83,6 +84,7 @@ public final class ListStatuses extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { BEREncoding fields[] = new BERConstructed[value.length]; int p; @@ -98,7 +100,7 @@ public final class ListStatuses extends ASN1Any { * Returns a new String object containing a text representing * of the ListStatuses. */ - + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int p; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses1.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses1.java index 5d4ef33..b58fb71 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses1.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ListStatuses1.java @@ -33,7 +33,6 @@ public final class ListStatuses1 extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ListStatuses1(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -48,10 +47,8 @@ public final class ListStatuses1 extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // ListStatuses1 should be encoded by a constructed BER BERConstructed berConstructed; @@ -103,10 +100,8 @@ public final class ListStatuses1 extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -118,10 +113,8 @@ public final class ListStatuses1 extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 2; // number of mandatories @@ -146,6 +139,7 @@ public final class ListStatuses1 extends ASN1Any { * Returns a new String object containing a text representing * of the ListStatuses1. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecord.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecord.java index 5bba4a2..1b5f8c5 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecord.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecord.java @@ -20,13 +20,12 @@ import org.xbib.asn1.BEREncoding; public final class NamePlusRecord extends ASN1Any { - public DatabaseName s_name; // optional - public NamePlusRecordRecord s_record; + public DatabaseName name; // optional + public NamePlusRecordRecord record; /** * Default constructor for a NamePlusRecord. */ - public NamePlusRecord() { } @@ -39,9 +38,7 @@ public final class NamePlusRecord extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public NamePlusRecord(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public NamePlusRecord(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -54,17 +51,15 @@ public final class NamePlusRecord extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // NamePlusRecord should be encoded by a constructed BER BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("NamePlusRecord: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -78,13 +73,13 @@ public final class NamePlusRecord extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("NamePlusRecord: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 0 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_name = new DatabaseName(p, false); + if (p.getTag() == 0 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + name = new DatabaseName(p, false); part++; } @@ -92,31 +87,31 @@ public final class NamePlusRecord extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("NamePlusRecord: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("NamePlusRecord: bad tag in s_record\n"); + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in record"); } try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("NamePlusRecord: bad BER encoding: s_record tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: record tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("NamePlusRecord: bad BER encoding: s_record tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: record tag bad"); } - s_record = new NamePlusRecordRecord(tagged.elementAt(0), true); + record = new NamePlusRecordRecord(tagged.elementAt(0), true); part++; // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("NamePlusRecord: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -126,10 +121,8 @@ public final class NamePlusRecord extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -141,14 +134,12 @@ public final class NamePlusRecord extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 1; // number of mandatories - if (s_name != null) { + if (name != null) { numFields++; } @@ -160,14 +151,14 @@ public final class NamePlusRecord extends ASN1Any { // Encoding s_name: DatabaseName OPTIONAL - if (s_name != null) { - fields[x++] = s_name.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0); + if (name != null) { + fields[x++] = name.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0); } // Encoding s_record: NamePlusRecord_record enc = new BEREncoding[1]; - enc[0] = s_record.berEncode(); + enc[0] = record.berEncode(); fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc); return new BERConstructed(tagType, tag, fields); } @@ -176,15 +167,14 @@ public final class NamePlusRecord extends ASN1Any { * Returns a new String object containing a text representing * of the NamePlusRecord. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_name != null) { + if (name != null) { str.append("name "); - str.append(s_name); + str.append(name); outputted++; } @@ -192,11 +182,10 @@ public final class NamePlusRecord extends ASN1Any { str.append(", "); } str.append("record "); - str.append(s_record); + str.append(record); str.append("}"); return str.toString(); } - -} \ No newline at end of file +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecordRecord.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecordRecord.java index 362a29f..22462a0 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecordRecord.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/NamePlusRecordRecord.java @@ -22,11 +22,11 @@ import org.xbib.asn1.BEREncoding; */ public final class NamePlusRecordRecord extends ASN1Any { - public ASN1External c_retrievalRecord; - public DiagRec c_surrogateDiagnostic; - public FragmentSyntax c_startingFragment; - public FragmentSyntax c_intermediateFragment; - public FragmentSyntax c_finalFragment; + public ASN1External retrievalRecord; + public DiagRec surrogateDiagnostic; + public FragmentSyntax startingFragment; + public FragmentSyntax intermediateFragment; + public FragmentSyntax finalFragment; /** * Constructor for a NamePlusRecord_record from a BER encoding. @@ -37,9 +37,7 @@ public final class NamePlusRecordRecord extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public NamePlusRecordRecord(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public NamePlusRecordRecord(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -52,106 +50,93 @@ public final class NamePlusRecordRecord extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed tagwrapper; // Null out all choices - c_retrievalRecord = null; - c_surrogateDiagnostic = null; - c_startingFragment = null; - c_intermediateFragment = null; - c_finalFragment = null; + retrievalRecord = null; + surrogateDiagnostic = null; + startingFragment = null; + intermediateFragment = null; + finalFragment = null; // Try choice retrievalRecord - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } - c_retrievalRecord = new ASN1External(tagwrapper.elementAt(0), true); + retrievalRecord = new ASN1External(tagwrapper.elementAt(0), true); return; } // Try choice surrogateDiagnostic - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } - c_surrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true); + surrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true); return; } // Try choice startingFragment - if (ber.tagGet() == 3 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 3 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } - c_startingFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); + startingFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); return; } // Try choice intermediateFragment - if (ber.tagGet() == 4 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 4 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } - c_intermediateFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); + intermediateFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); return; } // Try choice finalFragment - if (ber.tagGet() == 5 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 5 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException - ("NamePlusRecord_record: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } - c_finalFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); + finalFragment = new FragmentSyntax(tagwrapper.elementAt(0), true); return; } - - throw new ASN1Exception("NamePlusRecord_record: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -160,58 +145,56 @@ public final class NamePlusRecordRecord extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; BEREncoding enc[]; // Encoding choice: c_retrievalRecord - if (c_retrievalRecord != null) { + if (retrievalRecord != null) { enc = new BEREncoding[1]; - enc[0] = c_retrievalRecord.berEncode(); + enc[0] = retrievalRecord.berEncode(); chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc); } // Encoding choice: c_surrogateDiagnostic - if (c_surrogateDiagnostic != null) { + if (surrogateDiagnostic != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } enc = new BEREncoding[1]; - enc[0] = c_surrogateDiagnostic.berEncode(); + enc[0] = surrogateDiagnostic.berEncode(); chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 2, enc); } // Encoding choice: c_startingFragment - if (c_startingFragment != null) { + if (startingFragment != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } enc = new BEREncoding[1]; - enc[0] = c_startingFragment.berEncode(); + enc[0] = startingFragment.berEncode(); chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, enc); } // Encoding choice: c_intermediateFragment - if (c_intermediateFragment != null) { + if (intermediateFragment != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } enc = new BEREncoding[1]; - enc[0] = c_intermediateFragment.berEncode(); + enc[0] = intermediateFragment.berEncode(); chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 4, enc); } // Encoding choice: c_finalFragment - if (c_finalFragment != null) { + if (finalFragment != null) { if (chosen != null) { throw new ASN1Exception("CHOICE multiply set"); } enc = new BEREncoding[1]; - enc[0] = c_finalFragment.berEncode(); + enc[0] = finalFragment.berEncode(); chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc); } @@ -237,10 +220,8 @@ public final class NamePlusRecordRecord extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -249,64 +230,62 @@ public final class NamePlusRecordRecord extends ASN1Any { // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - throw new ASN1EncodingException("NamePlusRecord_record: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the NamePlusRecord_record. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; - if (c_retrievalRecord != null) { + if (retrievalRecord != null) { found = true; str.append("retrievalRecord "); - str.append(c_retrievalRecord); + str.append(retrievalRecord); } - if (c_surrogateDiagnostic != null) { + if (surrogateDiagnostic != null) { if (found) { str.append(" "); } found = true; str.append("surrogateDiagnostic "); - str.append(c_surrogateDiagnostic); + str.append(surrogateDiagnostic); } - if (c_startingFragment != null) { + if (startingFragment != null) { if (found) { str.append(" "); } found = true; str.append("startingFragment "); - str.append(c_startingFragment); + str.append(startingFragment); } - if (c_intermediateFragment != null) { + if (intermediateFragment != null) { if (found) { str.append(" "); } found = true; str.append("intermediateFragment "); - str.append(c_intermediateFragment); + str.append(intermediateFragment); } - if (c_finalFragment != null) { + if (finalFragment != null) { if (found) { str.append(" "); } str.append("finalFragment "); - str.append(c_finalFragment); + str.append(finalFragment); } str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes.java index 1cdb9ca..d7a0f1c 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes.java @@ -18,7 +18,6 @@ import org.xbib.asn1.BEREncoding; public final class OccurrenceByAttributes extends ASN1Any { public OccurrenceByAttributes1 value[]; - /** * Constructor for a OccurrenceByAttributes from a BER encoding. * @@ -28,7 +27,6 @@ public final class OccurrenceByAttributes extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public OccurrenceByAttributes(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -43,10 +41,8 @@ public final class OccurrenceByAttributes extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // OccurrenceByAttributes should be encoded by a constructed BER BERConstructed berConstructed; @@ -72,10 +68,8 @@ public final class OccurrenceByAttributes extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -87,17 +81,13 @@ public final class OccurrenceByAttributes extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { BEREncoding fields[] = new BERConstructed[value.length]; int p; - for (p = 0; p < value.length; p++) { fields[p] = value[p].berEncode(); } - return new BERConstructed(tagType, tag, fields); } @@ -105,19 +95,14 @@ public final class OccurrenceByAttributes extends ASN1Any { * Returns a new String object containing a text representing * of the OccurrenceByAttributes. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int p; - for (p = 0; p < value.length; p++) { str.append(value[p]); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes1.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes1.java index a67a239..75467e6 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes1.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributes1.java @@ -34,7 +34,6 @@ public final class OccurrenceByAttributes1 extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public OccurrenceByAttributes1(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -49,10 +48,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // OccurrenceByAttributes1 should be encoded by a constructed BER BERConstructed berConstructed; @@ -78,8 +75,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("OccurrenceByAttributes1: bad tag in s_attributes\n"); } @@ -145,10 +142,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -160,7 +155,7 @@ public final class OccurrenceByAttributes1 extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -203,9 +198,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any { * Returns a new String object containing a text representing * of the OccurrenceByAttributes1. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -229,10 +223,7 @@ public final class OccurrenceByAttributes1 extends ASN1Any { str.append("otherOccurInfo "); str.append(s_otherOccurInfo); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrences.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrences.java index ff1c0f8..67ab452 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrences.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrences.java @@ -7,7 +7,6 @@ import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.BERConstructed; import org.xbib.asn1.BEREncoding; - /** * Class for representing a OccurrenceByAttributes_occurrences from Z39-50-APDU-1995. *
@@ -33,7 +32,6 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
     public OccurrenceByAttributesOccurrences(BEREncoding ber, boolean checkTag)
             throws ASN1Exception {
         super(ber, checkTag);
@@ -48,39 +46,35 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         BERConstructed tagwrapper;
         c_global = null;
         c_byDatabase = null;
-        if (ber.tagGet() == 2 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 2 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException
-                        ("OccurrenceByAttributes_occurrences: bad BER form\n");
+                throw new ASN1EncodingException("bad BER form");
             }
             if (tagwrapper.numberComponents() != 1) {
-                throw new ASN1EncodingException
-                        ("OccurrenceByAttributes_occurrences: bad BER form\n");
+                throw new ASN1EncodingException("bad BER form");
             }
             c_global = new ASN1Integer(tagwrapper.elementAt(0), true);
             return;
         }
 
         // Try choice byDatabase
-        if (ber.tagGet() == 3 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 3 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             BEREncoding ber_data;
             ber_data = ber;
             BERConstructed berConstructed;
             try {
                 berConstructed = (BERConstructed) ber_data;
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException
-                        ("OccurrenceByAttributes_occurrences: bad BER form\n");
+                throw new ASN1EncodingException("bad BER form");
             }
 
             int numParts = berConstructed.numberComponents();
@@ -94,7 +88,7 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
             return;
         }
 
-        throw new ASN1Exception("OccurrenceByAttributes_occurrences: bad BER encoding: choice not matched");
+        throw new ASN1Exception("bad BER encoding: choice not matched");
     }
 
     /**
@@ -103,10 +97,8 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
 
         BEREncoding f2[];
@@ -156,7 +148,7 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
      * @param tag      the tag.
      * @throws ASN1Exception if it cannot be BER encoded.
      */
-
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // This method must not be called!
 
@@ -166,16 +158,15 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
         // tag on it, otherwise the tag identifying which CHOICE
         // it is will be overwritten and lost.
 
-        throw new ASN1EncodingException("OccurrenceByAttributes_occurrences: cannot implicitly tag");
+        throw new ASN1EncodingException("cannot implicitly tag");
     }
 
     /**
      * Returns a new String object containing a text representing
      * of the OccurrenceByAttributes_occurrences.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         int p;
         StringBuilder str = new StringBuilder("{");
 
@@ -203,5 +194,4 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrencesByDatabase.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrencesByDatabase.java
index 6cc94aa..2822752 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrencesByDatabase.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OccurrenceByAttributesOccurrencesByDatabase.java
@@ -49,18 +49,15 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // OccurrenceByAttributes_occurrences_byDatabase should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("OccurrenceByAttributes_occurrences_byDatabase: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -73,7 +70,7 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("OccurrenceByAttributes_occurrences_byDatabase: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
@@ -93,8 +90,8 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 1 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 1 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_num = new ASN1Integer(p, false);
             part++;
         }
@@ -116,7 +113,7 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("OccurrenceByAttributes_occurrences_byDatabase: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -126,10 +123,8 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -141,7 +136,7 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
@@ -181,9 +176,8 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the OccurrenceByAttributes_occurrences_byDatabase.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
 
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Operand.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Operand.java
index 660f885..875e4f6 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Operand.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Operand.java
@@ -5,7 +5,6 @@ import org.xbib.asn1.ASN1EncodingException;
 import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a Operand from Z39-50-APDU-1995.
  * 
@@ -19,15 +18,13 @@ import org.xbib.asn1.BEREncoding;
  */
 public final class Operand extends ASN1Any {
 
-    public AttributesPlusTerm c_attrTerm;
-    public ResultSetId c_resultSet;
-    public ResultSetPlusAttributes c_resultAttr;
-
+    public AttributesPlusTerm attrTerm;
+    public ResultSetId resultSet;
+    public ResultSetPlusAttributes resultAttr;
 
     public Operand() {
     }
 
-
     /**
      * Constructor for a Operand from a BER encoding.
      *
@@ -37,9 +34,7 @@ public final class Operand extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public Operand(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public Operand(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -52,19 +47,17 @@ public final class Operand extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Null out all choices
 
-        c_attrTerm = null;
-        c_resultSet = null;
-        c_resultAttr = null;
+        attrTerm = null;
+        resultSet = null;
+        resultAttr = null;
 
         // Try choice attrTerm
         try {
-            c_attrTerm = new AttributesPlusTerm(ber, checkTag);
+            attrTerm = new AttributesPlusTerm(ber, checkTag);
             return;
         } catch (ASN1Exception e) {
             // failed to decode, continue on
@@ -72,7 +65,7 @@ public final class Operand extends ASN1Any {
 
         // Try choice resultSet
         try {
-            c_resultSet = new ResultSetId(ber, checkTag);
+            resultSet = new ResultSetId(ber, checkTag);
             return;
         } catch (ASN1Exception e) {
             // failed to decode, continue on
@@ -80,13 +73,13 @@ public final class Operand extends ASN1Any {
 
         // Try choice resultAttr
         try {
-            c_resultAttr = new ResultSetPlusAttributes(ber, checkTag);
+            resultAttr = new ResultSetPlusAttributes(ber, checkTag);
             return;
         } catch (ASN1Exception e) {
             // failed to decode, continue on
         }
 
-        throw new ASN1Exception("Operand: bad BER encoding: choice not matched");
+        throw new ASN1Exception("bad BER encoding: choice not matched");
     }
 
     /**
@@ -95,31 +88,29 @@ public final class Operand extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
 
         // Encoding choice: c_attrTerm
-        if (c_attrTerm != null) {
-            chosen = c_attrTerm.berEncode();
+        if (attrTerm != null) {
+            chosen = attrTerm.berEncode();
         }
 
         // Encoding choice: c_resultSet
-        if (c_resultSet != null) {
+        if (resultSet != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_resultSet.berEncode();
+            chosen = resultSet.berEncode();
         }
 
         // Encoding choice: c_resultAttr
-        if (c_resultAttr != null) {
+        if (resultAttr != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_resultAttr.berEncode();
+            chosen = resultAttr.berEncode();
         }
 
         // Check for error of having none of the choices set
@@ -144,6 +135,7 @@ public final class Operand extends ASN1Any {
      * @param tag      the tag.
      * @throws ASN1Exception if it cannot be BER encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // This method must not be called!
 
@@ -153,46 +145,44 @@ public final class Operand extends ASN1Any {
         // tag on it, otherwise the tag identifying which CHOICE
         // it is will be overwritten and lost.
 
-        throw new ASN1EncodingException("Operand: cannot implicitly tag");
+        throw new ASN1EncodingException("cannot implicitly tag");
     }
 
     /**
      * Returns a new String object containing a text representing
      * of the Operand.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
 
         boolean found = false;
 
-        if (c_attrTerm != null) {
+        if (attrTerm != null) {
             found = true;
             str.append("attrTerm ");
-            str.append(c_attrTerm);
+            str.append(attrTerm);
         }
 
-        if (c_resultSet != null) {
+        if (resultSet != null) {
             if (found) {
                 str.append(" ");
             }
             found = true;
             str.append("resultSet ");
-            str.append(c_resultSet);
+            str.append(resultSet);
         }
 
-        if (c_resultAttr != null) {
+        if (resultAttr != null) {
             if (found) {
                 str.append(" ");
             }
             str.append("resultAttr ");
-            str.append(c_resultAttr);
+            str.append(resultAttr);
         }
 
         str.append("}");
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Operator.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Operator.java
index 7c538fb..2af048d 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Operator.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Operator.java
@@ -7,7 +7,6 @@ import org.xbib.asn1.ASN1Null;
 import org.xbib.asn1.BERConstructed;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a Operator from Z39-50-APDU-1995.
  * 
@@ -22,16 +21,14 @@ import org.xbib.asn1.BEREncoding;
  */
 public final class Operator extends ASN1Any {
 
-    public ASN1Null c_and;
-    public ASN1Null c_or;
-    public ASN1Null c_and_not;
-    public ProximityOperator c_prox;
-
+    public ASN1Null andOp;
+    public ASN1Null orOp;
+    public ASN1Null andNotOp;
+    public ProximityOperator proxOp;
 
     public Operator() {
     }
 
-
     /**
      * Constructor for a Operator from a BER encoding.
      *
@@ -41,9 +38,7 @@ public final class Operator extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public Operator(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public Operator(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -56,16 +51,14 @@ public final class Operator extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Check tag matches
 
         if (checkTag) {
-            if (ber.tagGet() != 46 ||
-                    ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-                throw new ASN1EncodingException("Operator: bad BER: tag=" + ber.tagGet() + " expected 46\n");
+            if (ber.getTag() != 46 ||
+                    ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+                throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 46");
             }
         }
 
@@ -75,51 +68,48 @@ public final class Operator extends ASN1Any {
         try {
             tagwrapper = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("Operator: bad BER tag form\n");
+            throw new ASN1EncodingException("bad BER tag form");
         }
         if (tagwrapper.numberComponents() != 1) {
-            throw new ASN1EncodingException
-                    ("Operator: bad BER tag form\n");
+            throw new ASN1EncodingException("bad BER tag form");
         }
         ber = tagwrapper.elementAt(0);
 
         // Null out all choices
 
-        c_and = null;
-        c_or = null;
-        c_and_not = null;
-        c_prox = null;
+        andOp = null;
+        orOp = null;
+        andNotOp = null;
+        proxOp = null;
 
         // Try choice and
-        if (ber.tagGet() == 0 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            c_and = new ASN1Null(ber, false);
+        if (ber.getTag() == 0 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            andOp = new ASN1Null(ber, false);
             return;
         }
 
         // Try choice or
-        if (ber.tagGet() == 1 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            c_or = new ASN1Null(ber, false);
+        if (ber.getTag() == 1 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            orOp = new ASN1Null(ber, false);
             return;
         }
 
         // Try choice and-not
-        if (ber.tagGet() == 2 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            c_and_not = new ASN1Null(ber, false);
+        if (ber.getTag() == 2 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            andNotOp = new ASN1Null(ber, false);
             return;
         }
 
         // Try choice prox
-        if (ber.tagGet() == 3 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            c_prox = new ProximityOperator(ber, false);
+        if (ber.getTag() == 3 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            proxOp = new ProximityOperator(ber, false);
             return;
         }
-
-        throw new ASN1Exception("Operator: bad BER encoding: choice not matched");
+        throw new ASN1Exception("bad BER encoding: choice not matched");
     }
 
     /**
@@ -128,10 +118,8 @@ public final class Operator extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 46);
     }
 
@@ -141,39 +129,37 @@ public final class Operator extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         BEREncoding chosen = null;
 
         // Encoding choice: c_and
-        if (c_and != null) {
-            chosen = c_and.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
+        if (andOp != null) {
+            chosen = andOp.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
         }
 
         // Encoding choice: c_or
-        if (c_or != null) {
+        if (orOp != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_or.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
+            chosen = orOp.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
         }
 
         // Encoding choice: c_and_not
-        if (c_and_not != null) {
+        if (andNotOp != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_and_not.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2);
+            chosen = andNotOp.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2);
         }
 
         // Encoding choice: c_prox
-        if (c_prox != null) {
+        if (proxOp != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_prox.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3);
+            chosen = proxOp.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3);
         }
 
         // Check for error of having none of the choices set
@@ -192,49 +178,46 @@ public final class Operator extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the Operator.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
 
         boolean found = false;
 
-        if (c_and != null) {
+        if (andOp != null) {
             found = true;
             str.append("and ");
-            str.append(c_and);
+            str.append(andOp);
         }
 
-        if (c_or != null) {
+        if (orOp != null) {
             if (found) {
                 str.append(" ");
             }
             found = true;
             str.append("or ");
-            str.append(c_or);
+            str.append(orOp);
         }
 
-        if (c_and_not != null) {
+        if (andNotOp != null) {
             if (found) {
                 str.append(" ");
             }
             found = true;
             str.append("and-not ");
-            str.append(c_and_not);
+            str.append(andNotOp);
         }
 
-        if (c_prox != null) {
+        if (proxOp != null) {
             if (found) {
                 str.append(" ");
             }
-            found = true;
             str.append("prox ");
-            str.append(c_prox);
+            str.append(proxOp);
         }
 
         str.append("}");
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Options.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Options.java
index 4d35049..4c9c737 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Options.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Options.java
@@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1EncodingException;
 import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a Options from Z39-50-APDU-1995.
  * 
@@ -15,6 +14,7 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class Options extends ASN1Any { + public ASN1BitString value; /** @@ -23,7 +23,6 @@ public final class Options extends ASN1Any { public Options() { } - /** * Constructor for a Options from a BER encoding. * @@ -33,9 +32,7 @@ public final class Options extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Options(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Options(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -48,16 +45,14 @@ public final class Options extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Check tag matches if (checkTag) { - if (ber.tagGet() != 4 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("Options: bad BER: tag=" + ber.tagGet() + " expected 4\n"); + if (ber.getTag() != 4 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 4"); } } @@ -70,6 +65,7 @@ public final class Options extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4); } @@ -82,6 +78,7 @@ public final class Options extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -90,8 +87,8 @@ public final class Options extends ASN1Any { * Returns a new String object containing a text representing * of the Options. */ + @Override public String toString() { return value.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation.java index b13ba3c..4ab0c3a 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation.java @@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.BERConstructed; import org.xbib.asn1.BEREncoding; - /** * Class for representing a OtherInformation from Z39-50-APDU-1995. *
@@ -15,8 +14,8 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class OtherInformation extends ASN1Any { - public OtherInformation1 value[]; + public OtherInformation1[] value; /** * Default constructor for a OtherInformation. @@ -25,7 +24,6 @@ public final class OtherInformation extends ASN1Any { public OtherInformation() { } - /** * Constructor for a OtherInformation from a BER encoding. * @@ -35,9 +33,7 @@ public final class OtherInformation extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public OtherInformation(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public OtherInformation(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -50,16 +46,14 @@ public final class OtherInformation extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Check tag matches if (checkTag) { - if (ber.tagGet() != 201 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("OtherInformation: bad BER: tag=" + ber.tagGet() + " expected 201\n"); + if (ber.getTag() != 201 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 201"); } } @@ -69,7 +63,7 @@ public final class OtherInformation extends ASN1Any { try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("OtherInformation: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -88,10 +82,8 @@ public final class OtherInformation extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 201); } @@ -103,10 +95,8 @@ public final class OtherInformation extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { BEREncoding fields[] = new BERConstructed[value.length]; int p; @@ -121,9 +111,8 @@ public final class OtherInformation extends ASN1Any { * Returns a new String object containing a text representing * of the OtherInformation. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int p; @@ -135,5 +124,4 @@ public final class OtherInformation extends ASN1Any { return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation1.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation1.java index 8926353..57e2108 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation1.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformation1.java @@ -19,8 +19,8 @@ import org.xbib.asn1.BEREncoding; */ public final class OtherInformation1 extends ASN1Any { - public InfoCategory s_category; // optional - public OtherInformationInformation s_information; + public InfoCategory category; // optional + public OtherInformationInformation information; /** * Constructor for a OtherInformation1 from a BER encoding. @@ -31,9 +31,7 @@ public final class OtherInformation1 extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public OtherInformation1(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public OtherInformation1(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -46,10 +44,8 @@ public final class OtherInformation1 extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // OtherInformation1 should be encoded by a constructed BER BERConstructed berConstructed; @@ -73,9 +69,9 @@ public final class OtherInformation1 extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_category = new InfoCategory(p, false); + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + category = new InfoCategory(p, false); part++; } @@ -87,7 +83,7 @@ public final class OtherInformation1 extends ASN1Any { } p = berConstructed.elementAt(part); - s_information = new OtherInformationInformation(p, true); + information = new OtherInformationInformation(p, true); part++; // Should not be any more parts @@ -103,10 +99,8 @@ public final class OtherInformation1 extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -118,14 +112,12 @@ public final class OtherInformation1 extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 1; // number of mandatories - if (s_category != null) { + if (category != null) { numFields++; } @@ -136,13 +128,13 @@ public final class OtherInformation1 extends ASN1Any { // Encoding s_category: InfoCategory OPTIONAL - if (s_category != null) { - fields[x++] = s_category.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); + if (category != null) { + fields[x++] = category.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); } // Encoding s_information: OtherInformation_information - fields[x] = s_information.berEncode(); + fields[x] = information.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -151,29 +143,22 @@ public final class OtherInformation1 extends ASN1Any { * Returns a new String object containing a text representing * of the OtherInformation1. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_category != null) { + if (category != null) { str.append("category "); - str.append(s_category); + str.append(category); outputted++; } - if (0 < outputted) { str.append(", "); } - - str.append("information "); - str.append(s_information); - + str.append(information); str.append("}"); - return str.toString(); } - -} \ No newline at end of file +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformationInformation.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformationInformation.java index 3086f8b..8288ca0 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformationInformation.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/OtherInformationInformation.java @@ -37,9 +37,7 @@ public final class OtherInformationInformation extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public OtherInformationInformation(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public OtherInformationInformation(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -52,10 +50,8 @@ public final class OtherInformationInformation extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices c_characterInfo = null; @@ -64,34 +60,34 @@ public final class OtherInformationInformation extends ASN1Any { c_oid = null; // Try choice characterInfo - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_characterInfo = new InternationalString(ber, false); return; } // Try choice binaryInfo - if (ber.tagGet() == 3 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 3 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_binaryInfo = new ASN1OctetString(ber, false); return; } // Try choice externallyDefinedInfo - if (ber.tagGet() == 4 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 4 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_externallyDefinedInfo = new ASN1External(ber, false); return; } // Try choice oid - if (ber.tagGet() == 5 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 5 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_oid = new ASN1ObjectIdentifier(ber, false); return; } - throw new ASN1Exception("OtherInformation_information: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -100,10 +96,8 @@ public final class OtherInformationInformation extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; // Encoding choice: c_characterInfo @@ -156,10 +150,8 @@ public final class OtherInformationInformation extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -168,18 +160,17 @@ public final class OtherInformationInformation extends ASN1Any { // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - throw new ASN1EncodingException("OtherInformation_information: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the OtherInformation_information. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); - boolean found = false; - if (c_characterInfo != null) { found = true; str.append("characterInfo "); @@ -212,10 +203,7 @@ public final class OtherInformationInformation extends ASN1Any { str.append("oid "); str.append(c_oid); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/PDU.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/PDU.java deleted file mode 100644 index b43c563..0000000 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/PDU.java +++ /dev/null @@ -1,722 +0,0 @@ -package org.xbib.io.iso23950.v3; - -import org.xbib.asn1.ASN1Any; -import org.xbib.asn1.ASN1EncodingException; -import org.xbib.asn1.ASN1Exception; -import org.xbib.asn1.BEREncoding; - - -/** - * Class for representing a PDU from Z39-50-APDU-1995. - *
- * PDU ::=
- * CHOICE {
- *   initRequest [20] IMPLICIT InitializeRequest
- *   initResponse [21] IMPLICIT InitializeResponse
- *   searchRequest [22] IMPLICIT SearchRequest
- *   searchResponse [23] IMPLICIT SearchResponse
- *   presentRequest [24] IMPLICIT PresentRequest
- *   presentResponse [25] IMPLICIT PresentResponse
- *   deleteResultSetRequest [26] IMPLICIT DeleteResultSetRequest
- *   deleteResultSetResponse [27] IMPLICIT DeleteResultSetResponse
- *   accessControlRequest [28] IMPLICIT AccessControlRequest
- *   accessControlResponse [29] IMPLICIT AccessControlResponse
- *   resourceControlRequest [30] IMPLICIT ResourceControlRequest
- *   resourceControlResponse [31] IMPLICIT ResourceControlResponse
- *   triggerResourceControlRequest [32] IMPLICIT TriggerResourceControlRequest
- *   resourceReportRequest [33] IMPLICIT ResourceReportRequest
- *   resourceReportResponse [34] IMPLICIT ResourceReportResponse
- *   scanRequest [35] IMPLICIT ScanRequest
- *   scanResponse [36] IMPLICIT ScanResponse
- *   sortRequest [43] IMPLICIT SortRequest
- *   sortResponse [44] IMPLICIT SortResponse
- *   segmentRequest [45] IMPLICIT Segment
- *   extendedServicesRequest [46] IMPLICIT ExtendedServicesRequest
- *   extendedServicesResponse [47] IMPLICIT ExtendedServicesResponse
- *   close [48] IMPLICIT Close
- * }
- * 
- */ -public final class PDU extends ASN1Any { - - public InitializeRequest c_initRequest; - public InitializeResponse c_initResponse; - public SearchRequest c_searchRequest; - public SearchResponse c_searchResponse; - public PresentRequest c_presentRequest; - public PresentResponse c_presentResponse; - public DeleteResultSetRequest c_deleteResultSetRequest; - public DeleteResultSetResponse c_deleteResultSetResponse; - public AccessControlRequest c_accessControlRequest; - public AccessControlResponse c_accessControlResponse; - public ResourceControlRequest c_resourceControlRequest; - public ResourceControlResponse c_resourceControlResponse; - public TriggerResourceControlRequest c_triggerResourceControlRequest; - public ResourceReportRequest c_resourceReportRequest; - public ResourceReportResponse c_resourceReportResponse; - public ScanRequest c_scanRequest; - public ScanResponse c_scanResponse; - public SortRequest c_sortRequest; - public SortResponse c_sortResponse; - public Segment c_segmentRequest; - public ExtendedServicesRequest c_extendedServicesRequest; - public ExtendedServicesResponse c_extendedServicesResponse; - public Close c_close; - /** - * Default constructor for a PDU. - */ - - public PDU() { - } - /** - * Constructor for a PDU from a BER encoding. - * - * @param ber the BER encoding. - * @param checkTag will check tag if true, use false - * if the BER has been implicitly tagged. You should - * usually be passing true. - * @throws ASN1Exception if the BER encoding is bad. - */ - - public PDU(BEREncoding ber, boolean checkTag) - throws ASN1Exception { - super(ber, checkTag); - } - - /** - * Initializing object from a BER encoding. - * This method is for internal use only. You should use - * the constructor that takes a BEREncoding. - * - * @param ber the BER to decode. - * @param checkTag if the tag should be checked. - * @throws ASN1Exception if the BER encoding is bad. - */ - public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { - c_initRequest = null; - c_initResponse = null; - c_searchRequest = null; - c_searchResponse = null; - c_presentRequest = null; - c_presentResponse = null; - c_deleteResultSetRequest = null; - c_deleteResultSetResponse = null; - c_accessControlRequest = null; - c_accessControlResponse = null; - c_resourceControlRequest = null; - c_resourceControlResponse = null; - c_triggerResourceControlRequest = null; - c_resourceReportRequest = null; - c_resourceReportResponse = null; - c_scanRequest = null; - c_scanResponse = null; - c_sortRequest = null; - c_sortResponse = null; - c_segmentRequest = null; - c_extendedServicesRequest = null; - c_extendedServicesResponse = null; - c_close = null; - - // Try choice initRequest - if (ber.tagGet() == 20 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_initRequest = new InitializeRequest(ber, false); - return; - } - - // Try choice initResponse - if (ber.tagGet() == 21 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_initResponse = new InitializeResponse(ber, false); - return; - } - - // Try choice searchRequest - if (ber.tagGet() == 22 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_searchRequest = new SearchRequest(ber, false); - return; - } - - // Try choice searchResponse - if (ber.tagGet() == 23 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_searchResponse = new SearchResponse(ber, false); - return; - } - - // Try choice presentRequest - if (ber.tagGet() == 24 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_presentRequest = new PresentRequest(ber, false); - return; - } - - // Try choice presentResponse - if (ber.tagGet() == 25 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_presentResponse = new PresentResponse(ber, false); - return; - } - - // Try choice deleteResultSetRequest - if (ber.tagGet() == 26 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_deleteResultSetRequest = new DeleteResultSetRequest(ber, false); - return; - } - - // Try choice deleteResultSetResponse - if (ber.tagGet() == 27 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_deleteResultSetResponse = new DeleteResultSetResponse(ber, false); - return; - } - - // Try choice accessControlRequest - if (ber.tagGet() == 28 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_accessControlRequest = new AccessControlRequest(ber, false); - return; - } - - // Try choice accessControlResponse - if (ber.tagGet() == 29 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_accessControlResponse = new AccessControlResponse(ber, false); - return; - } - - // Try choice resourceControlRequest - if (ber.tagGet() == 30 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_resourceControlRequest = new ResourceControlRequest(ber, false); - return; - } - - // Try choice resourceControlResponse - if (ber.tagGet() == 31 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_resourceControlResponse = new ResourceControlResponse(ber, false); - return; - } - - // Try choice triggerResourceControlRequest - if (ber.tagGet() == 32 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_triggerResourceControlRequest = new TriggerResourceControlRequest(ber, false); - return; - } - - // Try choice resourceReportRequest - if (ber.tagGet() == 33 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_resourceReportRequest = new ResourceReportRequest(ber, false); - return; - } - - // Try choice resourceReportResponse - if (ber.tagGet() == 34 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_resourceReportResponse = new ResourceReportResponse(ber, false); - return; - } - - // Try choice scanRequest - if (ber.tagGet() == 35 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_scanRequest = new ScanRequest(ber, false); - return; - } - - // Try choice scanResponse - if (ber.tagGet() == 36 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_scanResponse = new ScanResponse(ber, false); - return; - } - - // Try choice sortRequest - if (ber.tagGet() == 43 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_sortRequest = new SortRequest(ber, false); - return; - } - - // Try choice sortResponse - if (ber.tagGet() == 44 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_sortResponse = new SortResponse(ber, false); - return; - } - - // Try choice segmentRequest - if (ber.tagGet() == 45 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_segmentRequest = new Segment(ber, false); - return; - } - - // Try choice extendedServicesRequest - if (ber.tagGet() == 46 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_extendedServicesRequest = new ExtendedServicesRequest(ber, false); - return; - } - - // Try choice extendedServicesResponse - if (ber.tagGet() == 47 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_extendedServicesResponse = new ExtendedServicesResponse(ber, false); - return; - } - - // Try choice close - if (ber.tagGet() == 48 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - c_close = new Close(ber, false); - return; - } - - throw new ASN1Exception("PDU: bad BER encoding: choice not matched"); - } - - /** - * Returns a BER encoding of PDU. - * - * @return The BER encoding. - * @throws ASN1Exception Invalid or cannot be encoded. - */ - public BEREncoding berEncode() throws ASN1Exception { - BEREncoding chosen = null; - - // Encoding choice: c_initRequest - if (c_initRequest != null) { - chosen = c_initRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 20); - } - - // Encoding choice: c_initResponse - if (c_initResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_initResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 21); - } - - // Encoding choice: c_searchRequest - if (c_searchRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_searchRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 22); - } - - // Encoding choice: c_searchResponse - if (c_searchResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_searchResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 23); - } - - // Encoding choice: c_presentRequest - if (c_presentRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_presentRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24); - } - - // Encoding choice: c_presentResponse - if (c_presentResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_presentResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25); - } - - // Encoding choice: c_deleteResultSetRequest - if (c_deleteResultSetRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_deleteResultSetRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 26); - } - - // Encoding choice: c_deleteResultSetResponse - if (c_deleteResultSetResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_deleteResultSetResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 27); - } - - // Encoding choice: c_accessControlRequest - if (c_accessControlRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_accessControlRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 28); - } - - // Encoding choice: c_accessControlResponse - if (c_accessControlResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_accessControlResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 29); - } - - // Encoding choice: c_resourceControlRequest - if (c_resourceControlRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_resourceControlRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 30); - } - - // Encoding choice: c_resourceControlResponse - if (c_resourceControlResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_resourceControlResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 31); - } - - // Encoding choice: c_triggerResourceControlRequest - if (c_triggerResourceControlRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_triggerResourceControlRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 32); - } - - // Encoding choice: c_resourceReportRequest - if (c_resourceReportRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_resourceReportRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 33); - } - - // Encoding choice: c_resourceReportResponse - if (c_resourceReportResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_resourceReportResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 34); - } - - // Encoding choice: c_scanRequest - if (c_scanRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_scanRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 35); - } - - // Encoding choice: c_scanResponse - if (c_scanResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_scanResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 36); - } - - // Encoding choice: c_sortRequest - if (c_sortRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_sortRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 43); - } - - // Encoding choice: c_sortResponse - if (c_sortResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_sortResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 44); - } - - // Encoding choice: c_segmentRequest - if (c_segmentRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_segmentRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 45); - } - - // Encoding choice: c_extendedServicesRequest - if (c_extendedServicesRequest != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_extendedServicesRequest.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 46); - } - - // Encoding choice: c_extendedServicesResponse - if (c_extendedServicesResponse != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_extendedServicesResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 47); - } - - // Encoding choice: c_close - if (c_close != null) { - if (chosen != null) { - throw new ASN1Exception("CHOICE multiply set"); - } - chosen = c_close.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 48); - } - - // Check for error of having none of the choices set - if (chosen == null) { - throw new ASN1Exception("CHOICE not set"); - } - - return chosen; - } - - /** - * Generating a BER encoding of the object - * and implicitly tagging it. - * This method is for internal use only. You should use - * the berEncode method that does not take a parameter. - * This function should never be used, because this - * production is a CHOICE. - * It must never have an implicit tag. - * An exception will be thrown if it is called. - * - * @param tagType the type of the tag. - * @param tag the tag. - * @throws ASN1Exception if it cannot be BER encoded. - */ - public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { - // This method must not be called! - - // Method is not available because this is a basic CHOICE - // which does not have an explicit tag on it. So it is not - // permitted to allow something else to apply an implicit - // tag on it, otherwise the tag identifying which CHOICE - // it is will be overwritten and lost. - - throw new ASN1EncodingException("PDU: cannot implicitly tag"); - } - - /** - * Returns a new String object containing a text representing - * of the PDU. - */ - public String toString() { - StringBuilder str = new StringBuilder("{"); - - boolean found = false; - - if (c_initRequest != null) { - found = true; - str.append("initRequest "); - str.append(c_initRequest); - } - - if (c_initResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("initResponse "); - str.append(c_initResponse); - } - - if (c_searchRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("searchRequest "); - str.append(c_searchRequest); - } - - if (c_searchResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("searchResponse "); - str.append(c_searchResponse); - } - - if (c_presentRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("presentRequest "); - str.append(c_presentRequest); - } - - if (c_presentResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("presentResponse "); - str.append(c_presentResponse); - } - - if (c_deleteResultSetRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("deleteResultSetRequest "); - str.append(c_deleteResultSetRequest); - } - - if (c_deleteResultSetResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("deleteResultSetResponse "); - str.append(c_deleteResultSetResponse); - } - - if (c_accessControlRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("accessControlRequest "); - str.append(c_accessControlRequest); - } - - if (c_accessControlResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("accessControlResponse "); - str.append(c_accessControlResponse); - } - - if (c_resourceControlRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("resourceControlRequest "); - str.append(c_resourceControlRequest); - } - - if (c_resourceControlResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("resourceControlResponse "); - str.append(c_resourceControlResponse); - } - - if (c_triggerResourceControlRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("triggerResourceControlRequest "); - str.append(c_triggerResourceControlRequest); - } - - if (c_resourceReportRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("resourceReportRequest "); - str.append(c_resourceReportRequest); - } - - if (c_resourceReportResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("resourceReportResponse "); - str.append(c_resourceReportResponse); - } - - if (c_scanRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("scanRequest "); - str.append(c_scanRequest); - } - - if (c_scanResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("scanResponse "); - str.append(c_scanResponse); - } - - if (c_sortRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("sortRequest "); - str.append(c_sortRequest); - } - - if (c_sortResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("sortResponse "); - str.append(c_sortResponse); - } - - if (c_segmentRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("segmentRequest "); - str.append(c_segmentRequest); - } - - if (c_extendedServicesRequest != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("extendedServicesRequest "); - str.append(c_extendedServicesRequest); - } - - if (c_extendedServicesResponse != null) { - if (found) { - str.append(" "); - } - found = true; - str.append("extendedServicesResponse "); - str.append(c_extendedServicesResponse); - } - - if (c_close != null) { - if (found) { - str.append(" "); - } - str.append("close "); - str.append(c_close); - } - str.append("}"); - return str.toString(); - } -} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions.java index a4b5dc9..29f6afa 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions.java @@ -17,7 +17,7 @@ import org.xbib.asn1.BEREncoding; */ public final class Permissions extends ASN1Any { - public Permissions1 value[]; + public Permissions1[] value; /** * Constructor for a Permissions from a BER encoding. @@ -28,9 +28,7 @@ public final class Permissions extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Permissions(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Permissions(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -43,17 +41,15 @@ public final class Permissions extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Permissions should be encoded by a constructed BER BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("Permissions: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); value = new Permissions1[numParts]; @@ -69,10 +65,8 @@ public final class Permissions extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -84,17 +78,13 @@ public final class Permissions extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { BEREncoding fields[] = new BERConstructed[value.length]; int p; - for (p = 0; p < value.length; p++) { fields[p] = value[p].berEncode(); } - return new BERConstructed(tagType, tag, fields); } @@ -102,9 +92,8 @@ public final class Permissions extends ASN1Any { * Returns a new String object containing a text representing * of the Permissions. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int p; for (p = 0; p < value.length; p++) { @@ -113,5 +102,4 @@ public final class Permissions extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions1.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions1.java index bccae84..3554a98 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions1.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Permissions1.java @@ -8,7 +8,6 @@ import org.xbib.asn1.ASN1Sequence; import org.xbib.asn1.BERConstructed; import org.xbib.asn1.BEREncoding; - /** * Class for representing a Permissions1 from Z39-50-APDU-1995. *
@@ -24,7 +23,6 @@ public final class Permissions1 extends ASN1Any {
     public InternationalString s_userId;
     public ASN1Integer s_allowableFunctions[];
 
-
     /**
      * Constructor for a Permissions1 from a BER encoding.
      *
@@ -34,9 +32,7 @@ public final class Permissions1 extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public Permissions1(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public Permissions1(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -49,18 +45,15 @@ public final class Permissions1 extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Permissions1 should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("Permissions1: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -73,14 +66,13 @@ public final class Permissions1 extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("Permissions1: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 1 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("Permissions1: bad tag in s_userId\n");
+        if (p.getTag() != 1 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_userId");
         }
 
         s_userId = new InternationalString(p, false);
@@ -90,14 +82,13 @@ public final class Permissions1 extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("Permissions1: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 2 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("Permissions1: bad tag in s_allowableFunctions\n");
+        if (p.getTag() != 2 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_allowableFunctions");
         }
 
         try {
@@ -109,14 +100,14 @@ public final class Permissions1 extends ASN1Any {
                 s_allowableFunctions[n] = new ASN1Integer(cons.elementAt(n), true);
             }
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("Bad BER");
+            throw new ASN1EncodingException("bad BER");
         }
         part++;
 
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("Permissions1: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -126,10 +117,8 @@ public final class Permissions1 extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -141,6 +130,7 @@ public final class Permissions1 extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
@@ -174,9 +164,8 @@ public final class Permissions1 extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the Permissions1.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         int p;
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
@@ -200,5 +189,4 @@ public final class Permissions1 extends ASN1Any {
         str.append("}");
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequest.java
index 5efba07..825723b 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequest.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequest.java
@@ -32,23 +32,24 @@ import org.xbib.asn1.BEREncoding;
 
 public final class PresentRequest extends ASN1Any {
 
-    public ReferenceId s_referenceId; // optional
-    public ResultSetId s_resultSetId;
-    public ASN1Integer s_resultSetStartPoint;
-    public ASN1Integer s_numberOfRecordsRequested;
-    public Range s_additionalRanges[]; // optional
-    public PresentRequestRecordComposition s_recordComposition; // optional
-    public ASN1ObjectIdentifier s_preferredRecordSyntax; // optional
-    public ASN1Integer s_maxSegmentCount; // optional
-    public ASN1Integer s_maxRecordSize; // optional
-    public ASN1Integer s_maxSegmentSize; // optional
-    public OtherInformation s_otherInfo; // optional
+    public ReferenceId referenceId; // optional
+    public ResultSetId resultSetId;
+    public ASN1Integer resultSetStartPoint;
+    public ASN1Integer numberOfRecordsRequested;
+    public Range[] additionalRanges; // optional
+    public PresentRequestRecordComposition recordComposition; // optional
+    public ASN1ObjectIdentifier preferredRecordSyntax; // optional
+    public ASN1Integer maxSegmentCount; // optional
+    public ASN1Integer maxRecordSize; // optional
+    public ASN1Integer maxSegmentSize; // optional
+    public OtherInformation otherInfo; // optional
+
     /**
      * Default constructor for a PresentRequest.
      */
-
     public PresentRequest() {
     }
+
     /**
      * Constructor for a PresentRequest from a BER encoding.
      *
@@ -58,9 +59,7 @@ public final class PresentRequest extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public PresentRequest(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public PresentRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -73,201 +72,157 @@ public final class PresentRequest extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // PresentRequest should be encoded by a constructed BER
-
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("PresentRequest: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
-
         // Prepare to decode the components
-
         int numParts = berConstructed.numberComponents();
         int part = 0;
         BEREncoding p;
-
         // Decoding: referenceId ReferenceId OPTIONAL
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_referenceId = new ReferenceId(p, true);
+            referenceId = new ReferenceId(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_referenceId = null; // no, not present
+            referenceId = null; // no, not present
         }
-
         // Decoding: resultSetId ResultSetId
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        s_resultSetId = new ResultSetId(p, true);
+        resultSetId = new ResultSetId(p, true);
         part++;
-
         // Decoding: resultSetStartPoint [30] IMPLICIT INTEGER
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() != 30 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException("PresentRequest: bad tag in s_resultSetStartPoint\n");
+        if (p.getTag() != 30 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in resultSetStartPoint\n");
         }
-
-        s_resultSetStartPoint = new ASN1Integer(p, false);
+        resultSetStartPoint = new ASN1Integer(p, false);
         part++;
-
         // Decoding: numberOfRecordsRequested [29] IMPLICIT INTEGER
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() != 29 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException("PresentRequest: bad tag in s_numberOfRecordsRequested\n");
+        if (p.getTag() != 29 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("PresentRequest: bad tag in numberOfRecordsRequested");
         }
-
-        s_numberOfRecordsRequested = new ASN1Integer(p, false);
+        numberOfRecordsRequested = new ASN1Integer(p, false);
         part++;
-
         // Remaining elements are optional, set variables
         // to null (not present) so can return at endStream of BER
-
-        s_additionalRanges = null;
-        s_recordComposition = null;
-        s_preferredRecordSyntax = null;
-        s_maxSegmentCount = null;
-        s_maxRecordSize = null;
-        s_maxSegmentSize = null;
-        s_otherInfo = null;
-
+        additionalRanges = null;
+        recordComposition = null;
+        preferredRecordSyntax = null;
+        maxSegmentCount = null;
+        maxRecordSize = null;
+        maxSegmentSize = null;
+        otherInfo = null;
         // Decoding: additionalRanges [212] IMPLICIT SEQUENCE OF Range OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() == 212 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 212 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 BERConstructed cons = (BERConstructed) p;
                 int parts = cons.numberComponents();
-                s_additionalRanges = new Range[parts];
+                additionalRanges = new Range[parts];
                 int n;
                 for (n = 0; n < parts; n++) {
-                    s_additionalRanges[n] = new Range(cons.elementAt(n), true);
+                    additionalRanges[n] = new Range(cons.elementAt(n), true);
                 }
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException("Bad BER");
+                throw new ASN1EncodingException("bad BER");
             }
             part++;
         }
-
         // Decoding: recordComposition PresentRequest_recordComposition OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_recordComposition = new PresentRequestRecordComposition(p, true);
+            recordComposition = new PresentRequestRecordComposition(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_recordComposition = null; // no, not present
+            recordComposition = null; // no, not present
         }
-
         // Decoding: preferredRecordSyntax [104] IMPLICIT OBJECT IDENTIFIER OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() == 104 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            s_preferredRecordSyntax = new ASN1ObjectIdentifier(p, false);
+        if (p.getTag() == 104 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            preferredRecordSyntax = new ASN1ObjectIdentifier(p, false);
             part++;
         }
-
         // Decoding: maxSegmentCount [204] IMPLICIT INTEGER OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() == 204 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            s_maxSegmentCount = new ASN1Integer(p, false);
+        if (p.getTag() == 204 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            maxSegmentCount = new ASN1Integer(p, false);
             part++;
         }
-
         // Decoding: maxRecordSize [206] IMPLICIT INTEGER OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() == 206 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            s_maxRecordSize = new ASN1Integer(p, false);
+        if (p.getTag() == 206 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            maxRecordSize = new ASN1Integer(p, false);
             part++;
         }
-
         // Decoding: maxSegmentSize [207] IMPLICIT INTEGER OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() == 207 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            s_maxSegmentSize = new ASN1Integer(p, false);
+        if (p.getTag() == 207 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            maxSegmentSize = new ASN1Integer(p, false);
             part++;
         }
-
         // Decoding: otherInfo OtherInformation OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_otherInfo = new OtherInformation(p, true);
+            otherInfo = new OtherInformation(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_otherInfo = null; // no, not present
+            otherInfo = null; // no, not present
         }
-
         // Should not be any more parts
-
         if (part < numParts) {
-            throw new ASN1Exception("PresentRequest: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -277,10 +232,8 @@ public final class PresentRequest extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -292,111 +245,81 @@ public final class PresentRequest extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
-
         int numFields = 3; // number of mandatories
-        if (s_referenceId != null) {
+        if (referenceId != null) {
             numFields++;
         }
-        if (s_additionalRanges != null) {
+        if (additionalRanges != null) {
             numFields++;
         }
-        if (s_recordComposition != null) {
+        if (recordComposition != null) {
             numFields++;
         }
-        if (s_preferredRecordSyntax != null) {
+        if (preferredRecordSyntax != null) {
             numFields++;
         }
-        if (s_maxSegmentCount != null) {
+        if (maxSegmentCount != null) {
             numFields++;
         }
-        if (s_maxRecordSize != null) {
+        if (maxRecordSize != null) {
             numFields++;
         }
-        if (s_maxSegmentSize != null) {
+        if (maxSegmentSize != null) {
             numFields++;
         }
-        if (s_otherInfo != null) {
+        if (otherInfo != null) {
             numFields++;
         }
-
         // Encode it
-
         BEREncoding fields[] = new BEREncoding[numFields];
         int x = 0;
         BEREncoding f2[];
         int p;
-
         // Encoding s_referenceId: ReferenceId OPTIONAL
-
-        if (s_referenceId != null) {
-            fields[x++] = s_referenceId.berEncode();
+        if (referenceId != null) {
+            fields[x++] = referenceId.berEncode();
         }
-
         // Encoding s_resultSetId: ResultSetId
-
-        fields[x++] = s_resultSetId.berEncode();
-
+        fields[x++] = resultSetId.berEncode();
         // Encoding s_resultSetStartPoint: INTEGER
-
-        fields[x++] = s_resultSetStartPoint.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 30);
-
+        fields[x++] = resultSetStartPoint.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 30);
         // Encoding s_numberOfRecordsRequested: INTEGER
-
-        fields[x++] = s_numberOfRecordsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 29);
-
+        fields[x++] = numberOfRecordsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 29);
         // Encoding s_additionalRanges: SEQUENCE OF OPTIONAL
-
-        if (s_additionalRanges != null) {
-            f2 = new BEREncoding[s_additionalRanges.length];
-
-            for (p = 0; p < s_additionalRanges.length; p++) {
-                f2[p] = s_additionalRanges[p].berEncode();
+        if (additionalRanges != null) {
+            f2 = new BEREncoding[additionalRanges.length];
+            for (p = 0; p < additionalRanges.length; p++) {
+                f2[p] = additionalRanges[p].berEncode();
             }
-
             fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 212, f2);
         }
-
         // Encoding s_recordComposition: PresentRequest_recordComposition OPTIONAL
-
-        if (s_recordComposition != null) {
-            fields[x++] = s_recordComposition.berEncode();
+        if (recordComposition != null) {
+            fields[x++] = recordComposition.berEncode();
         }
-
         // Encoding s_preferredRecordSyntax: OBJECT IDENTIFIER OPTIONAL
-
-        if (s_preferredRecordSyntax != null) {
-            fields[x++] = s_preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104);
+        if (preferredRecordSyntax != null) {
+            fields[x++] = preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104);
         }
-
         // Encoding s_maxSegmentCount: INTEGER OPTIONAL
-
-        if (s_maxSegmentCount != null) {
-            fields[x++] = s_maxSegmentCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 204);
+        if (maxSegmentCount != null) {
+            fields[x++] = maxSegmentCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 204);
         }
-
         // Encoding s_maxRecordSize: INTEGER OPTIONAL
-
-        if (s_maxRecordSize != null) {
-            fields[x++] = s_maxRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 206);
+        if (maxRecordSize != null) {
+            fields[x++] = maxRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 206);
         }
-
         // Encoding s_maxSegmentSize: INTEGER OPTIONAL
-
-        if (s_maxSegmentSize != null) {
-            fields[x++] = s_maxSegmentSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 207);
+        if (maxSegmentSize != null) {
+            fields[x++] = maxSegmentSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 207);
         }
-
         // Encoding s_otherInfo: OtherInformation OPTIONAL
-
-        if (s_otherInfo != null) {
-            fields[x] = s_otherInfo.berEncode();
+        if (otherInfo != null) {
+            fields[x] = otherInfo.berEncode();
         }
-
         return new BERConstructed(tagType, tag, fields);
     }
 
@@ -404,107 +327,95 @@ public final class PresentRequest extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the PresentRequest.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         int p;
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
-
-        if (s_referenceId != null) {
+        if (referenceId != null) {
             str.append("referenceId ");
-            str.append(s_referenceId);
+            str.append(referenceId);
             outputted++;
         }
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("resultSetId ");
-        str.append(s_resultSetId);
+        str.append(resultSetId);
         outputted++;
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("resultSetStartPoint ");
-        str.append(s_resultSetStartPoint);
+        str.append(resultSetStartPoint);
         outputted++;
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("numberOfRecordsRequested ");
-        str.append(s_numberOfRecordsRequested);
+        str.append(numberOfRecordsRequested);
         outputted++;
-
-        if (s_additionalRanges != null) {
+        if (additionalRanges != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("additionalRanges ");
             str.append("{");
-            for (p = 0; p < s_additionalRanges.length; p++) {
+            for (p = 0; p < additionalRanges.length; p++) {
                 if (p != 0) {
                     str.append(", ");
                 }
-                str.append(s_additionalRanges[p]);
+                str.append(additionalRanges[p]);
             }
             str.append("}");
             outputted++;
         }
-
-        if (s_recordComposition != null) {
+        if (recordComposition != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("recordComposition ");
-            str.append(s_recordComposition);
+            str.append(recordComposition);
             outputted++;
         }
-
-        if (s_preferredRecordSyntax != null) {
+        if (preferredRecordSyntax != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("preferredRecordSyntax ");
-            str.append(s_preferredRecordSyntax);
+            str.append(preferredRecordSyntax);
             outputted++;
         }
-
-        if (s_maxSegmentCount != null) {
+        if (maxSegmentCount != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("maxSegmentCount ");
-            str.append(s_maxSegmentCount);
+            str.append(maxSegmentCount);
             outputted++;
         }
-
-        if (s_maxRecordSize != null) {
+        if (maxRecordSize != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("maxRecordSize ");
-            str.append(s_maxRecordSize);
+            str.append(maxRecordSize);
             outputted++;
         }
-
-        if (s_maxSegmentSize != null) {
+        if (maxSegmentSize != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("maxSegmentSize ");
-            str.append(s_maxSegmentSize);
+            str.append(maxSegmentSize);
             outputted++;
         }
-
-        if (s_otherInfo != null) {
+        if (otherInfo != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("otherInfo ");
-            str.append(s_otherInfo);
+            str.append(otherInfo);
         }
         str.append("}");
         return str.toString();
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequestRecordComposition.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequestRecordComposition.java
index 06cbfc6..8a5f98d 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequestRecordComposition.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentRequestRecordComposition.java
@@ -19,14 +19,13 @@ import org.xbib.asn1.BEREncoding;
  */
 public final class PresentRequestRecordComposition extends ASN1Any {
 
-    public ElementSetNames c_simple;
+    public ElementSetNames simple;
 
-    public CompSpec c_complex;
+    public CompSpec complex;
 
     /**
      * Default constructor for a PresentRequest_recordComposition.
      */
-
     public PresentRequestRecordComposition() {
     }
 
@@ -52,29 +51,30 @@ public final class PresentRequestRecordComposition extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
+    @Override
     public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         BERConstructed tagwrapper;
-        c_simple = null;
-        c_complex = null;
-        if (ber.tagGet() == 19 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        simple = null;
+        complex = null;
+        if (ber.getTag() == 19 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException("PresentRequest_recordComposition: bad BER form");
+                throw new ASN1EncodingException("bad BER form");
             }
             if (tagwrapper.numberComponents() != 1) {
-                throw new ASN1EncodingException("PresentRequest_recordComposition: bad BER form");
+                throw new ASN1EncodingException("bad BER form");
             }
-            c_simple = new ElementSetNames(tagwrapper.elementAt(0), true);
+            simple = new ElementSetNames(tagwrapper.elementAt(0), true);
             return;
         }
-        if (ber.tagGet() == 209 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            c_complex = new CompSpec(ber, false);
+        if (ber.getTag() == 209 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            complex = new CompSpec(ber, false);
             return;
         }
-        throw new ASN1Exception("PresentRequest_recordComposition: bad BER encoding: choice not matched");
+        throw new ASN1Exception("bad BER encoding: choice not matched");
     }
 
     /**
@@ -83,19 +83,20 @@ public final class PresentRequestRecordComposition extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
         BEREncoding[] enc;
-        if (c_simple != null) {
+        if (simple != null) {
             enc = new BEREncoding[1];
-            enc[0] = c_simple.berEncode();
+            enc[0] = simple.berEncode();
             chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 19, enc);
         }
-        if (c_complex != null) {
+        if (complex != null) {
             if (chosen != null) {
                 throw new ASN1Exception("CHOICE multiply set");
             }
-            chosen = c_complex.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 209);
+            chosen = complex.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 209);
         }
         if (chosen == null) {
             throw new ASN1Exception("CHOICE not set");
@@ -103,28 +104,30 @@ public final class PresentRequestRecordComposition extends ASN1Any {
         return chosen;
     }
 
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
-        throw new ASN1EncodingException("PresentRequest_recordComposition: cannot implicitly tag");
+        throw new ASN1EncodingException("cannot implicitly tag");
     }
 
     /**
      * Returns a new String object containing a text representing
      * of the PresentRequest_recordComposition.
      */
+    @Override
     public String toString() {
         StringBuilder str = new StringBuilder("{");
         boolean found = false;
-        if (c_simple != null) {
+        if (simple != null) {
             found = true;
             str.append("simple ");
-            str.append(c_simple);
+            str.append(simple);
         }
-        if (c_complex != null) {
+        if (complex != null) {
             if (found) {
                 str.append(" ");
             }
             str.append("complex ");
-            str.append(c_complex);
+            str.append(complex);
         }
         str.append("}");
         return str.toString();
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentResponse.java
index 8014aca..6843413 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentResponse.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentResponse.java
@@ -8,7 +8,6 @@ import org.xbib.asn1.ASN1Sequence;
 import org.xbib.asn1.BERConstructed;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a PresentResponse from Z39-50-APDU-1995.
  * 
@@ -25,12 +24,13 @@ import org.xbib.asn1.BEREncoding;
  */
 public final class PresentResponse extends ASN1Any {
 
-    public ReferenceId s_referenceId; // optional
-    public ASN1Integer s_numberOfRecordsReturned;
-    public ASN1Integer s_nextResultSetPosition;
-    public PresentStatus s_presentStatus;
-    public Records s_records; // optional
-    public OtherInformation s_otherInfo; // optional
+    public ReferenceId referenceId; // optional
+    public ASN1Integer numberOfRecordsReturned;
+    public ASN1Integer nextResultSetPosition;
+    public PresentStatus presentStatus;
+    public Records records; // optional
+    public OtherInformation otherInfo; // optional
+
     /**
      * Constructor for a PresentResponse from a BER encoding.
      *
@@ -40,9 +40,7 @@ public final class PresentResponse extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public PresentResponse(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public PresentResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -55,124 +53,92 @@ public final class PresentResponse extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // PresentResponse should be encoded by a constructed BER
-
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("PresentResponse: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
-
         // Prepare to decode the components
-
         int numParts = berConstructed.numberComponents();
         int part = 0;
         BEREncoding p;
-
         // Decoding: referenceId ReferenceId OPTIONAL
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_referenceId = new ReferenceId(p, true);
+            referenceId = new ReferenceId(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_referenceId = null; // no, not present
+            referenceId = null; // no, not present
         }
-
         // Decoding: numberOfRecordsReturned [24] IMPLICIT INTEGER
-
         if (numParts <= part) {
             // End of record, but still more elements to get
             throw new ASN1Exception("PresentResponse: incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() != 24 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("PresentResponse: bad tag in s_numberOfRecordsReturned\n");
+        if (p.getTag() != 24 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_numberOfRecordsReturned");
         }
-
-        s_numberOfRecordsReturned = new ASN1Integer(p, false);
+        numberOfRecordsReturned = new ASN1Integer(p, false);
         part++;
-
         // Decoding: nextResultSetPosition [25] IMPLICIT INTEGER
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        if (p.tagGet() != 25 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("PresentResponse: bad tag in s_nextResultSetPosition\n");
+        if (p.getTag() != 25 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_nextResultSetPosition\n");
         }
-
-        s_nextResultSetPosition = new ASN1Integer(p, false);
+        nextResultSetPosition = new ASN1Integer(p, false);
         part++;
-
         // Decoding: presentStatus PresentStatus
-
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("PresentResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
-
-        s_presentStatus = new PresentStatus(p, true);
+        presentStatus = new PresentStatus(p, true);
         part++;
-
         // Remaining elements are optional, set variables
         // to null (not present) so can return at endStream of BER
-
-        s_records = null;
-        s_otherInfo = null;
-
+        records = null;
+        otherInfo = null;
         // Decoding: records Records OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_records = new Records(p, true);
+            records = new Records(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_records = null; // no, not present
+            records = null; // no, not present
         }
-
         // Decoding: otherInfo OtherInformation OPTIONAL
-
         if (numParts <= part) {
             return; // no more data, but ok (rest is optional)
         }
         p = berConstructed.elementAt(part);
-
         try {
-            s_otherInfo = new OtherInformation(p, true);
+            otherInfo = new OtherInformation(p, true);
             part++; // yes, consumed
         } catch (ASN1Exception e) {
-            s_otherInfo = null; // no, not present
+            otherInfo = null; // no, not present
         }
-
         // Should not be any more parts
-
         if (part < numParts) {
-            throw new ASN1Exception("PresentResponse: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -182,10 +148,8 @@ public final class PresentResponse extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -198,57 +162,40 @@ public final class PresentResponse extends ASN1Any {
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
 
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
-
         int numFields = 3; // number of mandatories
-        if (s_referenceId != null) {
+        if (referenceId != null) {
             numFields++;
         }
-        if (s_records != null) {
+        if (records != null) {
             numFields++;
         }
-        if (s_otherInfo != null) {
+        if (otherInfo != null) {
             numFields++;
         }
-
         // Encode it
-
         BEREncoding fields[] = new BEREncoding[numFields];
         int x = 0;
-
         // Encoding s_referenceId: ReferenceId OPTIONAL
-
-        if (s_referenceId != null) {
-            fields[x++] = s_referenceId.berEncode();
+        if (referenceId != null) {
+            fields[x++] = referenceId.berEncode();
         }
-
         // Encoding s_numberOfRecordsReturned: INTEGER
-
-        fields[x++] = s_numberOfRecordsReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24);
-
+        fields[x++] = numberOfRecordsReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24);
         // Encoding s_nextResultSetPosition: INTEGER
-
-        fields[x++] = s_nextResultSetPosition.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25);
-
+        fields[x++] = nextResultSetPosition.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25);
         // Encoding s_presentStatus: PresentStatus
-
-        fields[x++] = s_presentStatus.berEncode();
-
+        fields[x++] = presentStatus.berEncode();
         // Encoding s_records: Records OPTIONAL
-
-        if (s_records != null) {
-            fields[x++] = s_records.berEncode();
+        if (records != null) {
+            fields[x++] = records.berEncode();
         }
-
         // Encoding s_otherInfo: OtherInformation OPTIONAL
-
-        if (s_otherInfo != null) {
-            fields[x] = s_otherInfo.berEncode();
+        if (otherInfo != null) {
+            fields[x] = otherInfo.berEncode();
         }
-
         return new BERConstructed(tagType, tag, fields);
     }
 
@@ -256,59 +203,49 @@ public final class PresentResponse extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the PresentResponse.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
-
-        if (s_referenceId != null) {
+        if (referenceId != null) {
             str.append("referenceId ");
-            str.append(s_referenceId);
+            str.append(referenceId);
             outputted++;
         }
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("numberOfRecordsReturned ");
-        str.append(s_numberOfRecordsReturned);
+        str.append(numberOfRecordsReturned);
         outputted++;
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("nextResultSetPosition ");
-        str.append(s_nextResultSetPosition);
+        str.append(nextResultSetPosition);
         outputted++;
-
         if (0 < outputted) {
             str.append(", ");
         }
         str.append("presentStatus ");
-        str.append(s_presentStatus);
+        str.append(presentStatus);
         outputted++;
-
-        if (s_records != null) {
+        if (records != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("records ");
-            str.append(s_records);
+            str.append(records);
             outputted++;
         }
-
-        if (s_otherInfo != null) {
+        if (otherInfo != null) {
             if (0 < outputted) {
                 str.append(", ");
             }
             str.append("otherInfo ");
-            str.append(s_otherInfo);
+            str.append(otherInfo);
         }
-
         str.append("}");
-
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentStatus.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentStatus.java
index 906de7f..fe1698e 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentStatus.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/PresentStatus.java
@@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.ASN1Integer;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a PresentStatus from Z39-50-APDU-1995.
  * 
@@ -30,6 +29,7 @@ public final class PresentStatus extends ASN1Any {
     public static final int E_partial_4 = 4;
     public static final int E_failure = 5;
     public ASN1Integer value;
+
     /**
      * Constructor for a PresentStatus from a BER encoding.
      *
@@ -39,9 +39,7 @@ public final class PresentStatus extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public PresentStatus(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public PresentStatus(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -54,11 +52,12 @@ public final class PresentStatus extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
+    @Override
     public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         if (checkTag) {
-            if (ber.tagGet() != 27 ||
-                    ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-                throw new ASN1EncodingException("PresentStatus: bad BER: tag=" + ber.tagGet() + " expected 27\n");
+            if (ber.getTag() != 27 ||
+                    ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+                throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 27");
             }
         }
 
@@ -71,6 +70,7 @@ public final class PresentStatus extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 27);
     }
@@ -83,6 +83,7 @@ public final class PresentStatus extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         return value.berEncode(tagType, tag);
     }
@@ -91,7 +92,7 @@ public final class PresentStatus extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the PresentStatus.
      */
-
+    @Override
     public String toString() {
         return value.toString();
     }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProtocolVersion.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProtocolVersion.java
index 4ac403a..df5326d 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProtocolVersion.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProtocolVersion.java
@@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1EncodingException;
 import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a ProtocolVersion from Z39-50-APDU-1995.
  * 
@@ -15,6 +14,7 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class ProtocolVersion extends ASN1Any { + public ASN1BitString value; /** @@ -32,7 +32,6 @@ public final class ProtocolVersion extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public ProtocolVersion(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -46,13 +45,14 @@ public final class ProtocolVersion extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Check tag matches if (checkTag) { - if (ber.tagGet() != 3 || - ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ProtocolVersion: bad BER: tag=" + ber.tagGet() + " expected 3\n"); + if (ber.getTag() != 3 || + ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("ProtocolVersion: bad BER: tag=" + ber.getTag() + " expected 3\n"); } } @@ -65,6 +65,7 @@ public final class ProtocolVersion extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3); } @@ -77,6 +78,7 @@ public final class ProtocolVersion extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { return value.berEncode(tagType, tag); } @@ -85,8 +87,8 @@ public final class ProtocolVersion extends ASN1Any { * Returns a new String object containing a text representing * of the ProtocolVersion. */ + @Override public String toString() { return value.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperator.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperator.java index 44334b3..d0291f8 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperator.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperator.java @@ -36,6 +36,7 @@ public final class ProximityOperator extends ASN1Any { public ASN1Boolean s_ordered; public ASN1Integer s_relationType; public ProximityOperatorProximityUnitCode s_proximityUnitCode; + /** * Constructor for a ProximityOperator from a BER encoding. * @@ -45,9 +46,7 @@ public final class ProximityOperator extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public ProximityOperator(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public ProximityOperator(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -60,10 +59,8 @@ public final class ProximityOperator extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // ProximityOperator should be encoded by a constructed BER BERConstructed berConstructed; @@ -89,8 +86,8 @@ public final class ProximityOperator extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_exclusion = new ASN1Boolean(p, false); part++; } @@ -103,8 +100,8 @@ public final class ProximityOperator extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("ProximityOperator: bad tag in s_distance\n"); } @@ -120,8 +117,8 @@ public final class ProximityOperator extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 3 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 3 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("ProximityOperator: bad tag in s_ordered\n"); } @@ -137,8 +134,8 @@ public final class ProximityOperator extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 4 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 4 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("ProximityOperator: bad tag in s_relationType\n"); } @@ -154,8 +151,8 @@ public final class ProximityOperator extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 5 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 5 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("ProximityOperator: bad tag in s_proximityUnitCode\n"); } @@ -187,10 +184,8 @@ public final class ProximityOperator extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -202,10 +197,8 @@ public final class ProximityOperator extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 4; // number of mandatories @@ -215,9 +208,9 @@ public final class ProximityOperator extends ASN1Any { // Encode it - BEREncoding fields[] = new BEREncoding[numFields]; + BEREncoding[] fields = new BEREncoding[numFields]; int x = 0; - BEREncoding enc[]; + BEREncoding[] enc; // Encoding s_exclusion: BOOLEAN OPTIONAL @@ -250,9 +243,8 @@ public final class ProximityOperator extends ASN1Any { * Returns a new String object containing a text representing * of the ProximityOperator. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -293,5 +285,4 @@ public final class ProximityOperator extends ASN1Any { return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperatorProximityUnitCode.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperatorProximityUnitCode.java index 4f90a11..1309e53 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperatorProximityUnitCode.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ProximityOperatorProximityUnitCode.java @@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.BEREncoding; - /** * Class for representing a ProximityOperator_proximityUnitCode from Z39-50-APDU-1995. *
@@ -22,7 +21,6 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
     public KnownProximityUnit c_known;
     public ASN1Integer c_private;
 
-
     /**
      * Constructor for a ProximityOperator_proximityUnitCode from a BER encoding.
      *
@@ -32,9 +30,7 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ProximityOperatorProximityUnitCode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ProximityOperatorProximityUnitCode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -47,25 +43,23 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Null out all choices
 
         c_known = null;
         c_private = null;
 
         // Try choice known
-        if (ber.tagGet() == 1 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 1 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_known = new KnownProximityUnit(ber, false);
             return;
         }
 
         // Try choice private
-        if (ber.tagGet() == 2 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 2 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_private = new ASN1Integer(ber, false);
             return;
         }
@@ -79,10 +73,8 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
 
         // Encoding choice: c_known
@@ -120,10 +112,8 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
      * @param tag      the tag.
      * @throws ASN1Exception if it cannot be BER encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // This method must not be called!
 
         // Method is not available because this is a basic CHOICE
@@ -139,9 +129,8 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ProximityOperator_proximityUnitCode.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
 
         boolean found = false;
@@ -165,5 +154,4 @@ public final class ProximityOperatorProximityUnitCode extends ASN1Any {
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Query.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Query.java
index 9c92fb0..0d30730 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Query.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Query.java
@@ -34,9 +34,9 @@ public final class Query extends ASN1Any {
     /**
      * Default constructor for a Query.
      */
-
     public Query() {
     }
+
     /**
      * Constructor for a Query from a BER encoding.
      *
@@ -46,9 +46,7 @@ public final class Query extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public Query(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public Query(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -61,10 +59,8 @@ public final class Query extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         BERConstructed tagwrapper;
 
         // Null out all choices
@@ -77,8 +73,8 @@ public final class Query extends ASN1Any {
         c_type_102 = null;
 
         // Try choice type-0
-        if (ber.tagGet() == 0 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 0 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
@@ -92,15 +88,15 @@ public final class Query extends ASN1Any {
         }
 
         // Try choice type-1
-        if (ber.tagGet() == 1 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 1 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_type_1 = new RPNQuery(ber, false);
             return;
         }
 
         // Try choice type-2
-        if (ber.tagGet() == 2 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 2 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
@@ -116,8 +112,8 @@ public final class Query extends ASN1Any {
         }
 
         // Try choice type-100
-        if (ber.tagGet() == 100 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 100 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
@@ -133,15 +129,15 @@ public final class Query extends ASN1Any {
         }
 
         // Try choice type-101
-        if (ber.tagGet() == 101 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 101 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_type_101 = new RPNQuery(ber, false);
             return;
         }
 
         // Try choice type-102
-        if (ber.tagGet() == 102 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 102 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagwrapper = (BERConstructed) ber;
             } catch (ClassCastException e) {
@@ -155,7 +151,6 @@ public final class Query extends ASN1Any {
             c_type_102 = new ASN1OctetString(tagwrapper.elementAt(0), true);
             return;
         }
-
         throw new ASN1Exception("Query: bad BER encoding: choice not matched");
     }
 
@@ -165,10 +160,8 @@ public final class Query extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
 
         BEREncoding enc[];
@@ -248,10 +241,8 @@ public final class Query extends ASN1Any {
      * @param tag      the tag.
      * @throws ASN1Exception if it cannot be BER encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // This method must not be called!
 
         // Method is not available because this is a basic CHOICE
@@ -260,16 +251,15 @@ public final class Query extends ASN1Any {
         // tag on it, otherwise the tag identifying which CHOICE
         // it is will be overwritten and lost.
 
-        throw new ASN1EncodingException("Query: cannot implicitly tag");
+        throw new ASN1EncodingException("cannot implicitly tag");
     }
 
     /**
      * Returns a new String object containing a text representing
      * of the Query.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
 
         boolean found = false;
@@ -326,8 +316,6 @@ public final class Query extends ASN1Any {
         }
 
         str.append("}");
-
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNQuery.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNQuery.java
index fbfeb84..ed9cb49 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNQuery.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNQuery.java
@@ -18,8 +18,9 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class RPNQuery extends ASN1Any { - public AttributeSetId s_attributeSet; - public RPNStructure s_rpn; + + public AttributeSetId attributeSet; + public RPNStructure rpn; /** * Default constructor for a RPNQuery. @@ -49,31 +50,31 @@ public final class RPNQuery extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("RPNQuery: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("RPNQuery: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - s_attributeSet = new AttributeSetId(p, true); + attributeSet = new AttributeSetId(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("RPNQuery: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - s_rpn = new RPNStructure(p, true); + rpn = new RPNStructure(p, true); part++; if (part < numParts) { - throw new ASN1Exception("RPNQuery: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -83,6 +84,7 @@ public final class RPNQuery extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -95,12 +97,13 @@ public final class RPNQuery extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; - fields[x++] = s_attributeSet.berEncode(); - fields[x] = s_rpn.berEncode(); + fields[x++] = attributeSet.berEncode(); + fields[x] = rpn.berEncode(); return new BERConstructed(tagType, tag, fields); } @@ -108,18 +111,18 @@ public final class RPNQuery extends ASN1Any { * Returns a new String object containing a text representing * of the RPNQuery. */ - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("attributeSet "); - str.append(s_attributeSet); + str.append(attributeSet); outputted++; if (0 < outputted) { str.append(", "); } str.append("rpn "); - str.append(s_rpn); + str.append(rpn); str.append("}"); return str.toString(); } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructure.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructure.java index c640586..cd0abc6 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructure.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructure.java @@ -49,12 +49,13 @@ public final class RPNStructure extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed tagwrapper; c_op = null; c_rpnRpnOp = null; - if (ber.tagGet() == 0 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 0 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { @@ -68,8 +69,8 @@ public final class RPNStructure extends ASN1Any { c_op = new Operand(tagwrapper.elementAt(0), true); return; } - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_rpnRpnOp = new RPNStructureRpnRpnOp(ber, false); return; } @@ -82,6 +83,7 @@ public final class RPNStructure extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; @@ -123,6 +125,7 @@ public final class RPNStructure extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! @@ -139,6 +142,7 @@ public final class RPNStructure extends ASN1Any { * Returns a new String object containing a text representing * of the RPNStructure. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; @@ -157,5 +161,4 @@ public final class RPNStructure extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructureRpnRpnOp.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructureRpnRpnOp.java index 23a11b3..7fe551b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructureRpnRpnOp.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/RPNStructureRpnRpnOp.java @@ -24,11 +24,9 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { public RPNStructure s_rpn2; public Operator s_op; - /** * Default constructor for a RPNStructure_rpnRpnOp. */ - public RPNStructureRpnRpnOp() { } @@ -41,9 +39,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public RPNStructureRpnRpnOp(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public RPNStructureRpnRpnOp(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -56,17 +52,15 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // RPNStructure_rpnRpnOp should be encoded by a constructed BER BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("RPNStructure_rpnRpnOp: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -79,7 +73,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("RPNStructure_rpnRpnOp: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -90,7 +84,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("RPNStructure_rpnRpnOp: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -101,7 +95,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("RPNStructure_rpnRpnOp: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -111,7 +105,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception(" RPNStructure_rpnRpnOp: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -121,7 +115,7 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -134,17 +128,15 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 3; // number of mandatories // Encode it - BEREncoding fields[] = new BEREncoding[numFields]; + BEREncoding[] fields = new BEREncoding[numFields]; int x = 0; // Encoding s_rpn1: RPNStructure @@ -166,9 +158,8 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { * Returns a new String object containing a text representing * of the RPNStructure_rpnRpnOp. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -193,5 +184,4 @@ public final class RPNStructureRpnRpnOp extends ASN1Any { return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Range.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Range.java index f1f63cb..259b5f5 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Range.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Range.java @@ -8,7 +8,6 @@ import org.xbib.asn1.ASN1Sequence; import org.xbib.asn1.BERConstructed; import org.xbib.asn1.BEREncoding; - /** * Class for representing a Range from Z39-50-APDU-1995. *
@@ -20,10 +19,10 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class Range extends ASN1Any { + public ASN1Integer s_startingPosition; public ASN1Integer s_numberOfRecords; - /** * Constructor for a Range from a BER encoding. * @@ -33,7 +32,6 @@ public final class Range extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public Range(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); @@ -48,10 +46,8 @@ public final class Range extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Range should be encoded by a constructed BER BERConstructed berConstructed; @@ -76,8 +72,8 @@ public final class Range extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("Range: bad tag in s_startingPosition\n"); } @@ -92,8 +88,8 @@ public final class Range extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException("Range: bad tag in s_numberOfRecords\n"); } @@ -113,10 +109,8 @@ public final class Range extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -128,10 +122,8 @@ public final class Range extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 2; // number of mandatories @@ -147,7 +139,7 @@ public final class Range extends ASN1Any { // Encoding s_numberOfRecords: INTEGER - fields[x++] = s_numberOfRecords.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2); + fields[x] = s_numberOfRecords.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2); return new BERConstructed(tagType, tag, fields); } @@ -156,9 +148,8 @@ public final class Range extends ASN1Any { * Returns a new String object containing a text representing * of the Range. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -173,8 +164,6 @@ public final class Range extends ASN1Any { str.append(s_numberOfRecords); str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Records.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Records.java index 95c3c54..3387bb1 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Records.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Records.java @@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.BERConstructed; import org.xbib.asn1.BEREncoding; - /** * Class for representing a Records from Z39-50-APDU-1995. *
@@ -19,11 +18,11 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class Records extends ASN1Any { + public NamePlusRecord c_responseRecords[]; public DefaultDiagFormat c_nonSurrogateDiagnostic; public DiagRec c_multipleNonSurDiagnostics[]; - /** * Constructor for a Records from a BER encoding. * @@ -33,9 +32,7 @@ public final class Records extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Records(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Records(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -48,19 +45,16 @@ public final class Records extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices - c_responseRecords = null; c_nonSurrogateDiagnostic = null; c_multipleNonSurDiagnostics = null; // Try choice responseRecords - if (ber.tagGet() == 28 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 28 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { BEREncoding ber_data; ber_data = ber; BERConstructed berConstructed; @@ -83,15 +77,15 @@ public final class Records extends ASN1Any { } // Try choice nonSurrogateDiagnostic - if (ber.tagGet() == 130 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 130 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_nonSurrogateDiagnostic = new DefaultDiagFormat(ber, false); return; } // Try choice multipleNonSurDiagnostics - if (ber.tagGet() == 205 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 205 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { BEREncoding ber_data; ber_data = ber; BERConstructed berConstructed; @@ -112,7 +106,6 @@ public final class Records extends ASN1Any { } return; } - throw new ASN1Exception("Records: bad BER encoding: choice not matched"); } @@ -122,10 +115,8 @@ public final class Records extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; BEREncoding f2[]; @@ -167,7 +158,6 @@ public final class Records extends ASN1Any { if (chosen == null) { throw new ASN1Exception("CHOICE not set"); } - return chosen; } @@ -185,10 +175,8 @@ public final class Records extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -204,9 +192,8 @@ public final class Records extends ASN1Any { * Returns a new String object containing a text representing * of the Records. */ - - public String - toString() { + @Override + public String toString() { int p; StringBuilder str = new StringBuilder("{"); boolean found = false; @@ -240,10 +227,7 @@ public final class Records extends ASN1Any { } str.append("}"); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ReferenceId.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ReferenceId.java index cc773fc..b6cfb46 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ReferenceId.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ReferenceId.java @@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.ASN1OctetString; import org.xbib.asn1.BEREncoding; - /** * Class for representing a ReferenceId from Z39-50-APDU-1995. *
@@ -25,7 +24,6 @@ public final class ReferenceId extends ASN1Any {
     public ReferenceId() {
     }
 
-
     /**
      * Constructor for a ReferenceId from a BER encoding.
      *
@@ -35,9 +33,7 @@ public final class ReferenceId extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ReferenceId(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ReferenceId(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -50,17 +46,15 @@ public final class ReferenceId extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Check tag matches
 
         if (checkTag) {
-            if (ber.tagGet() != 2 ||
-                    ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            if (ber.getTag() != 2 ||
+                    ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
                 throw new ASN1EncodingException
-                        ("ReferenceId: bad BER: tag=" + ber.tagGet() + " expected 2\n");
+                        ("ReferenceId: bad BER: tag=" + ber.getTag() + " expected 2\n");
             }
         }
 
@@ -73,10 +67,8 @@ public final class ReferenceId extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2);
     }
 
@@ -88,26 +80,17 @@ public final class ReferenceId extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         return value.berEncode(tagType, tag);
     }
 
-
-/*
- * Internal variables for class.
- */
-
     /**
      * Returns a new String object containing a text representing
      * of the ReferenceId.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         return value.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlRequest.java
index 45893a6..32f8140 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlRequest.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlRequest.java
@@ -37,12 +37,13 @@ public final class ResourceControlRequest extends ASN1Any {
     public ASN1Boolean s_responseRequired;
     public ASN1Boolean s_triggeredRequestFlag; // optional
     public OtherInformation s_otherInfo; // optional
+
     /**
      * Default constructor for a ResourceControlRequest.
      */
-
     public ResourceControlRequest() {
     }
+
     /**
      * Constructor for a ResourceControlRequest from a BER encoding.
      *
@@ -52,9 +53,7 @@ public final class ResourceControlRequest extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResourceControlRequest(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResourceControlRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -67,18 +66,15 @@ public final class ResourceControlRequest extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // ResourceControlRequest should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("ResourceControlRequest: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -92,7 +88,7 @@ public final class ResourceControlRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
@@ -107,12 +103,12 @@ public final class ResourceControlRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 39 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 39 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_suspendedFlag = new ASN1Boolean(p, false);
             part++;
         }
@@ -121,23 +117,20 @@ public final class ResourceControlRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 40 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 40 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagged = (BERConstructed) p;
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException
-                        ("ResourceControlRequest: bad BER encoding: s_resourceReport tag bad\n");
+                throw new ASN1EncodingException("bad BER encoding: s_resourceReport tag bad");
             }
             if (tagged.numberComponents() != 1) {
-                throw new ASN1EncodingException
-                        ("ResourceControlRequest: bad BER encoding: s_resourceReport tag bad\n");
+                throw new ASN1EncodingException("bad BER encoding: s_resourceReport tag bad");
             }
-
             s_resourceReport = new ResourceReport(tagged.elementAt(0), true);
             part++;
         }
@@ -146,12 +139,12 @@ public final class ResourceControlRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 41 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 41 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_partialResultsAvailable = new ASN1Integer(p, false);
             part++;
         }
@@ -160,14 +153,13 @@ public final class ResourceControlRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 42 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("ResourceControlRequest: bad tag in s_responseRequired\n");
+        if (p.getTag() != 42 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_responseRequired");
         }
 
         s_responseRequired = new ASN1Boolean(p, false);
@@ -186,8 +178,8 @@ public final class ResourceControlRequest extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 43 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 43 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_triggeredRequestFlag = new ASN1Boolean(p, false);
             part++;
         }
@@ -209,7 +201,7 @@ public final class ResourceControlRequest extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("ResourceControlRequest: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -219,10 +211,8 @@ public final class ResourceControlRequest extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -234,10 +224,8 @@ public final class ResourceControlRequest extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
         int numFields = 1; // number of mandatories
@@ -315,9 +303,8 @@ public final class ResourceControlRequest extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResourceControlRequest.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
 
@@ -376,12 +363,8 @@ public final class ResourceControlRequest extends ASN1Any {
             }
             str.append("otherInfo ");
             str.append(s_otherInfo);
-            outputted++;
         }
-
         str.append("}");
-
         return str.toString();
     }
-
-}
\ No newline at end of file
+}
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlResponse.java
index dac71de..9cae7da 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlResponse.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceControlResponse.java
@@ -30,7 +30,6 @@ public final class ResourceControlResponse extends ASN1Any {
     /**
      * Default constructor for a ResourceControlResponse.
      */
-
     public ResourceControlResponse() {
     }
 
@@ -43,9 +42,7 @@ public final class ResourceControlResponse extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResourceControlResponse(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResourceControlResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -58,17 +55,15 @@ public final class ResourceControlResponse extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // ResourceControlResponse should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("ResourceControlResponse: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -81,7 +76,7 @@ public final class ResourceControlResponse extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
@@ -96,13 +91,13 @@ public final class ResourceControlResponse extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("ResourceControlResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 44 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException("ResourceControlResponse: bad tag in s_continueFlag\n");
+        if (p.getTag() != 44 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in continueFlag");
         }
 
         s_continueFlag = new ASN1Boolean(p, false);
@@ -121,8 +116,8 @@ public final class ResourceControlResponse extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 45 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 45 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_resultSetWanted = new ASN1Boolean(p, false);
             part++;
         }
@@ -144,7 +139,7 @@ public final class ResourceControlResponse extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("ResourceControlResponse: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -154,10 +149,8 @@ public final class ResourceControlResponse extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -169,6 +162,7 @@ public final class ResourceControlResponse extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
@@ -217,9 +211,8 @@ public final class ResourceControlResponse extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResourceControlResponse.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
 
@@ -254,8 +247,6 @@ public final class ResourceControlResponse extends ASN1Any {
         }
 
         str.append("}");
-
         return str.toString();
     }
-
-}
\ No newline at end of file
+}
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReport.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReport.java
index 7170038..ad11db4 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReport.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReport.java
@@ -25,9 +25,7 @@ public final class ResourceReport extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResourceReport(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResourceReport(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -40,8 +38,8 @@ public final class ResourceReport extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-    public void berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         value = new ASN1External(ber, checkTag);
     }
 
@@ -51,6 +49,7 @@ public final class ResourceReport extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode() throws ASN1Exception {
         return value.berEncode();
     }
@@ -63,6 +62,7 @@ public final class ResourceReport extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         return value.berEncode(tagType, tag);
     }
@@ -71,9 +71,8 @@ public final class ResourceReport extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResourceReport.
      */
-
+    @Override
     public String toString() {
         return value.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportId.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportId.java
index 2b872c7..79aa526 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportId.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportId.java
@@ -5,7 +5,6 @@ import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.ASN1ObjectIdentifier;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a ResourceReportId from Z39-50-APDU-1995.
  * 
@@ -17,7 +16,6 @@ public final class ResourceReportId extends ASN1Any {
 
     public ASN1ObjectIdentifier value;
 
-
     /**
      * Constructor for a ResourceReportId from a BER encoding.
      *
@@ -27,7 +25,6 @@ public final class ResourceReportId extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
     public ResourceReportId(BEREncoding ber, boolean checkTag)
             throws ASN1Exception {
         super(ber, checkTag);
@@ -42,10 +39,8 @@ public final class ResourceReportId extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         value = new ASN1ObjectIdentifier(ber, checkTag);
     }
 
@@ -55,10 +50,8 @@ public final class ResourceReportId extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return value.berEncode();
     }
 
@@ -70,7 +63,7 @@ public final class ResourceReportId extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         return value.berEncode(tagType, tag);
     }
@@ -79,8 +72,8 @@ public final class ResourceReportId extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResourceReportId.
      */
+    @Override
     public String toString() {
         return value.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportRequest.java
index cfeb60e..01848c0 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportRequest.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportRequest.java
@@ -26,7 +26,6 @@ public final class ResourceReportRequest extends ASN1Any {
     public ResourceReportId s_prefResourceReportFormat; // optional
     public OtherInformation s_otherInfo; // optional
 
-
     /**
      * Constructor for a ResourceReportRequest from a BER encoding.
      *
@@ -36,9 +35,7 @@ public final class ResourceReportRequest extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResourceReportRequest(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResourceReportRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -51,17 +48,15 @@ public final class ResourceReportRequest extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // ResourceReportRequest should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("ResourceReportRequest: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -99,8 +94,8 @@ public final class ResourceReportRequest extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 210 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 210 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_opId = new ReferenceId(p, false);
             part++;
         }
@@ -112,8 +107,8 @@ public final class ResourceReportRequest extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 49 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 49 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_prefResourceReportFormat = new ResourceReportId(p, false);
             part++;
         }
@@ -135,7 +130,7 @@ public final class ResourceReportRequest extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("ResourceReportRequest: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -145,10 +140,8 @@ public final class ResourceReportRequest extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -160,10 +153,8 @@ public final class ResourceReportRequest extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
         int numFields = 0; // number of mandatories
@@ -206,7 +197,7 @@ public final class ResourceReportRequest extends ASN1Any {
         // Encoding s_otherInfo: OtherInformation OPTIONAL
 
         if (s_otherInfo != null) {
-            fields[x++] = s_otherInfo.berEncode();
+            fields[x] = s_otherInfo.berEncode();
         }
 
         return new BERConstructed(tagType, tag, fields);
@@ -216,9 +207,8 @@ public final class ResourceReportRequest extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResourceReportRequest.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
 
@@ -258,5 +248,4 @@ public final class ResourceReportRequest extends ASN1Any {
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportResponse.java
index 0b1d2a9..cdfc8a6 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportResponse.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResourceReportResponse.java
@@ -35,12 +35,13 @@ public final class ResourceReportResponse extends ASN1Any {
     public ASN1Integer s_resourceReportStatus;
     public ResourceReport s_resourceReport; // optional
     public OtherInformation s_otherInfo; // optional
+
     /**
      * Default constructor for a ResourceReportResponse.
      */
-
     public ResourceReportResponse() {
     }
+
     /**
      * Constructor for a ResourceReportResponse from a BER encoding.
      *
@@ -50,9 +51,7 @@ public final class ResourceReportResponse extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResourceReportResponse(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResourceReportResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -65,6 +64,7 @@ public final class ResourceReportResponse extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
+    @Override
     public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // ResourceReportResponse should be encoded by a constructed BER
 
@@ -105,8 +105,8 @@ public final class ResourceReportResponse extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 50 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() != 50 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
             throw new ASN1EncodingException("ResourceReportResponse: bad tag in s_resourceReportStatus\n");
         }
 
@@ -126,8 +126,8 @@ public final class ResourceReportResponse extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 51 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 51 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagged = (BERConstructed) p;
             } catch (ClassCastException e) {
@@ -168,6 +168,7 @@ public final class ResourceReportResponse extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
@@ -180,6 +181,7 @@ public final class ResourceReportResponse extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
@@ -196,9 +198,9 @@ public final class ResourceReportResponse extends ASN1Any {
 
         // Encode it
 
-        BEREncoding fields[] = new BEREncoding[numFields];
+        BEREncoding[] fields = new BEREncoding[numFields];
         int x = 0;
-        BEREncoding enc[];
+        BEREncoding[] enc;
 
         // Encoding s_referenceId: ReferenceId OPTIONAL
 
@@ -227,6 +229,7 @@ public final class ResourceReportResponse extends ASN1Any {
         return new BERConstructed(tagType, tag, fields);
     }
 
+    @Override
     public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
@@ -262,8 +265,6 @@ public final class ResourceReportResponse extends ASN1Any {
         }
 
         str.append("}");
-
         return str.toString();
     }
-
-}
\ No newline at end of file
+}
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetId.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetId.java
index 206414d..e2b2679 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetId.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetId.java
@@ -22,7 +22,6 @@ public final class ResultSetId extends ASN1Any {
     public ResultSetId() {
     }
 
-
     /**
      * Constructor for a ResultSetId from a BER encoding.
      *
@@ -32,9 +31,7 @@ public final class ResultSetId extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public ResultSetId(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public ResultSetId(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -47,17 +44,15 @@ public final class ResultSetId extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Check tag matches
 
         if (checkTag) {
-            if (ber.tagGet() != 31 ||
-                    ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            if (ber.getTag() != 31 ||
+                    ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
                 throw new ASN1EncodingException
-                        ("ResultSetId: bad BER: tag=" + ber.tagGet() + " expected 31\n");
+                        ("ResultSetId: bad BER: tag=" + ber.getTag() + " expected 31\n");
             }
         }
 
@@ -70,10 +65,8 @@ public final class ResultSetId extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 31);
     }
 
@@ -85,6 +78,7 @@ public final class ResultSetId extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         return value.berEncode(tagType, tag);
     }
@@ -93,8 +87,8 @@ public final class ResultSetId extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResultSetId.
      */
+    @Override
     public String toString() {
         return value.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetPlusAttributes.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetPlusAttributes.java
index 5e2c058..584ad9f 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetPlusAttributes.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ResultSetPlusAttributes.java
@@ -43,36 +43,37 @@ public final class ResultSetPlusAttributes extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
+    @Override
     public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         if (checkTag) {
-            if (ber.tagGet() != 214 ||
-                    ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-                throw new ASN1EncodingException("ResultSetPlusAttributes: bad BER: tag=" + ber.tagGet() + " expected 214\n");
+            if (ber.getTag() != 214 ||
+                    ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+                throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 214");
             }
         }
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("ResultSetPlusAttributes: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
         int numParts = berConstructed.numberComponents();
         int part = 0;
         BEREncoding p;
         if (numParts <= part) {
-            throw new ASN1Exception("ResultSetPlusAttributes: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
         s_resultSet = new ResultSetId(p, true);
         part++;
         if (numParts <= part) {
-            throw new ASN1Exception("ResultSetPlusAttributes: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
         s_attributes = new AttributeList(p, true);
         part++;
         if (part < numParts) {
-            throw new ASN1Exception("ResultSetPlusAttributes: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -82,6 +83,7 @@ public final class ResultSetPlusAttributes extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 214);
     }
@@ -94,6 +96,7 @@ public final class ResultSetPlusAttributes extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         int numFields = 2;
         BEREncoding fields[] = new BEREncoding[numFields];
@@ -107,6 +110,7 @@ public final class ResultSetPlusAttributes extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the ResultSetPlusAttributes.
      */
+    @Override
     public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanRequest.java
index 6f67c07..471070c 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanRequest.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanRequest.java
@@ -26,14 +26,18 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class ScanRequest extends ASN1Any { - public ReferenceId s_referenceId; // optional - public DatabaseName s_databaseNames[]; - public AttributeSetId s_attributeSet; // optional - public AttributesPlusTerm s_termListAndStartPoint; - public ASN1Integer s_stepSize; // optional - public ASN1Integer s_numberOfTermsRequested; - public ASN1Integer s_preferredPositionInResponse; // optional - public OtherInformation s_otherInfo; // optional + public ReferenceId referenceId; // optional + public DatabaseName[] databaseNames; + public AttributeSetId attributeSet; // optional + public AttributesPlusTerm termListAndStartPoint; + public ASN1Integer stepSize; // optional + public ASN1Integer numberOfTermsRequested; + public ASN1Integer preferredPositionInResponse; // optional + public OtherInformation otherInfo; // optional + + public ScanRequest() { + } + /** * Constructor for a ScanRequest from a BER encoding. * @@ -56,12 +60,13 @@ public final class ScanRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("ScanRequest: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; @@ -71,76 +76,75 @@ public final class ScanRequest extends ASN1Any { } p = berConstructed.elementAt(part); try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } if (numParts <= part) { throw new ASN1Exception("ScanRequest: incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 3 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ScanRequest: bad tag in s_databaseNames\n"); + if (p.getTag() != 3 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_databaseNames"); } try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); - s_databaseNames = new DatabaseName[parts]; + databaseNames = new DatabaseName[parts]; int n; for (n = 0; n < parts; n++) { - s_databaseNames[n] = new DatabaseName(cons.elementAt(n), true); + databaseNames[n] = new DatabaseName(cons.elementAt(n), true); } } catch (ClassCastException e) { - throw new ASN1EncodingException("Bad BER"); + throw new ASN1EncodingException("bad BER"); } part++; if (numParts <= part) { - throw new ASN1Exception("ScanRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { - s_attributeSet = new AttributeSetId(p, true); + attributeSet = new AttributeSetId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_attributeSet = null; // no, not present + attributeSet = null; // no, not present } if (numParts <= part) { - throw new ASN1Exception("ScanRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - s_termListAndStartPoint = new AttributesPlusTerm(p, true); + termListAndStartPoint = new AttributesPlusTerm(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("ScanRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 5 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_stepSize = new ASN1Integer(p, false); + if (p.getTag() == 5 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + stepSize = new ASN1Integer(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("ScanRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 6 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException - ("ScanRequest: bad tag in s_numberOfTermsRequested\n"); + if (p.getTag() != 6 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_numberOfTermsRequested"); } - s_numberOfTermsRequested = new ASN1Integer(p, false); + numberOfTermsRequested = new ASN1Integer(p, false); part++; - s_preferredPositionInResponse = null; - s_otherInfo = null; + preferredPositionInResponse = null; + otherInfo = null; if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 7 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_preferredPositionInResponse = new ASN1Integer(p, false); + if (p.getTag() == 7 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + preferredPositionInResponse = new ASN1Integer(p, false); part++; } if (numParts <= part) { @@ -148,13 +152,13 @@ public final class ScanRequest extends ASN1Any { } p = berConstructed.elementAt(part); try { - s_otherInfo = new OtherInformation(p, true); + otherInfo = new OtherInformation(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_otherInfo = null; // no, not present + otherInfo = null; // no, not present } if (part < numParts) { - throw new ASN1Exception("ScanRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -164,6 +168,7 @@ public final class ScanRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -176,48 +181,49 @@ public final class ScanRequest extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 3; - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } - if (s_attributeSet != null) { + if (attributeSet != null) { numFields++; } - if (s_stepSize != null) { + if (stepSize != null) { numFields++; } - if (s_preferredPositionInResponse != null) { + if (preferredPositionInResponse != null) { numFields++; } - if (s_otherInfo != null) { + if (otherInfo != null) { numFields++; } BEREncoding fields[] = new BEREncoding[numFields]; int x = 0; BEREncoding f2[]; int p; - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } - f2 = new BEREncoding[s_databaseNames.length]; - for (p = 0; p < s_databaseNames.length; p++) { - f2[p] = s_databaseNames[p].berEncode(); + f2 = new BEREncoding[databaseNames.length]; + for (p = 0; p < databaseNames.length; p++) { + f2[p] = databaseNames[p].berEncode(); } fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, f2); - if (s_attributeSet != null) { - fields[x++] = s_attributeSet.berEncode(); + if (attributeSet != null) { + fields[x++] = attributeSet.berEncode(); } - fields[x++] = s_termListAndStartPoint.berEncode(); - if (s_stepSize != null) { - fields[x++] = s_stepSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); + fields[x++] = termListAndStartPoint.berEncode(); + if (stepSize != null) { + fields[x++] = stepSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); } - fields[x++] = s_numberOfTermsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); - if (s_preferredPositionInResponse != null) { - fields[x++] = s_preferredPositionInResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 7); + fields[x++] = numberOfTermsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); + if (preferredPositionInResponse != null) { + fields[x++] = preferredPositionInResponse.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 7); } - if (s_otherInfo != null) { - fields[x] = s_otherInfo.berEncode(); + if (otherInfo != null) { + fields[x] = otherInfo.berEncode(); } return new BERConstructed(tagType, tag, fields); } @@ -226,13 +232,14 @@ public final class ScanRequest extends ASN1Any { * Returns a new String object containing a text representing * of the ScanRequest. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } if (0 < outputted) { @@ -240,56 +247,56 @@ public final class ScanRequest extends ASN1Any { } str.append("databaseNames "); str.append("{"); - for (p = 0; p < s_databaseNames.length; p++) { + for (p = 0; p < databaseNames.length; p++) { if (p != 0) { str.append(", "); } - str.append(s_databaseNames[p]); + str.append(databaseNames[p]); } str.append("}"); outputted++; - if (s_attributeSet != null) { + if (attributeSet != null) { if (0 < outputted) { str.append(", "); } str.append("attributeSet "); - str.append(s_attributeSet); + str.append(attributeSet); outputted++; } if (0 < outputted) { str.append(", "); } str.append("termListAndStartPoint "); - str.append(s_termListAndStartPoint); + str.append(termListAndStartPoint); outputted++; - if (s_stepSize != null) { + if (stepSize != null) { if (0 < outputted) { str.append(", "); } str.append("stepSize "); - str.append(s_stepSize); + str.append(stepSize); outputted++; } if (0 < outputted) { str.append(", "); } str.append("numberOfTermsRequested "); - str.append(s_numberOfTermsRequested); + str.append(numberOfTermsRequested); outputted++; - if (s_preferredPositionInResponse != null) { + if (preferredPositionInResponse != null) { if (0 < outputted) { str.append(", "); } str.append("preferredPositionInResponse "); - str.append(s_preferredPositionInResponse); + str.append(preferredPositionInResponse); outputted++; } - if (s_otherInfo != null) { + if (otherInfo != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(s_otherInfo); + str.append(otherInfo); } str.append("}"); return str.toString(); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanResponse.java index 24bc841..81f890a 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/ScanResponse.java @@ -35,14 +35,15 @@ public final class ScanResponse extends ASN1Any { public static final int E_partial_4 = 4; public static final int E_partial_5 = 5; public static final int E_failure = 6; - public ReferenceId s_referenceId; // optional - public ASN1Integer s_stepSize; // optional - public ASN1Integer s_scanStatus; - public ASN1Integer s_numberOfEntriesReturned; - public ASN1Integer s_positionOfTerm; // optional - public ListEntries s_entries; // optional - public AttributeSetId s_attributeSet; // optional - public OtherInformation s_otherInfo; // optional + public ReferenceId referenceId; // optional + public ASN1Integer stepSize; // optional + public ASN1Integer scanStatus; + public ASN1Integer numberOfEntriesReturned; + public ASN1Integer positionOfTerm; // optional + public ListEntries entries; // optional + public AttributeSetId attributeSet; // optional + public OtherInformation otherInfo; // optional + /** * Constructor for a ScanResponse from a BER encoding. * @@ -52,9 +53,7 @@ public final class ScanResponse extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public ScanResponse(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public ScanResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -67,6 +66,7 @@ public final class ScanResponse extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // ScanResponse should be encoded by a constructed BER @@ -74,7 +74,7 @@ public final class ScanResponse extends ASN1Any { try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("ScanResponse: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -87,28 +87,28 @@ public final class ScanResponse extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ScanResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } // Decoding: stepSize [3] IMPLICIT INTEGER OPTIONAL if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ScanResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_stepSize = new ASN1Integer(p, false); + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + stepSize = new ASN1Integer(p, false); part++; } @@ -116,41 +116,41 @@ public final class ScanResponse extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ScanResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 4 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ScanResponse: bad tag in s_scanStatus\n"); + if (p.getTag() != 4 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in scanStatus"); } - s_scanStatus = new ASN1Integer(p, false); + scanStatus = new ASN1Integer(p, false); part++; // Decoding: numberOfEntriesReturned [5] IMPLICIT INTEGER if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("ScanResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 5 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("ScanResponse: bad tag in s_numberOfEntriesReturned\n"); + if (p.getTag() != 5 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in numberOfEntriesReturned"); } - s_numberOfEntriesReturned = new ASN1Integer(p, false); + numberOfEntriesReturned = new ASN1Integer(p, false); part++; // Remaining elements are optional, set variables // to null (not present) so can return at endStream of BER - s_positionOfTerm = null; - s_entries = null; - s_attributeSet = null; - s_otherInfo = null; + positionOfTerm = null; + entries = null; + attributeSet = null; + otherInfo = null; // Decoding: positionOfTerm [6] IMPLICIT INTEGER OPTIONAL @@ -159,9 +159,9 @@ public final class ScanResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 6 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_positionOfTerm = new ASN1Integer(p, false); + if (p.getTag() == 6 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + positionOfTerm = new ASN1Integer(p, false); part++; } @@ -172,9 +172,9 @@ public final class ScanResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 7 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_entries = new ListEntries(p, false); + if (p.getTag() == 7 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + entries = new ListEntries(p, false); part++; } @@ -185,9 +185,9 @@ public final class ScanResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 8 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_attributeSet = new AttributeSetId(p, false); + if (p.getTag() == 8 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + attributeSet = new AttributeSetId(p, false); part++; } @@ -199,16 +199,16 @@ public final class ScanResponse extends ASN1Any { p = berConstructed.elementAt(part); try { - s_otherInfo = new OtherInformation(p, true); + otherInfo = new OtherInformation(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_otherInfo = null; // no, not present + otherInfo = null; // no, not present } // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("ScanResponse: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -218,6 +218,7 @@ public final class ScanResponse extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -230,26 +231,27 @@ public final class ScanResponse extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 2; // number of mandatories - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } - if (s_stepSize != null) { + if (stepSize != null) { numFields++; } - if (s_positionOfTerm != null) { + if (positionOfTerm != null) { numFields++; } - if (s_entries != null) { + if (entries != null) { numFields++; } - if (s_attributeSet != null) { + if (attributeSet != null) { numFields++; } - if (s_otherInfo != null) { + if (otherInfo != null) { numFields++; } @@ -260,46 +262,46 @@ public final class ScanResponse extends ASN1Any { // Encoding s_referenceId: ReferenceId OPTIONAL - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } // Encoding s_stepSize: INTEGER OPTIONAL - if (s_stepSize != null) { - fields[x++] = s_stepSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3); + if (stepSize != null) { + fields[x++] = stepSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3); } // Encoding s_scanStatus: INTEGER - fields[x++] = s_scanStatus.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4); + fields[x++] = scanStatus.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4); // Encoding s_numberOfEntriesReturned: INTEGER - fields[x++] = s_numberOfEntriesReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); + fields[x++] = numberOfEntriesReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5); // Encoding s_positionOfTerm: INTEGER OPTIONAL - if (s_positionOfTerm != null) { - fields[x++] = s_positionOfTerm.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); + if (positionOfTerm != null) { + fields[x++] = positionOfTerm.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6); } // Encoding s_entries: ListEntries OPTIONAL - if (s_entries != null) { - fields[x++] = s_entries.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 7); + if (entries != null) { + fields[x++] = entries.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 7); } // Encoding s_attributeSet: AttributeSetId OPTIONAL - if (s_attributeSet != null) { - fields[x++] = s_attributeSet.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 8); + if (attributeSet != null) { + fields[x++] = attributeSet.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 8); } // Encoding s_otherInfo: OtherInformation OPTIONAL - if (s_otherInfo != null) { - fields[x] = s_otherInfo.berEncode(); + if (otherInfo != null) { + fields[x] = otherInfo.berEncode(); } return new BERConstructed(tagType, tag, fields); @@ -309,23 +311,23 @@ public final class ScanResponse extends ASN1Any { * Returns a new String object containing a text representing * of the ScanResponse. */ - + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } - if (s_stepSize != null) { + if (stepSize != null) { if (0 < outputted) { str.append(", "); } str.append("stepSize "); - str.append(s_stepSize); + str.append(stepSize); outputted++; } @@ -333,54 +335,53 @@ public final class ScanResponse extends ASN1Any { str.append(", "); } str.append("scanStatus "); - str.append(s_scanStatus); + str.append(scanStatus); outputted++; if (0 < outputted) { str.append(", "); } str.append("numberOfEntriesReturned "); - str.append(s_numberOfEntriesReturned); + str.append(numberOfEntriesReturned); outputted++; - if (s_positionOfTerm != null) { + if (positionOfTerm != null) { if (0 < outputted) { str.append(", "); } str.append("positionOfTerm "); - str.append(s_positionOfTerm); + str.append(positionOfTerm); outputted++; } - if (s_entries != null) { + if (entries != null) { if (0 < outputted) { str.append(", "); } str.append("entries "); - str.append(s_entries); + str.append(entries); outputted++; } - if (s_attributeSet != null) { + if (attributeSet != null) { if (0 < outputted) { str.append(", "); } str.append("attributeSet "); - str.append(s_attributeSet); + str.append(attributeSet); outputted++; } - if (s_otherInfo != null) { + if (otherInfo != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(s_otherInfo); + str.append(otherInfo); } str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchRequest.java index 696b34b..950a54a 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchRequest.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchRequest.java @@ -33,24 +33,26 @@ import org.xbib.asn1.BEREncoding; *
*/ public final class SearchRequest extends ASN1Any { - public ReferenceId s_referenceId; // optional - public ASN1Integer s_smallSetUpperBound; - public ASN1Integer s_largeSetLowerBound; - public ASN1Integer s_mediumSetPresentNumber; - public ASN1Boolean s_replaceIndicator; - public InternationalString s_resultSetName; - public DatabaseName s_databaseNames[]; - public ElementSetNames s_smallSetElementSetNames; // optional - public ElementSetNames s_mediumSetElementSetNames; // optional - public ASN1ObjectIdentifier s_preferredRecordSyntax; // optional - public Query s_query; - public OtherInformation s_additionalSearchInfo; // optional - public OtherInformation s_otherInfo; // optional + public ReferenceId referenceId; // optional + public ASN1Integer smallSetUpperBound; + public ASN1Integer largeSetLowerBound; + public ASN1Integer mediumSetPresentNumber; + public ASN1Boolean replaceIndicator; + public InternationalString resultSetName; + public DatabaseName[] databaseNames; + private ElementSetNames smallSetElementSetNames; // optional + private ElementSetNames mediumSetElementSetNames; // optional + private ASN1ObjectIdentifier preferredRecordSyntax; // optional + public Query query; + private OtherInformation additionalSearchInfo; // optional + public OtherInformation otherInfo; // optional + /** * Default constructor for a SearchRequest. */ public SearchRequest() { } + /** * Constructor for a SearchRequest from a BER encoding. * @@ -60,7 +62,6 @@ public final class SearchRequest extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public SearchRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -74,171 +75,169 @@ public final class SearchRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { - // SearchRequest should be encoded by a constructed BER - BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("SearchRequest: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; BERConstructed tagged; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 13 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_smallSetUpperBound\n"); + if (p.getTag() != 13 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_smallSetUpperBound"); } - s_smallSetUpperBound = new ASN1Integer(p, false); + smallSetUpperBound = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 14 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_largeSetLowerBound\n"); + if (p.getTag() != 14 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_largeSetLowerBound"); } - s_largeSetLowerBound = new ASN1Integer(p, false); + largeSetLowerBound = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 15 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_mediumSetPresentNumber\n"); + if (p.getTag() != 15 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_mediumSetPresentNumber"); } - s_mediumSetPresentNumber = new ASN1Integer(p, false); + mediumSetPresentNumber = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 16 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_replaceIndicator\n"); + if (p.getTag() != 16 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_replaceIndicator"); } - s_replaceIndicator = new ASN1Boolean(p, false); + replaceIndicator = new ASN1Boolean(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 17 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_resultSetName\n"); + if (p.getTag() != 17 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_resultSetName"); } - s_resultSetName = new InternationalString(p, false); + resultSetName = new InternationalString(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 18 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_databaseNames\n"); + if (p.getTag() != 18 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_databaseNames"); } try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); - s_databaseNames = new DatabaseName[parts]; + databaseNames = new DatabaseName[parts]; int n; for (n = 0; n < parts; n++) { - s_databaseNames[n] = new DatabaseName(cons.elementAt(n), true); + databaseNames[n] = new DatabaseName(cons.elementAt(n), true); } } catch (ClassCastException e) { - throw new ASN1EncodingException("Bad BER"); + throw new ASN1EncodingException("bad BER"); } part++; if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 100 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 100 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_smallSetElementSetNames tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_smallSetElementSetNames tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_smallSetElementSetNames tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_smallSetElementSetNames tag bad"); } - s_smallSetElementSetNames = new ElementSetNames(tagged.elementAt(0), true); + smallSetElementSetNames = new ElementSetNames(tagged.elementAt(0), true); part++; } if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 101 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 101 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_mediumSetElementSetNames tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: mediumSetElementSetNames tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_mediumSetElementSetNames tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: mediumSetElementSetNames tag bad"); } - s_mediumSetElementSetNames = new ElementSetNames(tagged.elementAt(0), true); + mediumSetElementSetNames = new ElementSetNames(tagged.elementAt(0), true); part++; } if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() == 104 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_preferredRecordSyntax = new ASN1ObjectIdentifier(p, false); + if (p.getTag() == 104 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + preferredRecordSyntax = new ASN1ObjectIdentifier(p, false); part++; } if (numParts <= part) { - throw new ASN1Exception("SearchRequest: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 21 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchRequest: bad tag in s_query\n"); + if (p.getTag() != 21 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in query"); } try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_query tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: query tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("SearchRequest: bad BER encoding: s_query tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: query tag bad"); } - s_query = new Query(tagged.elementAt(0), true); + query = new Query(tagged.elementAt(0), true); part++; - s_additionalSearchInfo = null; - s_otherInfo = null; + additionalSearchInfo = null; + otherInfo = null; if (numParts <= part) { return; } p = berConstructed.elementAt(part); - if (p.tagGet() == 203 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { - s_additionalSearchInfo = new OtherInformation(p, false); + if (p.getTag() == 203 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + additionalSearchInfo = new OtherInformation(p, false); part++; } if (numParts <= part) { @@ -246,13 +245,13 @@ public final class SearchRequest extends ASN1Any { } p = berConstructed.elementAt(part); try { - s_otherInfo = new OtherInformation(p, true); + otherInfo = new OtherInformation(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_otherInfo = null; // no, not present + otherInfo = null; // no, not present } if (part < numParts) { - throw new ASN1Exception("SearchRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -262,6 +261,7 @@ public final class SearchRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -274,24 +274,25 @@ public final class SearchRequest extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 7; // number of mandatories - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } - if (s_smallSetElementSetNames != null) { + if (smallSetElementSetNames != null) { numFields++; } - if (s_mediumSetElementSetNames != null) { + if (mediumSetElementSetNames != null) { numFields++; } - if (s_preferredRecordSyntax != null) { + if (preferredRecordSyntax != null) { numFields++; } - if (s_additionalSearchInfo != null) { + if (additionalSearchInfo != null) { numFields++; } - if (s_otherInfo != null) { + if (otherInfo != null) { numFields++; } BEREncoding fields[] = new BEREncoding[numFields]; @@ -299,40 +300,40 @@ public final class SearchRequest extends ASN1Any { BEREncoding f2[]; int p; BEREncoding enc[]; - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } - fields[x++] = s_smallSetUpperBound.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 13); - fields[x++] = s_largeSetLowerBound.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 14); - fields[x++] = s_mediumSetPresentNumber.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 15); - fields[x++] = s_replaceIndicator.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 16); - fields[x++] = s_resultSetName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 17); - f2 = new BEREncoding[s_databaseNames.length]; - for (p = 0; p < s_databaseNames.length; p++) { - f2[p] = s_databaseNames[p].berEncode(); + fields[x++] = smallSetUpperBound.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 13); + fields[x++] = largeSetLowerBound.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 14); + fields[x++] = mediumSetPresentNumber.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 15); + fields[x++] = replaceIndicator.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 16); + fields[x++] = resultSetName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 17); + f2 = new BEREncoding[databaseNames.length]; + for (p = 0; p < databaseNames.length; p++) { + f2[p] = databaseNames[p].berEncode(); } fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 18, f2); - if (s_smallSetElementSetNames != null) { + if (smallSetElementSetNames != null) { enc = new BEREncoding[1]; - enc[0] = s_smallSetElementSetNames.berEncode(); + enc[0] = smallSetElementSetNames.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 100, enc); } - if (s_mediumSetElementSetNames != null) { + if (mediumSetElementSetNames != null) { enc = new BEREncoding[1]; - enc[0] = s_mediumSetElementSetNames.berEncode(); + enc[0] = mediumSetElementSetNames.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 101, enc); } - if (s_preferredRecordSyntax != null) { - fields[x++] = s_preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104); + if (preferredRecordSyntax != null) { + fields[x++] = preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104); } enc = new BEREncoding[1]; - enc[0] = s_query.berEncode(); + enc[0] = query.berEncode(); fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 21, enc); - if (s_additionalSearchInfo != null) { - fields[x++] = s_additionalSearchInfo.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 203); + if (additionalSearchInfo != null) { + fields[x++] = additionalSearchInfo.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 203); } - if (s_otherInfo != null) { - fields[x] = s_otherInfo.berEncode(); + if (otherInfo != null) { + fields[x] = otherInfo.berEncode(); } return new BERConstructed(tagType, tag, fields); } @@ -341,51 +342,49 @@ public final class SearchRequest extends ASN1Any { * Returns a new String object containing a text representing * of the SearchRequest. */ - + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); int outputted = 0; - - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } - if (0 < outputted) { str.append(", "); } str.append("smallSetUpperBound "); - str.append(s_smallSetUpperBound); + str.append(smallSetUpperBound); outputted++; if (0 < outputted) { str.append(", "); } str.append("largeSetLowerBound "); - str.append(s_largeSetLowerBound); + str.append(largeSetLowerBound); outputted++; if (0 < outputted) { str.append(", "); } str.append("mediumSetPresentNumber "); - str.append(s_mediumSetPresentNumber); + str.append(mediumSetPresentNumber); outputted++; if (0 < outputted) { str.append(", "); } str.append("replaceIndicator "); - str.append(s_replaceIndicator); + str.append(replaceIndicator); outputted++; if (0 < outputted) { str.append(", "); } str.append("resultSetName "); - str.append(s_resultSetName); + str.append(resultSetName); outputted++; if (0 < outputted) { @@ -393,69 +392,62 @@ public final class SearchRequest extends ASN1Any { } str.append("databaseNames "); str.append("{"); - for (p = 0; p < s_databaseNames.length; p++) { + for (p = 0; p < databaseNames.length; p++) { if (p != 0) { str.append(", "); } - str.append(s_databaseNames[p]); + str.append(databaseNames[p]); } str.append("}"); outputted++; - if (s_smallSetElementSetNames != null) { + if (smallSetElementSetNames != null) { if (0 < outputted) { str.append(", "); } str.append("smallSetElementSetNames "); - str.append(s_smallSetElementSetNames); + str.append(smallSetElementSetNames); outputted++; } - if (s_mediumSetElementSetNames != null) { + if (mediumSetElementSetNames != null) { if (0 < outputted) { str.append(", "); } str.append("mediumSetElementSetNames "); - str.append(s_mediumSetElementSetNames); + str.append(mediumSetElementSetNames); outputted++; } - - if (s_preferredRecordSyntax != null) { + if (preferredRecordSyntax != null) { if (0 < outputted) { str.append(", "); } str.append("preferredRecordSyntax "); - str.append(s_preferredRecordSyntax); + str.append(preferredRecordSyntax); outputted++; } - if (0 < outputted) { str.append(", "); } str.append("query "); - str.append(s_query); + str.append(query); outputted++; - - if (s_additionalSearchInfo != null) { + if (additionalSearchInfo != null) { if (0 < outputted) { str.append(", "); } str.append("additionalSearchInfo "); - str.append(s_additionalSearchInfo); + str.append(additionalSearchInfo); outputted++; } - - if (s_otherInfo != null) { + if (otherInfo != null) { if (0 < outputted) { str.append(", "); } str.append("otherInfo "); - str.append(s_otherInfo); + str.append(otherInfo); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchResponse.java index a99776f..ea2f168 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchResponse.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SearchResponse.java @@ -33,16 +33,17 @@ public final class SearchResponse extends ASN1Any { public static final int E_subset = 1; public static final int E_interim = 2; public static final int E_none = 3; - public ReferenceId s_referenceId; // optional - public ASN1Integer s_resultCount; - public ASN1Integer s_numberOfRecordsReturned; - public ASN1Integer s_nextResultSetPosition; + public ReferenceId referenceId; // optional + public ASN1Integer resultCount; + public ASN1Integer numberOfRecordsReturned; + public ASN1Integer nextResultSetPosition; public ASN1Boolean s_searchStatus; public ASN1Integer s_resultSetStatus; // optional public PresentStatus s_presentStatus; // optional public Records s_records; // optional public OtherInformation s_additionalSearchInfo; // optional public OtherInformation s_otherInfo; // optional + /** * Constructor for a SearchResponse from a BER encoding. * @@ -52,9 +53,7 @@ public final class SearchResponse extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SearchResponse(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SearchResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -67,65 +66,64 @@ public final class SearchResponse extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("SearchResponse: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("SearchResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); try { - s_referenceId = new ReferenceId(p, true); + referenceId = new ReferenceId(p, true); part++; // yes, consumed } catch (ASN1Exception e) { - s_referenceId = null; // no, not present + referenceId = null; // no, not present } if (numParts <= part) { - throw new ASN1Exception("SearchResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 23 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchResponse: bad tag in s_resultCount\n"); + if (p.getTag() != 23 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_resultCount"); } - s_resultCount = new ASN1Integer(p, false); + resultCount = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 24 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchResponse: bad tag in s_numberOfRecordsReturned\n"); + if (p.getTag() != 24 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_numberOfRecordsReturned"); } - s_numberOfRecordsReturned = new ASN1Integer(p, false); + numberOfRecordsReturned = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 25 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchResponse: bad tag in s_nextResultSetPosition\n"); + if (p.getTag() != 25 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_nextResultSetPosition"); } - s_nextResultSetPosition = new ASN1Integer(p, false); + nextResultSetPosition = new ASN1Integer(p, false); part++; if (numParts <= part) { - throw new ASN1Exception("SearchResponse: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 22 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SearchResponse: bad tag in s_searchStatus\n"); + if (p.getTag() != 22 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_searchStatus"); } s_searchStatus = new ASN1Boolean(p, false); part++; @@ -139,8 +137,8 @@ public final class SearchResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 26 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 26 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_resultSetStatus = new ASN1Integer(p, false); part++; } @@ -180,8 +178,8 @@ public final class SearchResponse extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 203 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 203 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_additionalSearchInfo = new OtherInformation(p, false); part++; } @@ -203,7 +201,7 @@ public final class SearchResponse extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("SearchResponse: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -213,10 +211,8 @@ public final class SearchResponse extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -228,10 +224,11 @@ public final class SearchResponse extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 4; // number of mandatories - if (s_referenceId != null) { + if (referenceId != null) { numFields++; } if (s_resultSetStatus != null) { @@ -257,21 +254,21 @@ public final class SearchResponse extends ASN1Any { // Encoding s_referenceId: ReferenceId OPTIONAL - if (s_referenceId != null) { - fields[x++] = s_referenceId.berEncode(); + if (referenceId != null) { + fields[x++] = referenceId.berEncode(); } // Encoding s_resultCount: INTEGER - fields[x++] = s_resultCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 23); + fields[x++] = resultCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 23); // Encoding s_numberOfRecordsReturned: INTEGER - fields[x++] = s_numberOfRecordsReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24); + fields[x++] = numberOfRecordsReturned.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 24); // Encoding s_nextResultSetPosition: INTEGER - fields[x++] = s_nextResultSetPosition.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25); + fields[x++] = nextResultSetPosition.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 25); // Encoding s_searchStatus: BOOLEAN @@ -314,12 +311,13 @@ public final class SearchResponse extends ASN1Any { * Returns a new String object containing a text representing * of the SearchResponse. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; - if (s_referenceId != null) { + if (referenceId != null) { str.append("referenceId "); - str.append(s_referenceId); + str.append(referenceId); outputted++; } @@ -327,21 +325,21 @@ public final class SearchResponse extends ASN1Any { str.append(", "); } str.append("resultCount "); - str.append(s_resultCount); + str.append(resultCount); outputted++; if (0 < outputted) { str.append(", "); } str.append("numberOfRecordsReturned "); - str.append(s_numberOfRecordsReturned); + str.append(numberOfRecordsReturned); outputted++; if (0 < outputted) { str.append(", "); } str.append("nextResultSetPosition "); - str.append(s_nextResultSetPosition); + str.append(nextResultSetPosition); outputted++; if (0 < outputted) { @@ -397,5 +395,4 @@ public final class SearchResponse extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Segment.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Segment.java index c1c7291..11f6538 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Segment.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Segment.java @@ -36,9 +36,7 @@ public final class Segment extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Segment(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Segment(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -51,10 +49,8 @@ public final class Segment extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Segment should be encoded by a constructed BER BERConstructed berConstructed; @@ -94,8 +90,8 @@ public final class Segment extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 24 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 24 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("Segment: bad tag in s_numberOfRecordsReturned\n"); } @@ -111,8 +107,8 @@ public final class Segment extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 0 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() != 0 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { throw new ASN1EncodingException ("Segment: bad tag in s_segmentRecords\n"); } @@ -162,6 +158,7 @@ public final class Segment extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -174,6 +171,7 @@ public final class Segment extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -224,6 +222,7 @@ public final class Segment extends ASN1Any { * Returns a new String object containing a text representing * of the Segment. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElement.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElement.java index 635d2a7..e2bb66d 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElement.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElement.java @@ -32,9 +32,7 @@ public final class SortElement extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SortElement(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SortElement(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -47,10 +45,8 @@ public final class SortElement extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed tagwrapper; // Null out all choices @@ -59,30 +55,30 @@ public final class SortElement extends ASN1Any { c_datbaseSpecific = null; // Try choice generic - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagwrapper = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("SortElement: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } if (tagwrapper.numberComponents() != 1) { - throw new ASN1EncodingException("SortElement: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } c_generic = new SortKey(tagwrapper.elementAt(0), true); return; } // Try choice datbaseSpecific - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { BEREncoding ber_data; ber_data = ber; BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber_data; } catch (ClassCastException e) { - throw new ASN1EncodingException("SortElement: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); @@ -96,7 +92,7 @@ public final class SortElement extends ASN1Any { return; } - throw new ASN1Exception("SortElement: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -105,10 +101,8 @@ public final class SortElement extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; BEREncoding f2[]; @@ -158,10 +152,8 @@ public final class SortElement extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -170,13 +162,14 @@ public final class SortElement extends ASN1Any { // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - throw new ASN1EncodingException("SortElement: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the SortElement. */ + @Override public String toString() { int p; StringBuilder str = new StringBuilder("{"); @@ -204,5 +197,4 @@ public final class SortElement extends ASN1Any { return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElementDatabaseSpecific.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElementDatabaseSpecific.java index 3beae4e..0a5ed03 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElementDatabaseSpecific.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortElementDatabaseSpecific.java @@ -31,8 +31,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public SortElementDatabaseSpecific(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SortElementDatabaseSpecific(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -45,6 +44,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // SortElement_datbaseSpecific should be encoded by a constructed BER @@ -52,7 +52,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("SortElement_datbaseSpecific: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -65,7 +65,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("SortElement_datbaseSpecific: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -76,7 +76,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("SortElement_datbaseSpecific: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -86,7 +86,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("SortElement_datbaseSpecific: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -96,7 +96,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -109,6 +109,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -133,6 +134,7 @@ public final class SortElementDatabaseSpecific extends ASN1Any { * Returns a new String object containing a text representing * of the SortElement_datbaseSpecific. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKey.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKey.java index d89d46d..232c691 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKey.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKey.java @@ -32,9 +32,7 @@ public final class SortKey extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SortKey(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SortKey(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -47,26 +45,27 @@ public final class SortKey extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { c_sortfield = null; c_elementSpec = null; c_sortAttributes = null; - if (ber.tagGet() == 0 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 0 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_sortfield = new InternationalString(ber, false); return; } - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_elementSpec = new Specification(ber, false); return; } - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_sortAttributes = new SortKeySortAttributes(ber, false); return; } - throw new ASN1Exception("SortKey: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -75,10 +74,8 @@ public final class SortKey extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; // Encoding choice: c_sortfield @@ -123,6 +120,7 @@ public final class SortKey extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! @@ -139,7 +137,7 @@ public final class SortKey extends ASN1Any { * Returns a new String object containing a text representing * of the SortKey. */ - + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; @@ -171,5 +169,4 @@ public final class SortKey extends ASN1Any { return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySortAttributes.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySortAttributes.java index 90ddcaa..229cfc4 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySortAttributes.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySortAttributes.java @@ -33,9 +33,7 @@ public final class SortKeySortAttributes extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SortKeySortAttributes(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SortKeySortAttributes(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -48,30 +46,31 @@ public final class SortKeySortAttributes extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("SortKey_sortAttributes: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } int numParts = berConstructed.numberComponents(); int part = 0; BEREncoding p; if (numParts <= part) { - throw new ASN1Exception("SortKey_sortAttributes: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); s_id = new AttributeSetId(p, true); part++; if (numParts <= part) { - throw new ASN1Exception("SortKey_sortAttributes: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); s_list = new AttributeList(p, true); part++; if (part < numParts) { - throw new ASN1Exception("SortKey_sortAttributes: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -81,6 +80,7 @@ public final class SortKeySortAttributes extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -93,6 +93,7 @@ public final class SortKeySortAttributes extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 2; // number of mandatories BEREncoding fields[] = new BEREncoding[numFields]; @@ -106,6 +107,7 @@ public final class SortKeySortAttributes extends ASN1Any { * Returns a new String object containing a text representing * of the SortKey_sortAttributes. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpec.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpec.java index 7387105..3b4181b 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpec.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpec.java @@ -22,7 +22,6 @@ import org.xbib.asn1.BEREncoding; */ public final class SortKeySpec extends ASN1Any { - public static final int E_ascending = 0; public static final int E_descending = 1; public static final int E_ascendingByFrequency = 3; @@ -33,6 +32,7 @@ public final class SortKeySpec extends ASN1Any { public ASN1Integer s_sortRelation; public ASN1Integer s_caseSensitivity; public SortKeySpecMissingValueAction s_missingValueAction; // optional + /** * Constructor for a SortKeySpec from a BER encoding. * @@ -42,9 +42,7 @@ public final class SortKeySpec extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SortKeySpec(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SortKeySpec(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -57,6 +55,7 @@ public final class SortKeySpec extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // SortKeySpec should be encoded by a constructed BER @@ -64,8 +63,7 @@ public final class SortKeySpec extends ASN1Any { try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("SortKeySpec: bad BER form\n"); + throw new ASN1EncodingException("bad BER form\n"); } // Prepare to decode the components @@ -79,7 +77,7 @@ public final class SortKeySpec extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("SortKeySpec: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); @@ -90,13 +88,13 @@ public final class SortKeySpec extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("SortKeySpec: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 1 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SortKeySpec: bad tag in s_sortRelation\n"); + if (p.getTag() != 1 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_sortRelation"); } s_sortRelation = new ASN1Integer(p, false); @@ -106,13 +104,13 @@ public final class SortKeySpec extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("SortKeySpec: incomplete"); + throw new ASN1Exception("incomplete"); } p = berConstructed.elementAt(part); - if (p.tagGet() != 2 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("SortKeySpec: bad tag in s_caseSensitivity\n"); + if (p.getTag() != 2 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException("bad tag in s_caseSensitivity"); } s_caseSensitivity = new ASN1Integer(p, false); @@ -130,15 +128,15 @@ public final class SortKeySpec extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException("SortKeySpec: bad BER encoding: s_missingValueAction tag bad"); + throw new ASN1EncodingException("bad BER encoding: s_missingValueAction tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException("SortKeySpec: bad BER encoding: s_missingValueAction tag bad"); + throw new ASN1EncodingException("bad BER encoding: s_missingValueAction tag bad"); } s_missingValueAction = new SortKeySpecMissingValueAction(tagged.elementAt(0), true); @@ -148,7 +146,7 @@ public final class SortKeySpec extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("SortKeySpec: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -158,6 +156,7 @@ public final class SortKeySpec extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -170,14 +169,15 @@ public final class SortKeySpec extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { int numFields = 3; // number of mandatories if (s_missingValueAction != null) { numFields++; } - BEREncoding fields[] = new BEREncoding[numFields]; + BEREncoding[] fields = new BEREncoding[numFields]; int x = 0; - BEREncoding enc[]; + BEREncoding[] enc; fields[x++] = s_sortElement.berEncode(); fields[x++] = s_sortRelation.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1); fields[x++] = s_caseSensitivity.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2); @@ -193,9 +193,8 @@ public final class SortKeySpec extends ASN1Any { * Returns a new String object containing a text representing * of the SortKeySpec. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; str.append("sortElement "); @@ -226,5 +225,4 @@ public final class SortKeySpec extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpecMissingValueAction.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpecMissingValueAction.java index 7bf2109..203ccd0 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpecMissingValueAction.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortKeySpecMissingValueAction.java @@ -7,7 +7,6 @@ import org.xbib.asn1.ASN1Null; import org.xbib.asn1.ASN1OctetString; import org.xbib.asn1.BEREncoding; - /** * Class for representing a SortKeySpec_missingValueAction from Z39-50-APDU-1995. *
@@ -25,7 +24,6 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
     public ASN1Null c_null;
     public ASN1OctetString c_missingValueData;
 
-
     /**
      * Constructor for a SortKeySpec_missingValueAction from a BER encoding.
      *
@@ -35,9 +33,7 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public SortKeySpecMissingValueAction(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public SortKeySpecMissingValueAction(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -50,10 +46,8 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Null out all choices
 
         c_abort = null;
@@ -61,27 +55,27 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
         c_missingValueData = null;
 
         // Try choice abort
-        if (ber.tagGet() == 1 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 1 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_abort = new ASN1Null(ber, false);
             return;
         }
 
         // Try choice null
-        if (ber.tagGet() == 2 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 2 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_null = new ASN1Null(ber, false);
             return;
         }
 
         // Try choice missingValueData
-        if (ber.tagGet() == 3 &&
-                ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (ber.getTag() == 3 &&
+                ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             c_missingValueData = new ASN1OctetString(ber, false);
             return;
         }
 
-        throw new ASN1Exception("SortKeySpec_missingValueAction: bad BER encoding: choice not matched");
+        throw new ASN1Exception("bad BER encoding: choice not matched");
     }
 
     /**
@@ -90,10 +84,8 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         BEREncoding chosen = null;
 
         // Encoding choice: c_abort
@@ -139,10 +131,8 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
      * @param tag      the tag.
      * @throws ASN1Exception if it cannot be BER encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // This method must not be called!
 
         // Method is not available because this is a basic CHOICE
@@ -158,9 +148,8 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the SortKeySpec_missingValueAction.
      */
-
-    public String
-    toString() {
+    @Override
+    public String toString() {
         StringBuilder str = new StringBuilder("{");
         boolean found = false;
         if (c_abort != null) {
@@ -188,5 +177,4 @@ public final class SortKeySpecMissingValueAction extends ASN1Any {
         str.append("}");
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortRequest.java
index f9a78e0..fd0f642 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortRequest.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortRequest.java
@@ -37,8 +37,7 @@ public final class SortRequest extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-    public SortRequest(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public SortRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -51,10 +50,8 @@ public final class SortRequest extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // SortRequest should be encoded by a constructed BER
 
         BERConstructed berConstructed;
@@ -75,7 +72,7 @@ public final class SortRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
@@ -90,14 +87,13 @@ public final class SortRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 3 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("SortRequest: bad tag in s_inputResultSetNames\n");
+        if (p.getTag() != 3 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in s_inputResultSetNames");
         }
 
         try {
@@ -109,7 +105,7 @@ public final class SortRequest extends ASN1Any {
                 s_inputResultSetNames[n] = new InternationalString(cons.elementAt(n), true);
             }
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("Bad BER");
+            throw new ASN1EncodingException("bad BER");
         }
         part++;
 
@@ -117,14 +113,13 @@ public final class SortRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 4 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("SortRequest: bad tag in s_sortedResultSetName\n");
+        if (p.getTag() != 4 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in sortedResultSetName\n");
         }
 
         s_sortedResultSetName = new InternationalString(p, false);
@@ -134,14 +129,13 @@ public final class SortRequest extends ASN1Any {
 
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortRequest: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 5 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("SortRequest: bad tag in s_sortSequence\n");
+        if (p.getTag() != 5 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in sortSequence\n");
         }
 
         try {
@@ -153,7 +147,7 @@ public final class SortRequest extends ASN1Any {
                 s_sortSequence[n] = new SortKeySpec(cons.elementAt(n), true);
             }
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("Bad BER");
+            throw new ASN1EncodingException("bad BER");
         }
         part++;
 
@@ -179,7 +173,7 @@ public final class SortRequest extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("SortRequest: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -189,10 +183,8 @@ public final class SortRequest extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -204,7 +196,7 @@ public final class SortRequest extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         int numFields = 3; // number of mandatories
         if (s_referenceId != null) {
@@ -241,6 +233,7 @@ public final class SortRequest extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the SortRequest.
      */
+    @Override
     public String toString() {
         int p;
         StringBuilder str = new StringBuilder("{");
@@ -296,5 +289,4 @@ public final class SortRequest extends ASN1Any {
         str.append("}");
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortResponse.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortResponse.java
index 8298c8d..92090d2 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SortResponse.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SortResponse.java
@@ -35,6 +35,7 @@ public final class SortResponse extends ASN1Any {
     public ASN1Integer s_resultSetStatus; // optional
     public DiagRec s_diagnostics[]; // optional
     public OtherInformation s_otherInfo; // optional
+
     /**
      * Constructor for a SortResponse from a BER encoding.
      *
@@ -44,7 +45,6 @@ public final class SortResponse extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
     public SortResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
@@ -58,6 +58,7 @@ public final class SortResponse extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
+    @Override
     public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // SortResponse should be encoded by a constructed BER
 
@@ -65,14 +66,14 @@ public final class SortResponse extends ASN1Any {
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException("SortResponse: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
         int numParts = berConstructed.numberComponents();
         int part = 0;
         BEREncoding p;
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortResponse: incomplete");
+            throw new ASN1Exception(" incomplete");
         }
         p = berConstructed.elementAt(part);
         try {
@@ -83,14 +84,13 @@ public final class SortResponse extends ASN1Any {
         }
         if (numParts <= part) {
             // End of record, but still more elements to get
-            throw new ASN1Exception("SortResponse: incomplete");
+            throw new ASN1Exception("incomplete");
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() != 3 ||
-                p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
-            throw new ASN1EncodingException
-                    ("SortResponse: bad tag in s_sortStatus\n");
+        if (p.getTag() != 3 ||
+                p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
+            throw new ASN1EncodingException("bad tag in sortStatus");
         }
 
         s_sortStatus = new ASN1Integer(p, false);
@@ -110,8 +110,8 @@ public final class SortResponse extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 4 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 4 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_resultSetStatus = new ASN1Integer(p, false);
             part++;
         }
@@ -123,8 +123,8 @@ public final class SortResponse extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 5 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 5 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 BERConstructed cons = (BERConstructed) p;
                 int parts = cons.numberComponents();
@@ -134,7 +134,7 @@ public final class SortResponse extends ASN1Any {
                     s_diagnostics[n] = new DiagRec(cons.elementAt(n), true);
                 }
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException("Bad BER");
+                throw new ASN1EncodingException("bad BER");
             }
             part++;
         }
@@ -166,10 +166,8 @@ public final class SortResponse extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -181,6 +179,7 @@ public final class SortResponse extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
+    @Override
     public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         int numFields = 1; // number of mandatories
         if (s_referenceId != null) {
@@ -223,6 +222,7 @@ public final class SortResponse extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the SortResponse.
      */
+    @Override
     public String toString() {
         int p;
         StringBuilder str = new StringBuilder("{");
@@ -274,5 +274,4 @@ public final class SortResponse extends ASN1Any {
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Specification.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Specification.java
index 1d54fb6..b618b8b 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Specification.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Specification.java
@@ -24,7 +24,6 @@ public final class Specification extends ASN1Any {
     public ASN1ObjectIdentifier s_schema; // optional
     public SpecificationElementSpec s_elementSpec; // optional
 
-
     /**
      * Constructor for a Specification from a BER encoding.
      *
@@ -34,9 +33,7 @@ public final class Specification extends ASN1Any {
      *                  usually be passing true.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public Specification(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    public Specification(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         super(ber, checkTag);
     }
 
@@ -49,18 +46,15 @@ public final class Specification extends ASN1Any {
      * @param checkTag if the tag should be checked.
      * @throws ASN1Exception if the BER encoding is bad.
      */
-
-    public void
-    berDecode(BEREncoding ber, boolean checkTag)
-            throws ASN1Exception {
+    @Override
+    public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
         // Specification should be encoded by a constructed BER
 
         BERConstructed berConstructed;
         try {
             berConstructed = (BERConstructed) ber;
         } catch (ClassCastException e) {
-            throw new ASN1EncodingException
-                    ("Specification: bad BER form\n");
+            throw new ASN1EncodingException("bad BER form");
         }
 
         // Prepare to decode the components
@@ -83,8 +77,8 @@ public final class Specification extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 1 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 1 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             s_schema = new ASN1ObjectIdentifier(p, false);
             part++;
         }
@@ -96,15 +90,15 @@ public final class Specification extends ASN1Any {
         }
         p = berConstructed.elementAt(part);
 
-        if (p.tagGet() == 2 &&
-                p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
+        if (p.getTag() == 2 &&
+                p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
             try {
                 tagged = (BERConstructed) p;
             } catch (ClassCastException e) {
-                throw new ASN1EncodingException("Specification: bad BER encoding: s_elementSpec tag bad\n");
+                throw new ASN1EncodingException("bad BER encoding: elementSpec tag bad");
             }
             if (tagged.numberComponents() != 1) {
-                throw new ASN1EncodingException("Specification: bad BER encoding: s_elementSpec tag bad\n");
+                throw new ASN1EncodingException("bad BER encoding: elementSpec tag bad");
             }
 
             s_elementSpec = new SpecificationElementSpec(tagged.elementAt(0), true);
@@ -114,7 +108,7 @@ public final class Specification extends ASN1Any {
         // Should not be any more parts
 
         if (part < numParts) {
-            throw new ASN1Exception("Specification: bad BER: extra data " + part + "/" + numParts + " processed");
+            throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed");
         }
     }
 
@@ -124,10 +118,8 @@ public final class Specification extends ASN1Any {
      * @return The BER encoding.
      * @throws ASN1Exception Invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode()
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode() throws ASN1Exception {
         return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
     }
 
@@ -139,10 +131,8 @@ public final class Specification extends ASN1Any {
      * @return The BER encoding of the object.
      * @throws ASN1Exception When invalid or cannot be encoded.
      */
-
-    public BEREncoding
-    berEncode(int tagType, int tag)
-            throws ASN1Exception {
+    @Override
+    public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
         // Calculate the number of fields in the encoding
 
         int numFields = 0; // number of mandatories
@@ -179,6 +169,7 @@ public final class Specification extends ASN1Any {
      * Returns a new String object containing a text representing
      * of the Specification.
      */
+    @Override
     public String toString() {
         StringBuilder str = new StringBuilder("{");
         int outputted = 0;
@@ -200,5 +191,4 @@ public final class Specification extends ASN1Any {
 
         return str.toString();
     }
-
 }
diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/SpecificationElementSpec.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/SpecificationElementSpec.java
index b5ca142..24c2608 100644
--- a/z3950/src/main/java/org/xbib/io/iso23950/v3/SpecificationElementSpec.java
+++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/SpecificationElementSpec.java
@@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception;
 import org.xbib.asn1.ASN1External;
 import org.xbib.asn1.BEREncoding;
 
-
 /**
  * Class for representing a Specification_elementSpec from Z39-50-APDU-1995.
  * 
@@ -18,10 +17,10 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class SpecificationElementSpec extends ASN1Any { + public InternationalString c_elementSetName; public ASN1External c_externalEspec; - /** * Constructor for a Specification_elementSpec from a BER encoding. * @@ -31,9 +30,7 @@ public final class SpecificationElementSpec extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public SpecificationElementSpec(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public SpecificationElementSpec(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -46,30 +43,28 @@ public final class SpecificationElementSpec extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices c_elementSetName = null; c_externalEspec = null; // Try choice elementSetName - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_elementSetName = new InternationalString(ber, false); return; } // Try choice externalEspec - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_externalEspec = new ASN1External(ber, false); return; } - throw new ASN1Exception("Specification_elementSpec: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -78,10 +73,8 @@ public final class SpecificationElementSpec extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; // Encoding choice: c_elementSetName @@ -119,6 +112,7 @@ public final class SpecificationElementSpec extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! @@ -128,16 +122,15 @@ public final class SpecificationElementSpec extends ASN1Any { // tag on it, otherwise the tag identifying which CHOICE // it is will be overwritten and lost. - throw new ASN1EncodingException("Specification_elementSpec: cannot implicitly tag"); + throw new ASN1EncodingException("cannot implicitly tag"); } /** * Returns a new String object containing a text representing * of the Specification_elementSpec. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; if (c_elementSetName != null) { @@ -155,5 +148,4 @@ public final class SpecificationElementSpec extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/StringOrNumeric.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/StringOrNumeric.java index 8eb4a37..95b85ab 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/StringOrNumeric.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/StringOrNumeric.java @@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception; import org.xbib.asn1.ASN1Integer; import org.xbib.asn1.BEREncoding; - /** * Class for representing a StringOrNumeric from Z39-50-APDU-1995. *
@@ -18,10 +17,10 @@ import org.xbib.asn1.BEREncoding;
  * 
*/ public final class StringOrNumeric extends ASN1Any { + public InternationalString c_string; public ASN1Integer c_numeric; - /** * Constructor for a StringOrNumeric from a BER encoding. * @@ -31,9 +30,7 @@ public final class StringOrNumeric extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public StringOrNumeric(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public StringOrNumeric(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -46,6 +43,7 @@ public final class StringOrNumeric extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices @@ -53,20 +51,19 @@ public final class StringOrNumeric extends ASN1Any { c_numeric = null; // Try choice string - if (ber.tagGet() == 1 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 1 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_string = new InternationalString(ber, false); return; } // Try choice numeric - if (ber.tagGet() == 2 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 2 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_numeric = new ASN1Integer(ber, false); return; } - - throw new ASN1Exception("StringOrNumeric: bad BER encoding: choice not matched"); + throw new ASN1Exception("bad BER encoding: choice not matched"); } /** @@ -75,6 +72,7 @@ public final class StringOrNumeric extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; @@ -113,10 +111,8 @@ public final class StringOrNumeric extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -132,6 +128,7 @@ public final class StringOrNumeric extends ASN1Any { * Returns a new String object containing a text representing * of the StringOrNumeric. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; @@ -148,9 +145,7 @@ public final class StringOrNumeric extends ASN1Any { str.append("numeric "); str.append(c_numeric); } - str.append("}"); - return str.toString(); } } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Term.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Term.java index b1d2775..4d40085 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Term.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Term.java @@ -48,9 +48,7 @@ public final class Term extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public Term(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public Term(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -63,10 +61,8 @@ public final class Term extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // Null out all choices c_general = null; @@ -79,55 +75,55 @@ public final class Term extends ASN1Any { c_null = null; // Try choice general - if (ber.tagGet() == 45 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 45 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_general = new ASN1OctetString(ber, false); return; } // Try choice numeric - if (ber.tagGet() == 215 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 215 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_numeric = new ASN1Integer(ber, false); return; } // Try choice characterString - if (ber.tagGet() == 216 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 216 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_characterString = new InternationalString(ber, false); return; } // Try choice oid - if (ber.tagGet() == 217 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 217 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_oid = new ASN1ObjectIdentifier(ber, false); return; } // Try choice dateTime - if (ber.tagGet() == 218 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 218 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_dateTime = new ASN1GeneralizedTime(ber, false); return; } // Try choice external - if (ber.tagGet() == 219 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 219 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_external = new ASN1External(ber, false); return; } // Try choice integerAndUnit - if (ber.tagGet() == 220 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 220 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_integerAndUnit = new IntUnit(ber, false); return; } - if (ber.tagGet() == 221 && - ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (ber.getTag() == 221 && + ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { c_null = new ASN1Null(ber, false); return; } @@ -140,6 +136,7 @@ public final class Term extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { BEREncoding chosen = null; @@ -226,10 +223,8 @@ public final class Term extends ASN1Any { * @param tag the tag. * @throws ASN1Exception if it cannot be BER encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // This method must not be called! // Method is not available because this is a basic CHOICE @@ -245,9 +240,8 @@ public final class Term extends ASN1Any { * Returns a new String object containing a text representing * of the Term. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); boolean found = false; @@ -320,10 +314,7 @@ public final class Term extends ASN1Any { str.append("null "); str.append(c_null); } - str.append("}"); - return str.toString(); } - } diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/TermInfo.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/TermInfo.java index d5628e4..79171da 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/TermInfo.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/TermInfo.java @@ -33,12 +33,13 @@ public final class TermInfo extends ASN1Any { public ASN1Integer s_globalOccurrences; // optional public OccurrenceByAttributes s_byAttributes; // optional public OtherInformation s_otherTermInfo; // optional + /** * Default constructor for a TermInfo. */ - public TermInfo() { } + /** * Constructor for a TermInfo from a BER encoding. * @@ -48,9 +49,7 @@ public final class TermInfo extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public TermInfo(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public TermInfo(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -63,10 +62,8 @@ public final class TermInfo extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ - - public void - berDecode(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + @Override + public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // TermInfo should be encoded by a constructed BER BERConstructed berConstructed; @@ -110,8 +107,8 @@ public final class TermInfo extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 0 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 0 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_displayTerm = new InternationalString(p, false); part++; } @@ -137,8 +134,8 @@ public final class TermInfo extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 4 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 4 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { BERConstructed cons = (BERConstructed) p; int parts = cons.numberComponents(); @@ -160,8 +157,8 @@ public final class TermInfo extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_globalOccurrences = new ASN1Integer(p, false); part++; } @@ -173,8 +170,8 @@ public final class TermInfo extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_byAttributes = new OccurrenceByAttributes(p, false); part++; } @@ -206,10 +203,8 @@ public final class TermInfo extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -221,10 +216,8 @@ public final class TermInfo extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 1; // number of mandatories @@ -307,9 +300,8 @@ public final class TermInfo extends ASN1Any { * Returns a new String object containing a text representing * of the TermInfo. */ - - public String - toString() { + @Override + public String toString() { int p; StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -382,5 +374,4 @@ public final class TermInfo extends ASN1Any { return str.toString(); } - -} \ No newline at end of file +} diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/TriggerResourceControlRequest.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/TriggerResourceControlRequest.java index 69e1924..701d903 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/TriggerResourceControlRequest.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/TriggerResourceControlRequest.java @@ -33,6 +33,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { public ResourceReportId s_prefResourceReportFormat; // optional public ASN1Boolean s_resultSetWanted; // optional public OtherInformation s_otherInfo; // optional + /** * Constructor for a TriggerResourceControlRequest from a BER encoding. * @@ -42,9 +43,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - - public TriggerResourceControlRequest(BEREncoding ber, boolean checkTag) - throws ASN1Exception { + public TriggerResourceControlRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -57,6 +56,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { // TriggerResourceControlRequest should be encoded by a constructed BER @@ -64,7 +64,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { try { berConstructed = (BERConstructed) ber; } catch (ClassCastException e) { - throw new ASN1EncodingException("TriggerResourceControlRequest: bad BER form\n"); + throw new ASN1EncodingException("bad BER form"); } // Prepare to decode the components @@ -77,7 +77,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { if (numParts <= part) { // End of record, but still more elements to get - throw new ASN1Exception("TriggerResourceControlRequest: incomplete"); + throw new ASN1Exception(" incomplete"); } p = berConstructed.elementAt(part); @@ -96,9 +96,9 @@ public final class TriggerResourceControlRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() != 46 || - p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) { - throw new ASN1EncodingException("TriggerResourceControlRequest: bad tag in s_requestedAction\n"); + if (p.getTag() != 46 || + p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) { + throw new ASN1EncodingException(" bad tag in requestedAction"); } s_requestedAction = new ASN1Integer(p, false); @@ -118,8 +118,8 @@ public final class TriggerResourceControlRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 47 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 47 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_prefResourceReportFormat = new ResourceReportId(p, false); part++; } @@ -131,8 +131,8 @@ public final class TriggerResourceControlRequest extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 48 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 48 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_resultSetWanted = new ASN1Boolean(p, false); part++; } @@ -154,7 +154,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("TriggerResourceControlRequest: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -164,6 +164,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ + @Override public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -176,6 +177,7 @@ public final class TriggerResourceControlRequest extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ + @Override public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding @@ -233,9 +235,8 @@ public final class TriggerResourceControlRequest extends ASN1Any { * Returns a new String object containing a text representing * of the TriggerResourceControlRequest. */ - - public String - toString() { + @Override + public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; diff --git a/z3950/src/main/java/org/xbib/io/iso23950/v3/Unit.java b/z3950/src/main/java/org/xbib/io/iso23950/v3/Unit.java index 79f54f5..c02a07a 100644 --- a/z3950/src/main/java/org/xbib/io/iso23950/v3/Unit.java +++ b/z3950/src/main/java/org/xbib/io/iso23950/v3/Unit.java @@ -35,7 +35,6 @@ public final class Unit extends ASN1Any { * usually be passing true. * @throws ASN1Exception if the BER encoding is bad. */ - public Unit(BEREncoding ber, boolean checkTag) throws ASN1Exception { super(ber, checkTag); } @@ -49,6 +48,7 @@ public final class Unit extends ASN1Any { * @param checkTag if the tag should be checked. * @throws ASN1Exception if the BER encoding is bad. */ + @Override public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception { BERConstructed berConstructed; try { @@ -68,17 +68,15 @@ public final class Unit extends ASN1Any { return; // no more data, but ok (rest is optional) } p = berConstructed.elementAt(part); - if (p.tagGet() == 1 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 1 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unitSystem tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unitSystem tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unitSystem tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unitSystem tag bad"); } s_unitSystem = new InternationalString(tagged.elementAt(0), true); @@ -92,17 +90,15 @@ public final class Unit extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 2 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 2 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unitType tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unitType tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unitType tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unitType tag bad"); } s_unitType = new StringOrNumeric(tagged.elementAt(0), true); @@ -116,17 +112,15 @@ public final class Unit extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 3 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 3 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { try { tagged = (BERConstructed) p; } catch (ClassCastException e) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unit tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unit tag bad"); } if (tagged.numberComponents() != 1) { - throw new ASN1EncodingException - ("Unit: bad BER encoding: s_unit tag bad\n"); + throw new ASN1EncodingException("bad BER encoding: s_unit tag bad"); } s_unit = new StringOrNumeric(tagged.elementAt(0), true); @@ -140,8 +134,8 @@ public final class Unit extends ASN1Any { } p = berConstructed.elementAt(part); - if (p.tagGet() == 4 && - p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) { + if (p.getTag() == 4 && + p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) { s_scaleFactor = new ASN1Integer(p, false); part++; } @@ -149,7 +143,7 @@ public final class Unit extends ASN1Any { // Should not be any more parts if (part < numParts) { - throw new ASN1Exception("Unit: bad BER: extra data " + part + "/" + numParts + " processed"); + throw new ASN1Exception("bad BER: extra data " + part + "/" + numParts + " processed"); } } @@ -159,10 +153,8 @@ public final class Unit extends ASN1Any { * @return The BER encoding. * @throws ASN1Exception Invalid or cannot be encoded. */ - - public BEREncoding - berEncode() - throws ASN1Exception { + @Override + public BEREncoding berEncode() throws ASN1Exception { return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG); } @@ -174,10 +166,8 @@ public final class Unit extends ASN1Any { * @return The BER encoding of the object. * @throws ASN1Exception When invalid or cannot be encoded. */ - - public BEREncoding - berEncode(int tagType, int tag) - throws ASN1Exception { + @Override + public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception { // Calculate the number of fields in the encoding int numFields = 0; // number of mandatories @@ -236,6 +226,7 @@ public final class Unit extends ASN1Any { * Returns a new String object containing a text representing * of the Unit. */ + @Override public String toString() { StringBuilder str = new StringBuilder("{"); int outputted = 0; @@ -274,5 +265,4 @@ public final class Unit extends ASN1Any { str.append("}"); return str.toString(); } - } diff --git a/z3950/src/test/java/org/xbib/io/iso23950/SearchTest.java b/z3950/src/test/java/org/xbib/io/iso23950/SearchTest.java index 849d5ad..552aee7 100644 --- a/z3950/src/test/java/org/xbib/io/iso23950/SearchTest.java +++ b/z3950/src/test/java/org/xbib/io/iso23950/SearchTest.java @@ -31,7 +31,7 @@ public class SearchTest { .setDatabases(Collections.singletonList(database)) .setPreferredRecordSyntax(preferredRecordSyntax) .build(); - client.executePQF(query, from, length, + client.searchPQF(query, from, length, (status, total, returned, elapsedMillis) -> logger.log(Level.INFO, "total records = " + total), record -> logger.log(Level.INFO, "found record " + record)); client.close(); diff --git a/z3950/src/test/java/org/xbib/io/iso23950/ZClientTest.java b/z3950/src/test/java/org/xbib/io/iso23950/ZClientTest.java index 15f8e7c..5a260e7 100644 --- a/z3950/src/test/java/org/xbib/io/iso23950/ZClientTest.java +++ b/z3950/src/test/java/org/xbib/io/iso23950/ZClientTest.java @@ -26,7 +26,7 @@ public class ZClientTest { int size = 10; try (ZClient client = newZClient(serviceName)) { logger.log(Level.INFO, "executing CQL " + serviceName); - int count = client.executeCQL(query, from, size, + int count = client.searchCQL(query, from, size, (status, total, returned, elapsedMillis) -> logger.log(Level.INFO, serviceName + " total results = " + total), record -> logger.log(Level.INFO, "record = " + record)); @@ -37,6 +37,24 @@ public class ZClientTest { } } + @Test + public void testGBV() { + String serviceName = "GBV"; + String query = "gbv.controlNumberZDB = 1413423-8"; + int from = 1; + int size = 2; + try (ZClient client = newZClient(serviceName)) { + logger.log(Level.INFO, "executing CQL " + query); + int count = client.searchCQL(query, from, size, + (status, total, returned, elapsedMillis) -> + logger.log(Level.INFO, serviceName + " total results = " + total), + record -> logger.log(Level.INFO, "record = " + record)); + logger.log(Level.INFO, "returned records = " + count); + } catch (Exception e) { + logger.log(Level.SEVERE, e.getMessage(), e); + } + } + @Test public void testPQF() { for (String serviceName : Arrays.asList("LIBRIS", "SWB")) { @@ -45,7 +63,7 @@ public class ZClientTest { int size = 10; try (ZClient client = newZClient(serviceName)) { logger.log(Level.INFO, "executing PQF " + serviceName); - int count = client.executePQF(query, from, size, + int count = client.searchPQF(query, from, size, (status, total, returned, elapsedMillis) -> logger.log(Level.INFO, serviceName + " status = " + status + " total results = " + total), record -> logger.log(Level.INFO, "record = " + record.toString(Charset.forName(client.getEncoding()))));