do not throw exception if present operation returns diagnostics, clean up (mostly underscore style issues)
This commit is contained in:
parent
00412e7577
commit
d0c91568a8
142 changed files with 2794 additions and 4632 deletions
|
@ -1,323 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE module PUBLIC
|
|
||||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
|
||||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
|
||||||
|
|
||||||
<!-- This is a checkstyle configuration file. For descriptions of
|
|
||||||
what the following rules do, please see the checkstyle configuration
|
|
||||||
page at http://checkstyle.sourceforge.net/config.html -->
|
|
||||||
|
|
||||||
<module name="Checker">
|
|
||||||
|
|
||||||
<module name="FileTabCharacter">
|
|
||||||
<!-- Checks that there are no tab characters in the file.
|
|
||||||
-->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NewlineAtEndOfFile">
|
|
||||||
<property name="lineSeparator" value="lf"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RegexpSingleline">
|
|
||||||
<!-- Checks that FIXME is not used in comments. TODO is preferred.
|
|
||||||
-->
|
|
||||||
<property name="format" value="((//.*)|(\*.*))FIXME" />
|
|
||||||
<property name="message" value='TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RegexpSingleline">
|
|
||||||
<!-- Checks that TODOs are named. (Actually, just that they are followed
|
|
||||||
by an open paren.)
|
|
||||||
-->
|
|
||||||
<property name="format" value="((//.*)|(\*.*))TODO[^(]" />
|
|
||||||
<property name="message" value='All TODOs should be named. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocPackage">
|
|
||||||
<!-- Checks that each Java package has a Javadoc file used for commenting.
|
|
||||||
Only allows a package-info.java, not package.html. -->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!-- All Java AST specific tests live under TreeWalker module. -->
|
|
||||||
<module name="TreeWalker">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
IMPORT CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="RedundantImport">
|
|
||||||
<!-- Checks for redundant import statements. -->
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ImportOrder">
|
|
||||||
<!-- Checks for out of order import statements. -->
|
|
||||||
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="groups" value="com.google,android,junit,net,org,java,javax"/>
|
|
||||||
<!-- This ensures that static imports go first. -->
|
|
||||||
<property name="option" value="top"/>
|
|
||||||
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
JAVADOC CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Checks for Javadoc comments. -->
|
|
||||||
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
|
||||||
<module name="JavadocMethod">
|
|
||||||
<property name="scope" value="protected"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="allowMissingJavadoc" value="true"/>
|
|
||||||
<property name="allowMissingParamTags" value="true"/>
|
|
||||||
<property name="allowMissingReturnTag" value="true"/>
|
|
||||||
<property name="allowMissingThrowsTags" value="true"/>
|
|
||||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
|
||||||
<property name="allowUndeclaredRTE" value="true"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocType">
|
|
||||||
<property name="scope" value="protected"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocStyle">
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
NAMING CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Item 38 - Adhere to generally accepted naming conventions -->
|
|
||||||
|
|
||||||
<module name="PackageName">
|
|
||||||
<!-- Validates identifiers for package names against the
|
|
||||||
supplied expression. -->
|
|
||||||
<!-- Here the default checkstyle rule restricts package name parts to
|
|
||||||
seven characters, this is not in line with common practice at Google.
|
|
||||||
-->
|
|
||||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="TypeNameCheck">
|
|
||||||
<!-- Validates static, final fields against the
|
|
||||||
expression "^[A-Z][a-zA-Z0-9]*$". -->
|
|
||||||
<metadata name="altname" value="TypeName"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ConstantNameCheck">
|
|
||||||
<!-- Validates non-private, static, final fields against the supplied
|
|
||||||
public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
|
|
||||||
<metadata name="altname" value="ConstantName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="false"/>
|
|
||||||
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|FLAG_.*)$"/>
|
|
||||||
<message key="name.invalidPattern"
|
|
||||||
value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="StaticVariableNameCheck">
|
|
||||||
<!-- Validates static, non-final fields against the supplied
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*_?$". -->
|
|
||||||
<metadata name="altname" value="StaticVariableName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="true"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="MemberNameCheck">
|
|
||||||
<!-- Validates non-static members against the supplied expression. -->
|
|
||||||
<metadata name="altname" value="MemberName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="true"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="MethodNameCheck">
|
|
||||||
<!-- Validates identifiers for method names. -->
|
|
||||||
<metadata name="altname" value="MethodName"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ParameterName">
|
|
||||||
<!-- Validates identifiers for method parameters against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LocalFinalVariableName">
|
|
||||||
<!-- Validates identifiers for local final variables against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LocalVariableName">
|
|
||||||
<!-- Validates identifiers for local variables against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
LENGTH and CODING CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="LineLength">
|
|
||||||
<!-- Checks if a line is too long. -->
|
|
||||||
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="128"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The default ignore pattern exempts the following elements:
|
|
||||||
- import statements
|
|
||||||
- long URLs inside comments
|
|
||||||
-->
|
|
||||||
|
|
||||||
<property name="ignorePattern"
|
|
||||||
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
|
|
||||||
default="^(package .*;\s*)|(import .*;\s*)|( *(\*|//).*https?://.*)$"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LeftCurly">
|
|
||||||
<!-- Checks for placement of the left curly brace ('{'). -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RightCurly">
|
|
||||||
<!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
|
|
||||||
the same line. e.g., the following example is fine:
|
|
||||||
<pre>
|
|
||||||
if {
|
|
||||||
...
|
|
||||||
} else
|
|
||||||
</pre>
|
|
||||||
-->
|
|
||||||
<!-- This next example is not fine:
|
|
||||||
<pre>
|
|
||||||
if {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
else
|
|
||||||
</pre>
|
|
||||||
-->
|
|
||||||
<property name="option" value="same"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!-- Checks for braces around if and else blocks -->
|
|
||||||
<module name="NeedBraces">
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="UpperEll">
|
|
||||||
<!-- Checks that long constants are defined with an upper ell.-->
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="FallThrough">
|
|
||||||
<!-- Warn about falling through to the next case statement. Similar to
|
|
||||||
javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
|
|
||||||
on the last non-blank line preceding the fallen-into case contains 'fall through' (or
|
|
||||||
some other variants which we don't publicized to promote consistency).
|
|
||||||
-->
|
|
||||||
<property name="reliefPattern"
|
|
||||||
value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
MODIFIERS CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="ModifierOrder">
|
|
||||||
<!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
|
|
||||||
8.4.3. The prescribed order is:
|
|
||||||
public, protected, private, abstract, static, final, transient, volatile,
|
|
||||||
synchronized, native, strictfp
|
|
||||||
-->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
WHITESPACE CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="WhitespaceAround">
|
|
||||||
<!-- Checks that various tokens are surrounded by whitespace.
|
|
||||||
This includes most binary operators and keywords followed
|
|
||||||
by regular or curly braces.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
|
|
||||||
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
|
|
||||||
EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
|
|
||||||
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
|
|
||||||
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
|
|
||||||
MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
|
|
||||||
SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="WhitespaceAfter">
|
|
||||||
<!-- Checks that commas, semicolons and typecasts are followed by
|
|
||||||
whitespace.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="COMMA, SEMI, TYPECAST"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NoWhitespaceAfter">
|
|
||||||
<!-- Checks that there is no whitespace after various unary operators.
|
|
||||||
Linebreaks are allowed.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
|
|
||||||
UNARY_PLUS"/>
|
|
||||||
<property name="allowLineBreaks" value="true"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NoWhitespaceBefore">
|
|
||||||
<!-- Checks that there is no whitespace before various unary operators.
|
|
||||||
Linebreaks are allowed.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
|
|
||||||
<property name="allowLineBreaks" value="true"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ParenPad">
|
|
||||||
<!-- Checks that there is no whitespace before close parens or after
|
|
||||||
open parens.
|
|
||||||
-->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
</module>
|
|
||||||
</module>
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<localRepository>~/.m2/repository</localRepository>
|
|
||||||
<activeProfiles>
|
|
||||||
<activeProfile>xbib</activeProfile>
|
|
||||||
</activeProfiles>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>xbib</id>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>xbib</id>
|
|
||||||
<url>http://xbib.org/repository</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
<updatePolicy>always</updatePolicy>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</settings>
|
|
|
@ -51,8 +51,8 @@ public final class ASN1BitString extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != BIT_STRING_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (berEncoding.getTag() != BIT_STRING_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("ASN.1 BIT STRING: bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + BIT_STRING_TAG + "\n");
|
" expected " + BIT_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
|
|
|
@ -48,9 +48,9 @@ public final class ASN1Boolean extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
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
|
throw new ASN1EncodingException
|
||||||
("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.tagGet() +
|
("ASN.1 BOOLEAN: bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + "TAG\n");
|
" expected " + "TAG\n");
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
|
|
|
@ -13,8 +13,8 @@ public class ASN1Decoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ASN1Any toASN1(BEREncoding ber) throws ASN1Exception {
|
public static ASN1Any toASN1(BEREncoding ber) throws ASN1Exception {
|
||||||
if (ber.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
if (ber.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||||
switch (ber.tagGet()) {
|
switch (ber.getTag()) {
|
||||||
case ASN1Boolean.TAG:
|
case ASN1Boolean.TAG:
|
||||||
return new ASN1Boolean(ber, true);
|
return new ASN1Boolean(ber, true);
|
||||||
case ASN1Integer.INTEGER_TAG:
|
case ASN1Integer.INTEGER_TAG:
|
||||||
|
|
|
@ -52,9 +52,9 @@ public final class ASN1Enumerated extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != ENUMERATED_TAG ||
|
if (checkTag && (berEncoding.getTag() != ENUMERATED_TAG ||
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + ENUMERATED_TAG + "\n");
|
" expected " + ENUMERATED_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (!(berEncoding instanceof BERPrimitive)) {
|
if (!(berEncoding instanceof BERPrimitive)) {
|
||||||
|
|
|
@ -76,8 +76,8 @@ public final class ASN1External extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
if (checkTag && (berEncoding.tagGet() != EXTERNAL_TAG || berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (berEncoding.getTag() != EXTERNAL_TAG || berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + EXTERNAL_TAG + "\n");
|
" expected " + EXTERNAL_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
|
@ -96,31 +96,31 @@ public final class ASN1External extends ASN1Any {
|
||||||
}
|
}
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p = ber.elementAt(part);
|
BEREncoding p = ber.elementAt(part);
|
||||||
if (p.tagGet() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG &&
|
if (p.getTag() == ASN1ObjectIdentifier.OBJECT_IDENTIFIER_TAG &&
|
||||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||||
sDirectReference = new ASN1ObjectIdentifier(p, true);
|
sDirectReference = new ASN1ObjectIdentifier(p, true);
|
||||||
if (numParts <= ++part) {
|
if (numParts <= ++part) {
|
||||||
throw new ASN1EncodingException("incomplete");
|
throw new ASN1EncodingException("incomplete");
|
||||||
}
|
}
|
||||||
p = ber.elementAt(part);
|
p = ber.elementAt(part);
|
||||||
}
|
}
|
||||||
if (p.tagGet() == ASN1Integer.INTEGER_TAG &&
|
if (p.getTag() == ASN1Integer.INTEGER_TAG &&
|
||||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||||
sIndirectReference = new ASN1Integer(p, true);
|
sIndirectReference = new ASN1Integer(p, true);
|
||||||
if (numParts <= ++part) {
|
if (numParts <= ++part) {
|
||||||
throw new ASN1EncodingException("incomplete");
|
throw new ASN1EncodingException("incomplete");
|
||||||
}
|
}
|
||||||
p = ber.elementAt(part);
|
p = ber.elementAt(part);
|
||||||
}
|
}
|
||||||
if (p.tagGet() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG &&
|
if (p.getTag() == ASN1ObjectDescriptor.OBJECT_DESCRIPTOR_TAG &&
|
||||||
p.tagTypeGet() == BEREncoding.UNIVERSAL_TAG) {
|
p.getTagType() == BEREncoding.UNIVERSAL_TAG) {
|
||||||
sDataValueDescriptor = new ASN1ObjectDescriptor(p, true);
|
sDataValueDescriptor = new ASN1ObjectDescriptor(p, true);
|
||||||
if (numParts <= ++part) {
|
if (numParts <= ++part) {
|
||||||
throw new ASN1EncodingException("incomplete");
|
throw new ASN1EncodingException("incomplete");
|
||||||
}
|
}
|
||||||
p = ber.elementAt(part);
|
p = ber.elementAt(part);
|
||||||
}
|
}
|
||||||
switch (p.tagGet()) {
|
switch (p.getTag()) {
|
||||||
case 0:
|
case 0:
|
||||||
if (!(p instanceof BERConstructed)) {
|
if (!(p instanceof BERConstructed)) {
|
||||||
throw new ASN1EncodingException("singleASN1type: bad form, primitive");
|
throw new ASN1EncodingException("singleASN1type: bad form, primitive");
|
||||||
|
@ -132,20 +132,20 @@ public final class ASN1External extends ASN1Any {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// octetAligned [1] IMPLICIT OCTET STRING
|
// 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);
|
throw new ASN1EncodingException("encoding: bad tag type " + p);
|
||||||
}
|
}
|
||||||
cOctetAligned = new ASN1OctetString(p, false);
|
cOctetAligned = new ASN1OctetString(p, false);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// arbitrary [2] IMPLICIT BIT STRING
|
// 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);
|
throw new ASN1EncodingException("encoding: bad tag type " + p);
|
||||||
}
|
}
|
||||||
cArbitrary = new ASN1BitString(p, false);
|
cArbitrary = new ASN1BitString(p, false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ASN1EncodingException("encoding: tag = " + p.tagGet());
|
throw new ASN1EncodingException("encoding: tag = " + p.getTag());
|
||||||
}
|
}
|
||||||
if (part != (numParts - 1)) {
|
if (part != (numParts - 1)) {
|
||||||
throw new ASN1Exception("extra element(s)");
|
throw new ASN1Exception("extra element(s)");
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class ASN1GeneralString extends ASN1OctetString {
|
||||||
public ASN1GeneralString(BEREncoding ber, boolean checkTag)
|
public ASN1GeneralString(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != GENERAL_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != GENERAL_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + GENERAL_STRING_TAG + "\n");
|
" expected " + GENERAL_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ public final class ASN1GeneralizedTime extends ASN1VisibleString {
|
||||||
public ASN1GeneralizedTime(BEREncoding ber, boolean checkTag)
|
public ASN1GeneralizedTime(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != GENERALIZED_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != GENERALIZED_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + GENERALIZED_TIME_TAG + "\n");
|
" expected " + GENERALIZED_TIME_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ public class ASN1GraphicString extends ASN1OctetString {
|
||||||
*/
|
*/
|
||||||
public ASN1GraphicString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ASN1GraphicString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != GRAPHIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != GRAPHIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + GRAPHIC_STRING_TAG + "\n");
|
" expected " + GRAPHIC_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ public final class ASN1IA5String extends ASN1OctetString {
|
||||||
*/
|
*/
|
||||||
public ASN1IA5String(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ASN1IA5String(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != IA5_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != IA5_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + IA5_STRING_TAG + "\n");
|
" expected " + IA5_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ public final class ASN1Integer extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != INTEGER_TAG ||
|
if (checkTag && (berEncoding.getTag() != INTEGER_TAG ||
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + INTEGER_TAG + "\n");
|
" expected " + INTEGER_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (!(berEncoding instanceof BERPrimitive)) {
|
if (!(berEncoding instanceof BERPrimitive)) {
|
||||||
|
|
|
@ -40,9 +40,9 @@ public final class ASN1Null extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != NULL_TAG ||
|
if (checkTag && (berEncoding.getTag() != NULL_TAG ||
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + NULL_TAG + "\n");
|
" expected " + NULL_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (!(berEncoding instanceof BERPrimitive)) {
|
if (!(berEncoding instanceof BERPrimitive)) {
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class ASN1NumericString extends ASN1OctetString {
|
||||||
public ASN1NumericString(BEREncoding ber, boolean checkTag)
|
public ASN1NumericString(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != NUMERIC_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != NUMERIC_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + NUMERIC_STRING_TAG + "\n");
|
" expected " + NUMERIC_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,9 @@ public final class ASN1ObjectDescriptor extends ASN1GraphicString {
|
||||||
public ASN1ObjectDescriptor(BEREncoding ber, boolean checkTag)
|
public ASN1ObjectDescriptor(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
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
|
throw new ASN1EncodingException
|
||||||
("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.tagGet() +
|
("ASN.1 ObjectDescriptor: bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + OBJECT_DESCRIPTOR_TAG + "\n");
|
" expected " + OBJECT_DESCRIPTOR_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,9 +49,9 @@ public final class ASN1ObjectIdentifier extends ASN1Any {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException {
|
public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != OBJECT_IDENTIFIER_TAG ||
|
if (checkTag && (berEncoding.getTag() != OBJECT_IDENTIFIER_TAG ||
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + OBJECT_IDENTIFIER_TAG + "\n");
|
" expected " + OBJECT_IDENTIFIER_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (!(berEncoding instanceof BERPrimitive)) {
|
if (!(berEncoding instanceof BERPrimitive)) {
|
||||||
|
|
|
@ -68,9 +68,9 @@ public class ASN1OctetString extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1EncodingException {
|
throws ASN1EncodingException {
|
||||||
if (checkTag && (berEncoding.tagGet() != OCTET_STRING_TAG ||
|
if (checkTag && (berEncoding.getTag() != OCTET_STRING_TAG ||
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + OCTET_STRING_TAG + "\n");
|
" expected " + OCTET_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
|
|
|
@ -49,8 +49,8 @@ public final class ASN1PrintableString extends ASN1OctetString {
|
||||||
public ASN1PrintableString(BEREncoding ber, boolean checkTag)
|
public ASN1PrintableString(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != PRINTABLE_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != PRINTABLE_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("ASN.1 PrintableString: bad BER: tag=" + ber.getTag() +
|
||||||
" expected " + PRINTABLE_STRING_TAG + "\n");
|
" expected " + PRINTABLE_STRING_TAG + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ public final class ASN1Sequence extends ASN1Any {
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
||||||
throws ASN1Exception {
|
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
|
throw new ASN1EncodingException
|
||||||
("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.tagGet() +
|
("ASN.1 SEQUENCE: bad BER: tag=" + berEncoding.getTag() +
|
||||||
" expected " + SEQUENCE_TAG + "\n");
|
" expected " + SEQUENCE_TAG + "\n");
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
|
|
|
@ -53,12 +53,10 @@ public final class ASN1Set extends ASN1Any {
|
||||||
* @throws ASN1Exception If the BER encoding is incorrect.
|
* @throws ASN1Exception If the BER encoding is incorrect.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void berDecode(BEREncoding berEncoding, boolean checkTag)
|
public void berDecode(BEREncoding berEncoding, boolean checkTag) throws ASN1Exception {
|
||||||
throws ASN1Exception {
|
if (checkTag && (berEncoding.getTag() != SET_TAG ||
|
||||||
if (checkTag && (berEncoding.tagGet() != SET_TAG ||
|
berEncoding.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
berEncoding.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.getTag() + " expected " + SET_TAG);
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + berEncoding.tagGet() +
|
|
||||||
" expected " + SET_TAG + "\n");
|
|
||||||
}
|
}
|
||||||
if (berEncoding instanceof BERPrimitive) {
|
if (berEncoding instanceof BERPrimitive) {
|
||||||
throw new ASN1EncodingException("bad form, primitive");
|
throw new ASN1EncodingException("bad form, primitive");
|
||||||
|
|
|
@ -35,10 +35,8 @@ public final class ASN1T61String extends ASN1OctetString {
|
||||||
public ASN1T61String(BEREncoding ber, boolean checkTag)
|
public ASN1T61String(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != T61_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != T61_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("ASN.1 T61String: bad BER: tag=" + ber.getTag() + " expected " + T61_STRING_TAG);
|
||||||
("ASN.1 T61String: bad BER: tag=" + ber.tagGet() +
|
|
||||||
" expected " + T61_STRING_TAG + "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,10 @@ public final class ASN1UTCTime extends ASN1VisibleString {
|
||||||
* @param checkTag If true, it checks the tag. Use false if is implicitly tagged.
|
* @param checkTag If true, it checks the tag. Use false if is implicitly tagged.
|
||||||
* @throws ASN1Exception If the BER encoding is incorrect.
|
* @throws ASN1Exception If the BER encoding is incorrect.
|
||||||
*/
|
*/
|
||||||
public ASN1UTCTime(BEREncoding ber, boolean checkTag)
|
public ASN1UTCTime(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
throws ASN1Exception {
|
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != UTC_TIME_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != UTC_TIME_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + UTC_TIME_TAG);
|
||||||
("ASN.1 UTCTime: bad BER: tag=" + ber.tagGet() +
|
|
||||||
" expected " + UTC_TIME_TAG + "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,9 +30,8 @@ public class ASN1VideotexString extends ASN1OctetString {
|
||||||
*/
|
*/
|
||||||
public ASN1VideotexString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ASN1VideotexString(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != VIDEOTEX_STRING_TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != VIDEOTEX_STRING_TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + VIDEOTEX_STRING_TAG);
|
||||||
" expected " + VIDEOTEX_STRING_TAG + "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,8 @@ public class ASN1VisibleString extends ASN1OctetString {
|
||||||
public ASN1VisibleString(BEREncoding ber, boolean checkTag)
|
public ASN1VisibleString(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, false);
|
super(ber, false);
|
||||||
if (checkTag && (ber.tagGet() != TAG || ber.tagTypeGet() != BEREncoding.UNIVERSAL_TAG)) {
|
if (checkTag && (ber.getTag() != TAG || ber.getTagType() != BEREncoding.UNIVERSAL_TAG)) {
|
||||||
throw new ASN1EncodingException("bad BER: tag=" + ber.tagGet() +
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected " + TAG);
|
||||||
" expected " + TAG + "\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class BERConstructed extends BEREncoding {
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
int contentLength = 0;
|
int contentLength = 0;
|
||||||
for (BEREncoding element : elements) {
|
for (BEREncoding element : elements) {
|
||||||
contentLength += element.iTotalLength;
|
contentLength += element.totalLength;
|
||||||
}
|
}
|
||||||
init(asn1Class, true, tag, contentLength);
|
init(asn1Class, true, tag, contentLength);
|
||||||
contentElements = elements;
|
contentElements = elements;
|
||||||
|
@ -65,7 +65,7 @@ public class BERConstructed extends BEREncoding {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("[");
|
StringBuilder str = new StringBuilder("[");
|
||||||
switch (iTagType) {
|
switch (tagType) {
|
||||||
case BEREncoding.UNIVERSAL_TAG:
|
case BEREncoding.UNIVERSAL_TAG:
|
||||||
str.append("UNIVERSAL ");
|
str.append("UNIVERSAL ");
|
||||||
break;
|
break;
|
||||||
|
@ -81,7 +81,7 @@ public class BERConstructed extends BEREncoding {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str.append(String.valueOf(iTag)).append("]{");
|
str.append(String.valueOf(tag)).append("]{");
|
||||||
for (int x = 0; x < contentElements.length; x++) {
|
for (int x = 0; x < contentElements.length; x++) {
|
||||||
if (x != 0) {
|
if (x != 0) {
|
||||||
str.append(',');
|
str.append(',');
|
||||||
|
@ -96,10 +96,10 @@ public class BERConstructed extends BEREncoding {
|
||||||
* This protected method is used to implement the "get_encoding" method.
|
* This protected method is used to implement the "get_encoding" method.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int iEncodingGet(int offset, byte[] data) {
|
protected int getEncoding(int offset, byte[] data) {
|
||||||
int i = iGetHead(offset, data);
|
int i = getHead(offset, data);
|
||||||
for (BEREncoding contentElement : contentElements) {
|
for (BEREncoding contentElement : contentElements) {
|
||||||
i = contentElement.iEncodingGet(i, data);
|
i = contentElement.getEncoding(i, data);
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,20 +50,20 @@ public abstract class BEREncoding {
|
||||||
* the same as that encoded in the identiferEncoding.
|
* the same as that encoded in the identiferEncoding.
|
||||||
* This is an internal member. You should not use this.
|
* 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 tag number of this BER encoded object. This value must be
|
||||||
* the same as that encoded in the identiferEncoding.
|
* the same as that encoded in the identiferEncoding.
|
||||||
* This is an internal member. You should not use this.
|
* 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
|
* The total length of this BER object (the identifier octets, plus
|
||||||
* length octets, plus content octects). This variable must be
|
* length octets, plus content octects). This variable must be
|
||||||
* set up before this object is used (using the init method).
|
* set up before this object is used (using the init method).
|
||||||
* This is an internal member. You should not use this.
|
* 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
|
* Storage for the identifier octets. This variable is set up by
|
||||||
* calling the make_identifer method.
|
* calling the make_identifer method.
|
||||||
|
@ -85,53 +85,28 @@ public abstract class BEREncoding {
|
||||||
return lengthEncoding;
|
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.
|
* Method to examine the tag type of the BER encoded ASN.1 object.
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public int tagTypeGet() {
|
public int getTagType() {
|
||||||
return iTagType;
|
return tagType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to examine the tag number of the BER encoded ASN.1 object.
|
* Method to examine the tag number of the BER encoded ASN.1 object.
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public int tagGet() {
|
public int getTag() {
|
||||||
return iTag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the total number of bytes the encoding occupies.
|
* Returns the total number of bytes the encoding occupies.
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public int totalLength() {
|
public int getTotalLength() {
|
||||||
return iTotalLength;
|
return totalLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,7 +124,7 @@ public abstract class BEREncoding {
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
makeIdentifier(tagType, isConstructed, tag);
|
makeIdentifier(tagType, isConstructed, tag);
|
||||||
makeLength(length);
|
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"
|
* This is used by the superclasses to implement the "encodingGet"
|
||||||
* method.
|
* method.
|
||||||
*/
|
*/
|
||||||
protected int iGetHead(int offset, byte[] data) {
|
protected int getHead(int offset, byte[] data) {
|
||||||
for (int anIdentifierEncoding : identifierEncoding) {
|
for (int anIdentifierEncoding : identifierEncoding) {
|
||||||
data[offset++] = (byte) anIdentifierEncoding;
|
data[offset++] = (byte) anIdentifierEncoding;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +149,7 @@ public abstract class BEREncoding {
|
||||||
* array (as bytes), starting at offset into the array. The
|
* array (as bytes), starting at offset into the array. The
|
||||||
* offset of the last element used plus one is returned.
|
* 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
|
* This private method encodes the identifier octets. When a BER
|
||||||
|
@ -201,12 +176,12 @@ public abstract class BEREncoding {
|
||||||
if (tag < 0) {
|
if (tag < 0) {
|
||||||
throw new ASN1Exception("ASN.1 tag value is negative");
|
throw new ASN1Exception("ASN.1 tag value is negative");
|
||||||
}
|
}
|
||||||
iTagType = tagType & 0xC0;
|
this.tagType = tagType & 0xC0;
|
||||||
b = iTagType;
|
b = this.tagType;
|
||||||
if (isConstructed) {
|
if (isConstructed) {
|
||||||
b |= 0x20;
|
b |= 0x20;
|
||||||
}
|
}
|
||||||
iTag = tag;
|
this.tag = tag;
|
||||||
if (tag <= 30) {
|
if (tag <= 30) {
|
||||||
b |= (tag & 0x1F);
|
b |= (tag & 0x1F);
|
||||||
identifierEncoding = new int[1];
|
identifierEncoding = new int[1];
|
||||||
|
|
|
@ -31,10 +31,18 @@ public class BERPrimitive extends BEREncoding {
|
||||||
* classes. It is not intended that higher level classes create
|
* classes. It is not intended that higher level classes create
|
||||||
* BERPrimitives directly.
|
* 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#UNIVERSAL_TAG
|
||||||
* @see org.xbib.asn1.BEREncoding#APPLICATION_TAG
|
* @see org.xbib.asn1.BEREncoding#APPLICATION_TAG
|
||||||
* @see org.xbib.asn1.BEREncoding#CONTEXT_SPECIFIC_TAG
|
* @see org.xbib.asn1.BEREncoding#CONTEXT_SPECIFIC_TAG
|
||||||
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public BERPrimitive(int asn1Class, int tag, int[] contents) throws ASN1Exception {
|
public BERPrimitive(int asn1Class, int tag, int[] contents) throws ASN1Exception {
|
||||||
init(asn1Class, false, tag, contents.length);
|
init(asn1Class, false, tag, contents.length);
|
||||||
|
@ -44,6 +52,7 @@ public class BERPrimitive extends BEREncoding {
|
||||||
/**
|
/**
|
||||||
* This method allows the content octets to be examined.
|
* This method allows the content octets to be examined.
|
||||||
* Once again, only the ASN.1 standard objects should be using this.
|
* Once again, only the ASN.1 standard objects should be using this.
|
||||||
|
* @return content octets
|
||||||
*/
|
*/
|
||||||
public int[] getContentOctets() {
|
public int[] getContentOctets() {
|
||||||
return contentsOctets;
|
return contentsOctets;
|
||||||
|
@ -52,11 +61,12 @@ public class BERPrimitive extends BEREncoding {
|
||||||
/**
|
/**
|
||||||
* Returns a new String object representing this BER encoded
|
* Returns a new String object representing this BER encoded
|
||||||
* ASN.1 object's value.
|
* ASN.1 object's value.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("[");
|
StringBuilder str = new StringBuilder("[");
|
||||||
switch (iTagType) {
|
switch (tagType) {
|
||||||
case BEREncoding.UNIVERSAL_TAG:
|
case BEREncoding.UNIVERSAL_TAG:
|
||||||
str.append("UNIVERSAL ");
|
str.append("UNIVERSAL ");
|
||||||
break;
|
break;
|
||||||
|
@ -72,7 +82,7 @@ public class BERPrimitive extends BEREncoding {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
str.append(String.valueOf(iTag)).append("] '");
|
str.append(String.valueOf(tag)).append("] '");
|
||||||
for (int octet : contentsOctets) {
|
for (int octet : contentsOctets) {
|
||||||
str.append(hex[(octet >> 4) & 0x0f]);
|
str.append(hex[(octet >> 4) & 0x0f]);
|
||||||
str.append(hex[octet & 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.
|
* This protected method is used to implement the "get_encoding" method.
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected int iEncodingGet(int offset, byte[] data) {
|
protected int getEncoding(int offset, byte[] data) {
|
||||||
int i = iGetHead(offset, data);
|
int i = getHead(offset, data);
|
||||||
for (int contentsOctet : contentsOctets) {
|
for (int contentsOctet : contentsOctets) {
|
||||||
data[i++] = (byte) contentsOctet;
|
data[i++] = (byte) contentsOctet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,8 +147,8 @@ public class InputStreamBERReader implements BERReader {
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
throw new ASN1EncodingException(ERROR);
|
throw new ASN1EncodingException(ERROR);
|
||||||
}
|
}
|
||||||
if (chunk.getITag() == 0 && chunk.getITagType() == BEREncoding.UNIVERSAL_TAG &&
|
if (chunk.getTag() == 0 && chunk.getTagType() == BEREncoding.UNIVERSAL_TAG &&
|
||||||
chunk.getITotalLength() == 2) {
|
chunk.getTotalLength() == 2) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
chunks.add(chunk);
|
chunks.add(chunk);
|
||||||
|
|
25
build.gradle
25
build.gradle
|
@ -1,4 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
|
id "com.github.spotbugs" version "1.6.2"
|
||||||
id "org.sonarqube" version '2.6.1'
|
id "org.sonarqube" version '2.6.1'
|
||||||
id "io.codearte.nexus-staging" version "0.11.0"
|
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(),
|
GroovySystem.getVersion(),
|
||||||
JavaVersion.current()
|
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 {
|
subprojects {
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
apply plugin: 'findbugs'
|
|
||||||
apply plugin: 'pmd'
|
|
||||||
apply plugin: 'checkstyle'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
wagon
|
wagon
|
||||||
|
@ -82,8 +87,6 @@ subprojects {
|
||||||
sign configurations.archives
|
sign configurations.archives
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "${rootProject.projectDir}/gradle/ext.gradle"
|
|
||||||
apply from: "${rootProject.projectDir}/gradle/publish.gradle"
|
apply from: "${rootProject.projectDir}/gradle/publish.gradle"
|
||||||
apply from: "${rootProject.projectDir}/gradle/sonarqube.gradle"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = z3950
|
name = z3950
|
||||||
version = 1.2.0
|
version = 1.2.1
|
||||||
|
|
||||||
xbib-cql.version = 1.2.0
|
xbib-cql.version = 1.2.0
|
||||||
netty.version = 4.1.29.Final
|
netty.version = 4.1.29.Final
|
||||||
|
|
||||||
junit.version = 4.12
|
junit.version = 4.12
|
||||||
wagon.version = 3.0.0
|
wagon.version = 3.0.0
|
||||||
|
|
||||||
|
org.gradle.warning.mode = all
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
tasks.withType(FindBugs) {
|
|
||||||
|
|
||||||
|
spotbugs {
|
||||||
|
toolVersion = '3.1.3'
|
||||||
|
sourceSets = [sourceSets.main]
|
||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
reports {
|
effort = "max"
|
||||||
xml.enabled = false
|
reportLevel = "high"
|
||||||
html.enabled = true
|
}
|
||||||
}
|
spotbugsMain.reports {
|
||||||
|
xml.enabled = false
|
||||||
|
html.enabled = true
|
||||||
|
}
|
||||||
|
spotbugsTest.reports {
|
||||||
|
xml.enabled = false
|
||||||
|
html.enabled = true
|
||||||
}
|
}
|
||||||
tasks.withType(Pmd) {
|
tasks.withType(Pmd) {
|
||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
|
|
|
@ -1,323 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE module PUBLIC
|
|
||||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
|
||||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
|
||||||
|
|
||||||
<!-- This is a checkstyle configuration file. For descriptions of
|
|
||||||
what the following rules do, please see the checkstyle configuration
|
|
||||||
page at http://checkstyle.sourceforge.net/config.html -->
|
|
||||||
|
|
||||||
<module name="Checker">
|
|
||||||
|
|
||||||
<module name="FileTabCharacter">
|
|
||||||
<!-- Checks that there are no tab characters in the file.
|
|
||||||
-->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NewlineAtEndOfFile">
|
|
||||||
<property name="lineSeparator" value="lf"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RegexpSingleline">
|
|
||||||
<!-- Checks that FIXME is not used in comments. TODO is preferred.
|
|
||||||
-->
|
|
||||||
<property name="format" value="((//.*)|(\*.*))FIXME" />
|
|
||||||
<property name="message" value='TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RegexpSingleline">
|
|
||||||
<!-- Checks that TODOs are named. (Actually, just that they are followed
|
|
||||||
by an open paren.)
|
|
||||||
-->
|
|
||||||
<property name="format" value="((//.*)|(\*.*))TODO[^(]" />
|
|
||||||
<property name="message" value='All TODOs should be named. e.g. "TODO(johndoe): Refactor when v2 is released."' />
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocPackage">
|
|
||||||
<!-- Checks that each Java package has a Javadoc file used for commenting.
|
|
||||||
Only allows a package-info.java, not package.html. -->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!-- All Java AST specific tests live under TreeWalker module. -->
|
|
||||||
<module name="TreeWalker">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
IMPORT CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="RedundantImport">
|
|
||||||
<!-- Checks for redundant import statements. -->
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ImportOrder">
|
|
||||||
<!-- Checks for out of order import statements. -->
|
|
||||||
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="groups" value="com.google,android,junit,net,org,java,javax"/>
|
|
||||||
<!-- This ensures that static imports go first. -->
|
|
||||||
<property name="option" value="top"/>
|
|
||||||
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
JAVADOC CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Checks for Javadoc comments. -->
|
|
||||||
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
|
||||||
<module name="JavadocMethod">
|
|
||||||
<property name="scope" value="protected"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="allowMissingJavadoc" value="true"/>
|
|
||||||
<property name="allowMissingParamTags" value="true"/>
|
|
||||||
<property name="allowMissingReturnTag" value="true"/>
|
|
||||||
<property name="allowMissingThrowsTags" value="true"/>
|
|
||||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
|
||||||
<property name="allowUndeclaredRTE" value="true"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocType">
|
|
||||||
<property name="scope" value="protected"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="JavadocStyle">
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
NAMING CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Item 38 - Adhere to generally accepted naming conventions -->
|
|
||||||
|
|
||||||
<module name="PackageName">
|
|
||||||
<!-- Validates identifiers for package names against the
|
|
||||||
supplied expression. -->
|
|
||||||
<!-- Here the default checkstyle rule restricts package name parts to
|
|
||||||
seven characters, this is not in line with common practice at Google.
|
|
||||||
-->
|
|
||||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="TypeNameCheck">
|
|
||||||
<!-- Validates static, final fields against the
|
|
||||||
expression "^[A-Z][a-zA-Z0-9]*$". -->
|
|
||||||
<metadata name="altname" value="TypeName"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ConstantNameCheck">
|
|
||||||
<!-- Validates non-private, static, final fields against the supplied
|
|
||||||
public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
|
|
||||||
<metadata name="altname" value="ConstantName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="false"/>
|
|
||||||
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|FLAG_.*)$"/>
|
|
||||||
<message key="name.invalidPattern"
|
|
||||||
value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="StaticVariableNameCheck">
|
|
||||||
<!-- Validates static, non-final fields against the supplied
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*_?$". -->
|
|
||||||
<metadata name="altname" value="StaticVariableName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="true"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="MemberNameCheck">
|
|
||||||
<!-- Validates non-static members against the supplied expression. -->
|
|
||||||
<metadata name="altname" value="MemberName"/>
|
|
||||||
<property name="applyToPublic" value="true"/>
|
|
||||||
<property name="applyToProtected" value="true"/>
|
|
||||||
<property name="applyToPackage" value="true"/>
|
|
||||||
<property name="applyToPrivate" value="true"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="MethodNameCheck">
|
|
||||||
<!-- Validates identifiers for method names. -->
|
|
||||||
<metadata name="altname" value="MethodName"/>
|
|
||||||
<property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ParameterName">
|
|
||||||
<!-- Validates identifiers for method parameters against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LocalFinalVariableName">
|
|
||||||
<!-- Validates identifiers for local final variables against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LocalVariableName">
|
|
||||||
<!-- Validates identifiers for local variables against the
|
|
||||||
expression "^[a-z][a-zA-Z0-9]*$". -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
LENGTH and CODING CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="LineLength">
|
|
||||||
<!-- Checks if a line is too long. -->
|
|
||||||
<property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="128"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The default ignore pattern exempts the following elements:
|
|
||||||
- import statements
|
|
||||||
- long URLs inside comments
|
|
||||||
-->
|
|
||||||
|
|
||||||
<property name="ignorePattern"
|
|
||||||
value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
|
|
||||||
default="^(package .*;\s*)|(import .*;\s*)|( *(\*|//).*https?://.*)$"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="LeftCurly">
|
|
||||||
<!-- Checks for placement of the left curly brace ('{'). -->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="RightCurly">
|
|
||||||
<!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
|
|
||||||
the same line. e.g., the following example is fine:
|
|
||||||
<pre>
|
|
||||||
if {
|
|
||||||
...
|
|
||||||
} else
|
|
||||||
</pre>
|
|
||||||
-->
|
|
||||||
<!-- This next example is not fine:
|
|
||||||
<pre>
|
|
||||||
if {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
else
|
|
||||||
</pre>
|
|
||||||
-->
|
|
||||||
<property name="option" value="same"/>
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<!-- Checks for braces around if and else blocks -->
|
|
||||||
<module name="NeedBraces">
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
<property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="UpperEll">
|
|
||||||
<!-- Checks that long constants are defined with an upper ell.-->
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="FallThrough">
|
|
||||||
<!-- Warn about falling through to the next case statement. Similar to
|
|
||||||
javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
|
|
||||||
on the last non-blank line preceding the fallen-into case contains 'fall through' (or
|
|
||||||
some other variants which we don't publicized to promote consistency).
|
|
||||||
-->
|
|
||||||
<property name="reliefPattern"
|
|
||||||
value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
MODIFIERS CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="ModifierOrder">
|
|
||||||
<!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
|
|
||||||
8.4.3. The prescribed order is:
|
|
||||||
public, protected, private, abstract, static, final, transient, volatile,
|
|
||||||
synchronized, native, strictfp
|
|
||||||
-->
|
|
||||||
</module>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
WHITESPACE CHECKS
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<module name="WhitespaceAround">
|
|
||||||
<!-- Checks that various tokens are surrounded by whitespace.
|
|
||||||
This includes most binary operators and keywords followed
|
|
||||||
by regular or curly braces.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
|
|
||||||
BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
|
|
||||||
EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
|
|
||||||
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
|
|
||||||
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
|
|
||||||
MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
|
|
||||||
SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="WhitespaceAfter">
|
|
||||||
<!-- Checks that commas, semicolons and typecasts are followed by
|
|
||||||
whitespace.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="COMMA, SEMI, TYPECAST"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NoWhitespaceAfter">
|
|
||||||
<!-- Checks that there is no whitespace after various unary operators.
|
|
||||||
Linebreaks are allowed.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
|
|
||||||
UNARY_PLUS"/>
|
|
||||||
<property name="allowLineBreaks" value="true"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="NoWhitespaceBefore">
|
|
||||||
<!-- Checks that there is no whitespace before various unary operators.
|
|
||||||
Linebreaks are allowed.
|
|
||||||
-->
|
|
||||||
<property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
|
|
||||||
<property name="allowLineBreaks" value="true"/>
|
|
||||||
<property name="severity" value="error"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
<module name="ParenPad">
|
|
||||||
<!-- Checks that there is no whitespace before close parens or after
|
|
||||||
open parens.
|
|
||||||
-->
|
|
||||||
<property name="severity" value="warning"/>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
</module>
|
|
||||||
</module>
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
||||||
<localRepository>~/.m2/repository</localRepository>
|
|
||||||
<activeProfiles>
|
|
||||||
<activeProfile>xbib</activeProfile>
|
|
||||||
</activeProfiles>
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>xbib</id>
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>xbib</id>
|
|
||||||
<url>http://xbib.org/repository</url>
|
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
<updatePolicy>always</updatePolicy>
|
|
||||||
</releases>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
</settings>
|
|
12
z3950/src/main/java/org/xbib/io/iso23950/ScanListener.java
Normal file
12
z3950/src/main/java/org/xbib/io/iso23950/ScanListener.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package org.xbib.io.iso23950;
|
||||||
|
|
||||||
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface ScanListener {
|
||||||
|
|
||||||
|
void onScan(BEREncoding result);
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import java.io.IOException;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface ResponseListener {
|
public interface SearchListener {
|
||||||
|
|
||||||
void onResponse(int status, int total, int returned, long elapsedMillis) throws IOException;
|
void onResponse(int status, int total, int returned, long elapsedMillis) throws IOException;
|
||||||
}
|
}
|
|
@ -1,27 +1,18 @@
|
||||||
package org.xbib.io.iso23950;
|
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.InputStreamBERReader;
|
||||||
import org.xbib.asn1.io.OutputStreamBERWriter;
|
import org.xbib.asn1.io.OutputStreamBERWriter;
|
||||||
import org.xbib.cql.CQLParser;
|
import org.xbib.io.iso23950.operations.CloseOperation;
|
||||||
import org.xbib.io.iso23950.cql.CQLRPNGenerator;
|
|
||||||
import org.xbib.io.iso23950.operations.InitOperation;
|
import org.xbib.io.iso23950.operations.InitOperation;
|
||||||
import org.xbib.io.iso23950.operations.PresentOperation;
|
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.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.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.StringReader;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -136,9 +127,9 @@ public class ZClient implements AutoCloseable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int executeCQL(String query, int offset, int length,
|
public int searchCQL(String query, int offset, int length,
|
||||||
ResponseListener responseListener,
|
SearchListener searchListener,
|
||||||
RecordListener recordListener) throws IOException {
|
RecordListener recordListener) throws IOException {
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
throw new IllegalArgumentException("no query");
|
throw new IllegalArgumentException("no query");
|
||||||
}
|
}
|
||||||
|
@ -146,12 +137,12 @@ public class ZClient implements AutoCloseable {
|
||||||
try {
|
try {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
SearchOperation searchOperation = new SearchOperation(berReader, berWriter, resultSetName, databases, host);
|
SearchOperation searchOperation = new SearchOperation(berReader, berWriter, resultSetName, databases, host);
|
||||||
boolean success = searchOperation.execute(createRPNQueryFromCQL(query));
|
boolean success = searchOperation.executeCQL(query);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query));
|
logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query));
|
||||||
} else {
|
} else {
|
||||||
if (responseListener == null) {
|
if (searchListener == null) {
|
||||||
responseListener = (status, total, returned, elapsedMillis) -> {
|
searchListener = (status, total, returned, elapsedMillis) -> {
|
||||||
logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]",
|
logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]",
|
||||||
elapsedMillis, total, returned, query));
|
elapsedMillis, total, returned, query));
|
||||||
};
|
};
|
||||||
|
@ -167,7 +158,7 @@ public class ZClient implements AutoCloseable {
|
||||||
// avoid condition 13 "Present request out-of-range"
|
// avoid condition 13 "Present request out-of-range"
|
||||||
length = searchOperation.getCount();
|
length = searchOperation.getCount();
|
||||||
}
|
}
|
||||||
present.execute(offset, length, searchOperation.getCount(), responseListener, recordListener);
|
present.execute(offset, length, searchOperation.getCount(), searchListener, recordListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return searchOperation.getCount();
|
return searchOperation.getCount();
|
||||||
|
@ -176,9 +167,9 @@ public class ZClient implements AutoCloseable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int executePQF(String query, int offset, int length,
|
public int searchPQF(String query, int offset, int length,
|
||||||
ResponseListener responseListener,
|
SearchListener searchListener,
|
||||||
RecordListener recordListener) throws IOException {
|
RecordListener recordListener) throws IOException {
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
throw new IllegalArgumentException("no query");
|
throw new IllegalArgumentException("no query");
|
||||||
}
|
}
|
||||||
|
@ -186,18 +177,18 @@ public class ZClient implements AutoCloseable {
|
||||||
try {
|
try {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
SearchOperation search = new SearchOperation(berReader, berWriter, resultSetName, databases, host);
|
SearchOperation search = new SearchOperation(berReader, berWriter, resultSetName, databases, host);
|
||||||
search.execute(createRPNQueryFromPQF(query));
|
search.executePQF(query);
|
||||||
if (!search.isSuccess()) {
|
if (!search.isSuccess()) {
|
||||||
logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query));
|
logger.log(Level.WARNING, MessageFormat.format("search was not a success [{0}]", query));
|
||||||
} else {
|
} else {
|
||||||
if (responseListener == null) {
|
if (searchListener == null) {
|
||||||
responseListener = (status, total, returned, elapsedMillis) -> {
|
searchListener = (status, total, returned, elapsedMillis) -> {
|
||||||
logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]",
|
logger.log(Level.INFO, MessageFormat.format("[{0}ms] [{1}] [{2}] [{3}]",
|
||||||
elapsedMillis, total, returned, query));
|
elapsedMillis, total, returned, query));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (search.getCount() > 0) {
|
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,
|
PresentOperation present = new PresentOperation(berReader, berWriter,
|
||||||
resultSetName, elementSetName, preferredRecordSyntax);
|
resultSetName, elementSetName, preferredRecordSyntax);
|
||||||
if (offset < 1) {
|
if (offset < 1) {
|
||||||
|
@ -208,7 +199,7 @@ public class ZClient implements AutoCloseable {
|
||||||
// avoid condition 13 "Present request out-of-range"
|
// avoid condition 13 "Present request out-of-range"
|
||||||
length = search.getCount();
|
length = search.getCount();
|
||||||
}
|
}
|
||||||
present.execute(offset, length, search.getCount(), responseListener, recordListener);
|
present.execute(offset, length, search.getCount(), searchListener, recordListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return search.getCount();
|
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() {
|
public String getHost() {
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
@ -265,56 +268,6 @@ public class ZClient implements AutoCloseable {
|
||||||
return databases;
|
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 {
|
private void connect() throws IOException {
|
||||||
try {
|
try {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
@ -330,6 +283,7 @@ public class ZClient implements AutoCloseable {
|
||||||
if (initOperation.execute(preferredMessageSize, initListener)) {
|
if (initOperation.execute(preferredMessageSize, initListener)) {
|
||||||
throw new IOException("could not initiate connection");
|
throw new IOException("could not initiate connection");
|
||||||
}
|
}
|
||||||
|
logger.log(Level.INFO, initOperation.getTargetInfo());
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
@ -349,6 +303,28 @@ public class ZClient implements AutoCloseable {
|
||||||
return new Builder();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,27 +46,15 @@ import java.util.Stack;
|
||||||
*/
|
*/
|
||||||
public final class CQLRPNGenerator implements Visitor {
|
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.
|
* Context map.
|
||||||
*/
|
*/
|
||||||
private final Map<String, ResourceBundle> contexts = new HashMap<String, ResourceBundle>() {
|
private final Map<String, ResourceBundle> contexts = new HashMap<String, ResourceBundle>() {
|
||||||
private static final long serialVersionUID = 8199395368653216950L;
|
private static final long serialVersionUID = 8199395368653216950L;
|
||||||
|
|
||||||
{
|
{
|
||||||
put("bib", bib);
|
put("bib", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.bib-1"));
|
||||||
put("dc", dc);
|
put("dc", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.dc"));
|
||||||
|
put("gbv", ResourceBundle.getBundle("org.xbib.io.iso23950.cql.gbv"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private Stack<ASN1Any> result;
|
private Stack<ASN1Any> result;
|
||||||
|
@ -90,10 +78,10 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
}
|
}
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
this.rpnQuery = new RPNQuery();
|
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
|
// Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1
|
||||||
rpnQuery.s_attributeSet = new AttributeSetId();
|
rpnQuery.attributeSet = new AttributeSetId();
|
||||||
rpnQuery.s_attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1});
|
rpnQuery.attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1});
|
||||||
} else {
|
} else {
|
||||||
throw new SyntaxException("unable to generate RPN from CQL");
|
throw new SyntaxException("unable to generate RPN from CQL");
|
||||||
}
|
}
|
||||||
|
@ -154,13 +142,13 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
BooleanOperator op = node.getBooleanGroup().getOperator();
|
BooleanOperator op = node.getBooleanGroup().getOperator();
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case AND:
|
case AND:
|
||||||
rpn.c_rpnRpnOp.s_op.c_and = new ASN1Null();
|
rpn.c_rpnRpnOp.s_op.andOp = new ASN1Null();
|
||||||
break;
|
break;
|
||||||
case OR:
|
case OR:
|
||||||
rpn.c_rpnRpnOp.s_op.c_or = new ASN1Null();
|
rpn.c_rpnRpnOp.s_op.orOp = new ASN1Null();
|
||||||
break;
|
break;
|
||||||
case NOT:
|
case NOT:
|
||||||
rpn.c_rpnRpnOp.s_op.c_and_not = new ASN1Null();
|
rpn.c_rpnRpnOp.s_op.andNotOp = new ASN1Null();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -193,17 +181,17 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
node.getRelation().accept(this);
|
node.getRelation().accept(this);
|
||||||
}
|
}
|
||||||
Operand operand = new Operand();
|
Operand operand = new Operand();
|
||||||
operand.c_attrTerm = new AttributesPlusTerm();
|
operand.attrTerm = new AttributesPlusTerm();
|
||||||
operand.c_attrTerm.sTerm = new org.xbib.io.iso23950.v3.Term();
|
operand.attrTerm.term = new org.xbib.io.iso23950.v3.Term();
|
||||||
operand.c_attrTerm.sTerm.c_general = new ASN1OctetString(node.getTerm().getValue());
|
operand.attrTerm.term.c_general = new ASN1OctetString(node.getTerm().getValue());
|
||||||
Stack<AttributeElement> attrs = new Stack<>();
|
Stack<AttributeElement> attrs = new Stack<>();
|
||||||
ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
||||||
while (any != null) {
|
while (any != null) {
|
||||||
attrs.push((AttributeElement) any);
|
attrs.push((AttributeElement) any);
|
||||||
any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
||||||
}
|
}
|
||||||
operand.c_attrTerm.sAttributes = new AttributeList();
|
operand.attrTerm.attributes = new AttributeList();
|
||||||
operand.c_attrTerm.sAttributes.value = attrs.toArray(new AttributeElement[attrs.size()]);
|
operand.attrTerm.attributes.value = attrs.toArray(new AttributeElement[attrs.size()]);
|
||||||
RPNStructure rpn = new RPNStructure();
|
RPNStructure rpn = new RPNStructure();
|
||||||
rpn.c_op = operand;
|
rpn.c_op = operand;
|
||||||
result.push(rpn);
|
result.push(rpn);
|
||||||
|
@ -248,9 +236,9 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
}
|
}
|
||||||
if (n != 3) {
|
if (n != 3) {
|
||||||
AttributeElement ae = new AttributeElement();
|
AttributeElement ae = new AttributeElement();
|
||||||
ae.sAttributeType = new ASN1Integer(t);
|
ae.attributeType = new ASN1Integer(t);
|
||||||
ae.attributeValue = new AttributeElementAttributeValue();
|
ae.attributeValue = new AttributeElementAttributeValue();
|
||||||
ae.attributeValue.cNumeric = new ASN1Integer(n);
|
ae.attributeValue.numeric = new ASN1Integer(n);
|
||||||
result.push(ae);
|
result.push(ae);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,9 +277,9 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
}
|
}
|
||||||
if (n != 100) {
|
if (n != 100) {
|
||||||
AttributeElement ae = new AttributeElement();
|
AttributeElement ae = new AttributeElement();
|
||||||
ae.sAttributeType = new ASN1Integer(t);
|
ae.attributeType = new ASN1Integer(t);
|
||||||
ae.attributeValue = new AttributeElementAttributeValue();
|
ae.attributeValue = new AttributeElementAttributeValue();
|
||||||
ae.attributeValue.cNumeric = new ASN1Integer(n);
|
ae.attributeValue.numeric = new ASN1Integer(n);
|
||||||
result.push(ae);
|
result.push(ae);
|
||||||
v = v.replaceAll("\\*", "");
|
v = v.replaceAll("\\*", "");
|
||||||
}
|
}
|
||||||
|
@ -318,9 +306,9 @@ public final class CQLRPNGenerator implements Visitor {
|
||||||
int t = 1;
|
int t = 1;
|
||||||
int n = getUseAttr(context, node.getName());
|
int n = getUseAttr(context, node.getName());
|
||||||
AttributeElement ae = new AttributeElement();
|
AttributeElement ae = new AttributeElement();
|
||||||
ae.sAttributeType = new ASN1Integer(t);
|
ae.attributeType = new ASN1Integer(t);
|
||||||
ae.attributeValue = new AttributeElementAttributeValue();
|
ae.attributeValue = new AttributeElementAttributeValue();
|
||||||
ae.attributeValue.cNumeric = new ASN1Integer(n);
|
ae.attributeValue.numeric = new ASN1Integer(n);
|
||||||
result.push(ae);
|
result.push(ae);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.xbib.io.iso23950.netty;
|
package org.xbib.io.iso23950.netty;
|
||||||
|
|
||||||
import io.netty.bootstrap.Bootstrap;
|
import io.netty.bootstrap.Bootstrap;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
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.SocketChannel;
|
||||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import org.xbib.io.iso23950.v3.PDU;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
public class Client {
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NettyZClient {
|
||||||
|
|
||||||
private final EventLoopGroup group;
|
private final EventLoopGroup group;
|
||||||
private final Bootstrap clientBootstrap;
|
private final Bootstrap clientBootstrap;
|
||||||
|
|
||||||
public Client() {
|
public NettyZClient() {
|
||||||
this.group = new NioEventLoopGroup();
|
this.group = new NioEventLoopGroup();
|
||||||
clientBootstrap = new Bootstrap();
|
clientBootstrap = new Bootstrap();
|
||||||
clientBootstrap.group(group);
|
clientBootstrap.group(group);
|
||||||
|
@ -40,15 +42,12 @@ public class Client {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writePDU(PDU pdu) throws IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shutdown() throws InterruptedException {
|
public void shutdown() throws InterruptedException {
|
||||||
group.shutdownGracefully().sync();
|
group.shutdownGracefully().sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Handler extends SimpleChannelInboundHandler {
|
class Handler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext channelHandlerContext){
|
public void channelActive(ChannelHandlerContext channelHandlerContext){
|
||||||
|
@ -62,7 +61,7 @@ public class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
|
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,57 @@
|
||||||
package org.xbib.io.iso23950.operations;
|
package org.xbib.io.iso23950.operations;
|
||||||
|
|
||||||
|
import org.xbib.asn1.ASN1Any;
|
||||||
import org.xbib.asn1.ASN1Exception;
|
import org.xbib.asn1.ASN1Exception;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
import org.xbib.asn1.io.BERReader;
|
import org.xbib.asn1.io.BERReader;
|
||||||
import org.xbib.asn1.io.BERWriter;
|
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;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class AbstractOperation {
|
/**
|
||||||
|
* Class for representing a <code>PDU</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
|
* <pre>
|
||||||
|
* 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
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param <IN> input parameter
|
||||||
|
* @param <OUT> output parameter
|
||||||
|
*/
|
||||||
|
public class AbstractOperation<IN extends ASN1Any, OUT extends ASN1Any> {
|
||||||
|
|
||||||
protected final BERReader reader;
|
protected final BERReader reader;
|
||||||
|
|
||||||
|
@ -19,21 +62,21 @@ public class AbstractOperation {
|
||||||
this.writer = writer;
|
this.writer = writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void writePDU(PDU pdu) throws IOException {
|
protected void write(OUT protocolDataUnit) throws IOException {
|
||||||
try {
|
try {
|
||||||
writer.write(pdu.berEncode());
|
writer.write(encode(protocolDataUnit));
|
||||||
} catch (ASN1Exception ex) {
|
} catch (ASN1Exception ex) {
|
||||||
throw new IOException(ex);
|
throw new IOException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PDU readPDU() throws IOException {
|
protected IN read() throws IOException {
|
||||||
try {
|
try {
|
||||||
BEREncoding ber = reader.read();
|
BEREncoding ber = reader.read();
|
||||||
if (ber == null) {
|
if (ber == null) {
|
||||||
throw new IOException("read PDU error");
|
throw new IOException("read PDU error");
|
||||||
}
|
}
|
||||||
return new PDU(ber, true);
|
return decode(ber);
|
||||||
} catch (ASN1Exception ex) {
|
} catch (ASN1Exception ex) {
|
||||||
throw new IOException(ex);
|
throw new IOException(ex);
|
||||||
} catch (NullPointerException 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");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<Close, Close> {
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,39 +12,42 @@ import org.xbib.io.iso23950.v3.InitializeRequest;
|
||||||
import org.xbib.io.iso23950.v3.InitializeResponse;
|
import org.xbib.io.iso23950.v3.InitializeResponse;
|
||||||
import org.xbib.io.iso23950.v3.InternationalString;
|
import org.xbib.io.iso23950.v3.InternationalString;
|
||||||
import org.xbib.io.iso23950.v3.Options;
|
import org.xbib.io.iso23950.v3.Options;
|
||||||
import org.xbib.io.iso23950.v3.PDU;
|
|
||||||
import org.xbib.io.iso23950.v3.ProtocolVersion;
|
import org.xbib.io.iso23950.v3.ProtocolVersion;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Z39.50 Init operation.
|
* A Z39.50 Init operation.
|
||||||
*/
|
*/
|
||||||
public class InitOperation extends AbstractOperation {
|
public class InitOperation extends AbstractOperation<InitializeResponse, InitializeRequest> {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(InitOperation.class.getName());
|
||||||
|
|
||||||
private final String user;
|
private final String user;
|
||||||
|
|
||||||
private final String pass;
|
private final String pass;
|
||||||
|
|
||||||
|
private String targetInfo;
|
||||||
|
|
||||||
public InitOperation(BERReader reader, BERWriter writer, String user, String pass) {
|
public InitOperation(BERReader reader, BERWriter writer, String user, String pass) {
|
||||||
super(reader, writer);
|
super(reader, writer);
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.pass = pass;
|
this.pass = pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean execute(Integer preferredMessageSize,
|
public boolean execute(Integer preferredMessageSize, InitListener initListener) throws IOException {
|
||||||
InitListener initListener) throws IOException {
|
|
||||||
InitializeRequest init = new InitializeRequest();
|
InitializeRequest init = new InitializeRequest();
|
||||||
boolean[] version = new boolean[3];
|
boolean[] version = new boolean[3];
|
||||||
version[0] = true; // any version, should alwasy be true
|
version[0] = true; // any version, should alwasy be true
|
||||||
version[1] = true; // Z39.50 version 2
|
version[1] = true; // Z39.50 version 2
|
||||||
version[2] = true; // Z39.50 version 3
|
version[2] = true; // Z39.50 version 3
|
||||||
init.s_protocolVersion = new ProtocolVersion();
|
init.protocolVersion = new ProtocolVersion();
|
||||||
init.s_protocolVersion.value = new ASN1BitString(version);
|
init.protocolVersion.value = new ASN1BitString(version);
|
||||||
boolean[] options = new boolean[15];
|
boolean[] options = new boolean[15];
|
||||||
options[0] = true; // search
|
options[0] = true; // search
|
||||||
options[1] = true; // present
|
options[1] = true; // present
|
||||||
options[2] = true; // delete set
|
options[2] = false; // delete set
|
||||||
options[3] = false; // resource-report
|
options[3] = false; // resource-report
|
||||||
options[4] = false; // trigger resource control
|
options[4] = false; // trigger resource control
|
||||||
options[5] = false; // resource control
|
options[5] = false; // resource control
|
||||||
|
@ -57,48 +60,44 @@ public class InitOperation extends AbstractOperation {
|
||||||
options[12] = false; // level 2 segmentation
|
options[12] = false; // level 2 segmentation
|
||||||
options[13] = false; // concurrent operations
|
options[13] = false; // concurrent operations
|
||||||
options[14] = true; // named result sets
|
options[14] = true; // named result sets
|
||||||
init.s_options = new Options();
|
init.options = new Options();
|
||||||
init.s_options.value = new ASN1BitString(options);
|
init.options.value = new ASN1BitString(options);
|
||||||
init.s_preferredMessageSize = new ASN1Integer(preferredMessageSize);
|
init.preferredMessageSize = new ASN1Integer(preferredMessageSize);
|
||||||
init.s_exceptionalRecordSize = new ASN1Integer(preferredMessageSize * 2);
|
init.exceptionalRecordSize = new ASN1Integer(preferredMessageSize * 2);
|
||||||
init.s_implementationId = new InternationalString();
|
init.implementationId = new InternationalString();
|
||||||
init.s_implementationId.value = new ASN1GeneralString("1");
|
init.implementationId.value = new ASN1GeneralString("1");
|
||||||
init.s_implementationName = new InternationalString();
|
init.implementationName = new InternationalString();
|
||||||
init.s_implementationName.value = new ASN1GeneralString("Java ZClient");
|
init.implementationName.value = new ASN1GeneralString("Java ZClient");
|
||||||
init.s_implementationVersion = new InternationalString();
|
init.implementationVersion = new InternationalString();
|
||||||
init.s_implementationVersion.value = new ASN1GeneralString("1.00");
|
init.implementationVersion.value = new ASN1GeneralString("1.00");
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
init.s_idAuthentication = new IdAuthentication();
|
init.idAuthentication = new IdAuthentication();
|
||||||
init.s_idAuthentication.c_idPass = new IdAuthenticationIdPass();
|
init.idAuthentication.idPass = new IdAuthenticationIdPass();
|
||||||
init.s_idAuthentication.c_idPass.s_userId = new InternationalString();
|
init.idAuthentication.idPass.s_userId = new InternationalString();
|
||||||
init.s_idAuthentication.c_idPass.s_userId.value = new ASN1GeneralString(user);
|
init.idAuthentication.idPass.s_userId.value = new ASN1GeneralString(user);
|
||||||
if (pass != null) {
|
if (pass != null) {
|
||||||
init.s_idAuthentication.c_idPass.s_password = new InternationalString();
|
init.idAuthentication.idPass.s_password = new InternationalString();
|
||||||
init.s_idAuthentication.c_idPass.s_password.value = new ASN1GeneralString(pass);
|
init.idAuthentication.idPass.s_password.value = new ASN1GeneralString(pass);
|
||||||
}
|
}
|
||||||
/*if (group != null) {
|
/*if (group != null) {
|
||||||
init.s_idAuthentication.c_idPass.s_groupId = new InternationalString();
|
init.s_idAuthentication.c_idPass.s_groupId = new InternationalString();
|
||||||
init.s_idAuthentication.c_idPass.s_groupId.value = new ASN1GeneralString(group);
|
init.s_idAuthentication.c_idPass.s_groupId.value = new ASN1GeneralString(group);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
PDU pduOut = new PDU();
|
write(init);
|
||||||
pduOut.c_initRequest = init;
|
InitializeResponse initResp = read();
|
||||||
writePDU(pduOut);
|
if (initResp.implementationName != null) {
|
||||||
PDU pduIn = readPDU();
|
targetInfo = initResp.implementationName.toString();
|
||||||
InitializeResponse initResp = pduIn.c_initResponse;
|
if (initResp.implementationVersion != null) {
|
||||||
String targetInfo;
|
targetInfo += " - " + initResp.implementationVersion.toString();
|
||||||
if (initResp.s_implementationName != null) {
|
|
||||||
targetInfo = initResp.s_implementationName.toString();
|
|
||||||
if (initResp.s_implementationVersion != null) {
|
|
||||||
targetInfo += " - " + initResp.s_implementationVersion.toString();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetInfo = "server";
|
targetInfo = "server";
|
||||||
}
|
}
|
||||||
int targetVersion = 0;
|
int targetVersion = 0;
|
||||||
if (initResp.s_protocolVersion != null) {
|
if (initResp.protocolVersion != null) {
|
||||||
for (int n = 0; n < initResp.s_protocolVersion.value.get().length; n++) {
|
for (int n = 0; n < initResp.protocolVersion.value.get().length; n++) {
|
||||||
if (initResp.s_protocolVersion.value.get()[n]) {
|
if (initResp.protocolVersion.value.get()[n]) {
|
||||||
targetVersion = n + 1;
|
targetVersion = n + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,18 +107,20 @@ public class InitOperation extends AbstractOperation {
|
||||||
} else {
|
} else {
|
||||||
targetInfo += " (Version unknown)";
|
targetInfo += " (Version unknown)";
|
||||||
}
|
}
|
||||||
if (initResp.s_userInformationField != null) {
|
if (initResp.userInformationField != null && initResp.userInformationField.getSingleASN1Type() != null) {
|
||||||
if (initResp.s_userInformationField.getSingleASN1Type() != null) {
|
targetInfo += "\n" + initResp.userInformationField.getSingleASN1Type().toString();
|
||||||
targetInfo += "\n" + initResp.s_userInformationField.getSingleASN1Type().toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (initResp.s_otherInfo != null) {
|
if (initResp.otherInfo != null) {
|
||||||
targetInfo += "\n" + initResp.s_otherInfo.toString();
|
targetInfo += "\n" + initResp.otherInfo.toString();
|
||||||
}
|
}
|
||||||
targetInfo = targetInfo.replaceAll("\"", "");
|
targetInfo = targetInfo.replaceAll("\"", "");
|
||||||
if (initListener != null) {
|
if (initListener != null) {
|
||||||
initListener.onInit(targetVersion, targetInfo);
|
initListener.onInit(targetVersion, targetInfo);
|
||||||
}
|
}
|
||||||
return !initResp.s_result.get();
|
return !initResp.result.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTargetInfo() {
|
||||||
|
return targetInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,20 @@ import org.xbib.asn1.ASN1Integer;
|
||||||
import org.xbib.asn1.ASN1ObjectIdentifier;
|
import org.xbib.asn1.ASN1ObjectIdentifier;
|
||||||
import org.xbib.asn1.io.BERReader;
|
import org.xbib.asn1.io.BERReader;
|
||||||
import org.xbib.asn1.io.BERWriter;
|
import org.xbib.asn1.io.BERWriter;
|
||||||
|
import org.xbib.io.iso23950.Diagnostics;
|
||||||
import org.xbib.io.iso23950.ErrorRecord;
|
import org.xbib.io.iso23950.ErrorRecord;
|
||||||
import org.xbib.io.iso23950.Record;
|
import org.xbib.io.iso23950.Record;
|
||||||
import org.xbib.io.iso23950.RecordListener;
|
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.MessageSizeTooSmallException;
|
||||||
import org.xbib.io.iso23950.exceptions.NoRecordsReturnedException;
|
import org.xbib.io.iso23950.exceptions.NoRecordsReturnedException;
|
||||||
import org.xbib.io.iso23950.exceptions.RequestTerminatedByAccessControlException;
|
import org.xbib.io.iso23950.exceptions.RequestTerminatedByAccessControlException;
|
||||||
import org.xbib.io.iso23950.exceptions.RequestTerminatedException;
|
import org.xbib.io.iso23950.exceptions.RequestTerminatedException;
|
||||||
import org.xbib.io.iso23950.exceptions.ZException;
|
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.ElementSetNames;
|
||||||
import org.xbib.io.iso23950.v3.InternationalString;
|
import org.xbib.io.iso23950.v3.InternationalString;
|
||||||
import org.xbib.io.iso23950.v3.NamePlusRecord;
|
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.PresentRequest;
|
||||||
import org.xbib.io.iso23950.v3.PresentRequestRecordComposition;
|
import org.xbib.io.iso23950.v3.PresentRequestRecordComposition;
|
||||||
import org.xbib.io.iso23950.v3.PresentResponse;
|
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 org.xbib.io.iso23950.v3.ResultSetId;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Present operation for Z39.50.
|
* Present operation for Z39.50.
|
||||||
*/
|
*/
|
||||||
public class PresentOperation extends AbstractOperation {
|
public class PresentOperation extends AbstractOperation<PresentResponse, PresentRequest> {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(PresentOperation.class.getName());
|
||||||
|
|
||||||
private final String resultSetName;
|
private final String resultSetName;
|
||||||
|
|
||||||
|
@ -50,49 +56,55 @@ public class PresentOperation extends AbstractOperation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void execute(int offset, int length, int total,
|
public void execute(int offset, int length, int total,
|
||||||
ResponseListener responseListener, RecordListener recordListener) throws IOException {
|
SearchListener searchListener, RecordListener recordListener) throws IOException {
|
||||||
PresentRequest pr = new PresentRequest();
|
PresentRequest presentRequest = new PresentRequest();
|
||||||
pr.s_resultSetId = new ResultSetId();
|
presentRequest.resultSetId = new ResultSetId();
|
||||||
pr.s_resultSetId.value = new InternationalString();
|
presentRequest.resultSetId.value = new InternationalString();
|
||||||
pr.s_resultSetId.value.value = new ASN1GeneralString(resultSetName);
|
presentRequest.resultSetId.value.value = new ASN1GeneralString(resultSetName);
|
||||||
pr.s_resultSetStartPoint = new ASN1Integer(offset);
|
presentRequest.resultSetStartPoint = new ASN1Integer(offset);
|
||||||
pr.s_numberOfRecordsRequested = new ASN1Integer(length);
|
presentRequest.numberOfRecordsRequested = new ASN1Integer(length);
|
||||||
pr.s_recordComposition = new PresentRequestRecordComposition();
|
presentRequest.recordComposition = new PresentRequestRecordComposition();
|
||||||
pr.s_recordComposition.c_simple = new ElementSetNames();
|
presentRequest.recordComposition.simple = new ElementSetNames();
|
||||||
pr.s_recordComposition.c_simple.cGenericElementSetName = new InternationalString();
|
presentRequest.recordComposition.simple.cGenericElementSetName = new InternationalString();
|
||||||
pr.s_recordComposition.c_simple.cGenericElementSetName.value = new ASN1GeneralString(elementSetName);
|
presentRequest.recordComposition.simple.cGenericElementSetName.value = new ASN1GeneralString(elementSetName);
|
||||||
pr.s_preferredRecordSyntax = new ASN1ObjectIdentifier(makeOID(preferredRecordSyntax));
|
presentRequest.preferredRecordSyntax = new ASN1ObjectIdentifier(makeOID(preferredRecordSyntax));
|
||||||
PDU pdu = new PDU();
|
|
||||||
pdu.c_presentRequest = pr;
|
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
writePDU(pdu);
|
write(presentRequest);
|
||||||
pdu = readPDU();
|
PresentResponse response = read();
|
||||||
PresentResponse response = pdu.c_presentResponse;
|
int nReturned = response.numberOfRecordsReturned != null ? response.numberOfRecordsReturned.get() : 0;
|
||||||
int nReturned = response.s_numberOfRecordsReturned != null ? response.s_numberOfRecordsReturned.get() : 0;
|
int status = response.presentStatus.value != null ? response.presentStatus.value.get() : 0;
|
||||||
int status = response.s_presentStatus.value != null ? response.s_presentStatus.value.get() : 0;
|
if (searchListener != null) {
|
||||||
if (responseListener != null) {
|
searchListener.onResponse(status, total, nReturned, System.currentTimeMillis() - millis);
|
||||||
responseListener.onResponse(status, total, nReturned, System.currentTimeMillis() - millis);
|
|
||||||
}
|
}
|
||||||
if (status == PresentStatus.E_success) {
|
if (status == PresentStatus.E_success) {
|
||||||
for (int n = 0; n < nReturned; n++) {
|
for (int n = 0; n < nReturned; n++) {
|
||||||
NamePlusRecord nr = response.s_records.c_responseRecords[n];
|
NamePlusRecord nr = response.records.c_responseRecords[n];
|
||||||
try {
|
try {
|
||||||
if (nr.s_record.c_retrievalRecord != null) {
|
if (nr.record.retrievalRecord != null) {
|
||||||
ASN1External asn1External = new ASN1External(nr.s_record.c_retrievalRecord.berEncode(), true);
|
ASN1External asn1External = new ASN1External(nr.record.retrievalRecord.berEncode(), true);
|
||||||
Record record = new Record(offset + n, asn1External.getcOctetAligned().getBytes());
|
Record record = new Record(offset + n, asn1External.getcOctetAligned().getBytes());
|
||||||
if (recordListener != null) {
|
if (recordListener != null) {
|
||||||
recordListener.onRecord(record);
|
recordListener.onRecord(record);
|
||||||
}
|
}
|
||||||
} else if (nr.s_record.c_surrogateDiagnostic != null) {
|
} else if (nr.record.surrogateDiagnostic != null) {
|
||||||
ASN1External asn1External =
|
DefaultDiagFormat diagFormat = nr.record.surrogateDiagnostic.defaultFormat;
|
||||||
new ASN1External(nr.s_record.c_surrogateDiagnostic.cDefaultFormat.berEncode(), true);
|
if (diagFormat != null) {
|
||||||
ErrorRecord record = new ErrorRecord(offset + n, asn1External.getcOctetAligned().getBytes());
|
logger.log(Level.WARNING, diagFormat.toString());
|
||||||
if (recordListener != null) {
|
}
|
||||||
recordListener.onRecord(record);
|
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) {
|
} 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 {
|
} else {
|
||||||
|
|
|
@ -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<ScanResponse, ScanRequest> {
|
||||||
|
|
||||||
|
private final List<String> databases;
|
||||||
|
|
||||||
|
public ScanOperation(BERReader reader, BERWriter writer,
|
||||||
|
List<String> 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,10 +8,14 @@ import org.xbib.asn1.ASN1Integer;
|
||||||
import org.xbib.asn1.ASN1Sequence;
|
import org.xbib.asn1.ASN1Sequence;
|
||||||
import org.xbib.asn1.io.BERReader;
|
import org.xbib.asn1.io.BERReader;
|
||||||
import org.xbib.asn1.io.BERWriter;
|
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.DatabaseName;
|
||||||
import org.xbib.io.iso23950.v3.InternationalString;
|
import org.xbib.io.iso23950.v3.InternationalString;
|
||||||
import org.xbib.io.iso23950.v3.OtherInformation1;
|
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.PresentStatus;
|
||||||
import org.xbib.io.iso23950.v3.Query;
|
import org.xbib.io.iso23950.v3.Query;
|
||||||
import org.xbib.io.iso23950.v3.RPNQuery;
|
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 org.xbib.io.iso23950.v3.SearchResponse;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketTimeoutException;
|
import java.io.StringReader;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Z39.50 Search operation.
|
* Base class for Z39.50 Search operation.
|
||||||
*/
|
*/
|
||||||
public class SearchOperation extends AbstractOperation {
|
public class SearchOperation extends AbstractOperation<SearchResponse, SearchRequest> {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(SearchOperation.class.getName());
|
||||||
|
|
||||||
private int count = -1;
|
private int count = -1;
|
||||||
|
|
||||||
|
@ -52,73 +60,81 @@ public class SearchOperation extends AbstractOperation {
|
||||||
this.results = new HashMap<>();
|
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 {
|
public boolean execute(RPNQuery rpn) throws IOException {
|
||||||
try {
|
try {
|
||||||
SearchRequest search = new SearchRequest();
|
SearchRequest search = new SearchRequest();
|
||||||
search.s_query = new Query();
|
search.query = new Query();
|
||||||
search.s_query.c_type_1 = rpn;
|
search.query.c_type_1 = rpn;
|
||||||
search.s_smallSetUpperBound = new ASN1Integer(0);
|
search.smallSetUpperBound = new ASN1Integer(0);
|
||||||
search.s_largeSetLowerBound = new ASN1Integer(1);
|
search.largeSetLowerBound = new ASN1Integer(1);
|
||||||
search.s_mediumSetPresentNumber = new ASN1Integer(0);
|
search.mediumSetPresentNumber = new ASN1Integer(0);
|
||||||
search.s_replaceIndicator = new ASN1Boolean(true);
|
search.replaceIndicator = new ASN1Boolean(true);
|
||||||
search.s_resultSetName = new InternationalString();
|
search.resultSetName = new InternationalString();
|
||||||
search.s_resultSetName.value = new ASN1GeneralString(resultSetName);
|
search.resultSetName.value = new ASN1GeneralString(resultSetName);
|
||||||
DatabaseName dbs[] = new DatabaseName[databases.size()];
|
DatabaseName dbs[] = new DatabaseName[databases.size()];
|
||||||
for (int n = 0; n < databases.size(); n++) {
|
for (int n = 0; n < databases.size(); n++) {
|
||||||
dbs[n] = new DatabaseName();
|
dbs[n] = new DatabaseName();
|
||||||
dbs[n].value = new InternationalString();
|
dbs[n].value = new InternationalString();
|
||||||
dbs[n].value.value = new ASN1GeneralString(databases.get(n));
|
dbs[n].value.value = new ASN1GeneralString(databases.get(n));
|
||||||
}
|
}
|
||||||
search.s_databaseNames = dbs;
|
search.databaseNames = dbs;
|
||||||
PDU pduRequest = new PDU();
|
write(search);
|
||||||
pduRequest.c_searchRequest = search;
|
SearchResponse response = read();
|
||||||
writePDU(pduRequest);
|
if (response != null) {
|
||||||
PDU pduResponse = readPDU();
|
if (response.resultCount != null) {
|
||||||
SearchResponse response = pduResponse.c_searchResponse;
|
count = response.resultCount.get();
|
||||||
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) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw new IOException(host + ": " + message);
|
ASN1Boolean b = response.s_searchStatus;
|
||||||
}
|
status = b != null && b.get();
|
||||||
PresentStatus presentStatus = response.s_presentStatus;
|
if (!status) {
|
||||||
if (presentStatus != null && presentStatus.value != null && presentStatus.value.get() == 5) {
|
String message = "no message";
|
||||||
throw new IOException("present status is failure");
|
if (response.s_records != null && response.s_records.c_nonSurrogateDiagnostic != null) {
|
||||||
}
|
int code = response.s_records.c_nonSurrogateDiagnostic.condition.get();
|
||||||
if (response.s_additionalSearchInfo != null && response.s_additionalSearchInfo.value[0] != null) {
|
String addInfo = response.s_records.c_nonSurrogateDiagnostic.addinfo.v2Addinfo.get();
|
||||||
OtherInformation1 info = response.s_additionalSearchInfo.value[0];
|
throw new Diagnostics(code, addInfo);
|
||||||
ASN1Sequence targetSeq = (ASN1Sequence) info.s_information.c_externallyDefinedInfo.getSingleASN1Type();
|
}
|
||||||
ASN1Any[] targets = targetSeq.get();
|
throw new IOException(host + ": error, without diagnostic");
|
||||||
DatabaseName dbName;
|
}
|
||||||
for (int i = 0; i < targets.length; i++) {
|
PresentStatus presentStatus = response.s_presentStatus;
|
||||||
ASN1Sequence target = (ASN1Sequence) targets[i];
|
if (presentStatus != null && presentStatus.value != null && presentStatus.value.get() == 5) {
|
||||||
try {
|
throw new IOException("present status is failure");
|
||||||
ASN1Any[] details = target.get();
|
}
|
||||||
dbName = new DatabaseName(details[0].berEncode(), false);
|
if (response.s_additionalSearchInfo != null && response.s_additionalSearchInfo.value[0] != null) {
|
||||||
if (!dbName.value.value.get().equalsIgnoreCase(databases.get(i))) {
|
OtherInformation1 info = response.s_additionalSearchInfo.value[0];
|
||||||
String message = "database name listed in additional search info " +
|
ASN1Sequence targetSeq = (ASN1Sequence) info.information.c_externallyDefinedInfo.getSingleASN1Type();
|
||||||
"doesn't match database name in names set.";
|
ASN1Any[] targets = targetSeq.get();
|
||||||
throw new IOException(host + ": " + message);
|
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) {
|
} catch (IOException e) {
|
||||||
throw new IOException(host + ": timeout", e);
|
// set host in IOException message
|
||||||
|
throw new IOException(host + ": " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -135,4 +151,19 @@ public class SearchOperation extends AbstractOperation {
|
||||||
return results;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,11 @@ public class PQFRPNGenerator implements Visitor {
|
||||||
public void visit(PQF pqf) {
|
public void visit(PQF pqf) {
|
||||||
if (!result.isEmpty()) {
|
if (!result.isEmpty()) {
|
||||||
this.rpnQuery = new RPNQuery();
|
this.rpnQuery = new RPNQuery();
|
||||||
rpnQuery.s_rpn = (RPNStructure) result.pop();
|
rpnQuery.rpn = (RPNStructure) result.pop();
|
||||||
if (pqf.getAttrSet() == null) {
|
if (pqf.getAttrSet() == null) {
|
||||||
// Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1
|
// Z39.50 BIB-1: urn:oid:1.2.840.10003.3.1
|
||||||
rpnQuery.s_attributeSet = new AttributeSetId();
|
rpnQuery.attributeSet = new AttributeSetId();
|
||||||
rpnQuery.s_attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1});
|
rpnQuery.attributeSet.value = new ASN1ObjectIdentifier(new int[]{1, 2, 840, 10003, 3, 1});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new SyntaxException("no valid PQF found");
|
throw new SyntaxException("no valid PQF found");
|
||||||
|
@ -53,17 +53,17 @@ public class PQFRPNGenerator implements Visitor {
|
||||||
@Override
|
@Override
|
||||||
public void visit(Query query) {
|
public void visit(Query query) {
|
||||||
Operand operand = new Operand();
|
Operand operand = new Operand();
|
||||||
operand.c_attrTerm = new AttributesPlusTerm();
|
operand.attrTerm = new AttributesPlusTerm();
|
||||||
operand.c_attrTerm.sTerm = new org.xbib.io.iso23950.v3.Term();
|
operand.attrTerm.term = new org.xbib.io.iso23950.v3.Term();
|
||||||
operand.c_attrTerm.sTerm.c_general = new ASN1OctetString(query.getTerm().getValue());
|
operand.attrTerm.term.c_general = new ASN1OctetString(query.getTerm().getValue());
|
||||||
Stack<AttributeElement> attrs = new Stack<>();
|
Stack<AttributeElement> attrs = new Stack<>();
|
||||||
ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
ASN1Any any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
||||||
while (any != null) {
|
while (any != null) {
|
||||||
attrs.push((AttributeElement) any);
|
attrs.push((AttributeElement) any);
|
||||||
any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
any = !result.isEmpty() && result.peek() instanceof AttributeElement ? result.pop() : null;
|
||||||
}
|
}
|
||||||
operand.c_attrTerm.sAttributes = new AttributeList();
|
operand.attrTerm.attributes = new AttributeList();
|
||||||
operand.c_attrTerm.sAttributes.value = attrs.toArray(new AttributeElement[attrs.size()]);
|
operand.attrTerm.attributes.value = attrs.toArray(new AttributeElement[attrs.size()]);
|
||||||
RPNStructure rpn = new RPNStructure();
|
RPNStructure rpn = new RPNStructure();
|
||||||
rpn.c_op = operand;
|
rpn.c_op = operand;
|
||||||
if (attrs.size() > 0) {
|
if (attrs.size() > 0) {
|
||||||
|
@ -78,13 +78,13 @@ public class PQFRPNGenerator implements Visitor {
|
||||||
rpn.c_rpnRpnOp = new RPNStructureRpnRpnOp();
|
rpn.c_rpnRpnOp = new RPNStructureRpnRpnOp();
|
||||||
rpn.c_rpnRpnOp.s_op = new Operator();
|
rpn.c_rpnRpnOp.s_op = new Operator();
|
||||||
if ("@and".equals(op)) {
|
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)) {
|
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)) {
|
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_rpn1 = (RPNStructure) result.pop();
|
||||||
rpn.c_rpnRpnOp.s_rpn2 = (RPNStructure) result.pop();
|
rpn.c_rpnRpnOp.s_rpn2 = (RPNStructure) result.pop();
|
||||||
|
@ -94,9 +94,9 @@ public class PQFRPNGenerator implements Visitor {
|
||||||
@Override
|
@Override
|
||||||
public void visit(AttrStr attrspec) {
|
public void visit(AttrStr attrspec) {
|
||||||
AttributeElement ae = new AttributeElement();
|
AttributeElement ae = new AttributeElement();
|
||||||
ae.sAttributeType = (ASN1Integer) result.pop();
|
ae.attributeType = (ASN1Integer) result.pop();
|
||||||
ae.attributeValue = new AttributeElementAttributeValue();
|
ae.attributeValue = new AttributeElementAttributeValue();
|
||||||
ae.attributeValue.cNumeric = (ASN1Integer) result.pop();
|
ae.attributeValue.numeric = (ASN1Integer) result.pop();
|
||||||
result.push(ae);
|
result.push(ae);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ public final class AccessControlRequestSecurityChallenge extends ASN1Any {
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
cSimpleForm = null;
|
cSimpleForm = null;
|
||||||
cExternallyDefined = null;
|
cExternallyDefined = null;
|
||||||
if (ber.tagGet() == 37 &&
|
if (ber.getTag() == 37 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
cSimpleForm = new ASN1OctetString(ber, false);
|
cSimpleForm = new ASN1OctetString(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 0 &&
|
if (ber.getTag() == 0 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
|
|
@ -92,8 +92,8 @@ public final class AccessControlResponse extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 223 &&
|
if (p.getTag() == 223 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
|
|
@ -54,13 +54,13 @@ public final class AccessControlResponseSecurityChallengeResponse extends ASN1An
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
cSimpleForm = null;
|
cSimpleForm = null;
|
||||||
cExternallyDefined = null;
|
cExternallyDefined = null;
|
||||||
if (ber.tagGet() == 38 &&
|
if (ber.getTag() == 38 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
cSimpleForm = new ASN1OctetString(ber, false);
|
cSimpleForm = new ASN1OctetString(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 0 &&
|
if (ber.getTag() == 0 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
|
|
@ -23,14 +23,13 @@ public final class AttributeElement extends ASN1Any {
|
||||||
|
|
||||||
public AttributeSetId attributeSetId; // optional
|
public AttributeSetId attributeSetId; // optional
|
||||||
|
|
||||||
public ASN1Integer sAttributeType;
|
public ASN1Integer attributeType;
|
||||||
|
|
||||||
public AttributeElementAttributeValue attributeValue;
|
public AttributeElementAttributeValue attributeValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a AttributeElement.
|
* Default constructor for a AttributeElement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public AttributeElement() {
|
public AttributeElement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +55,7 @@ public final class AttributeElement extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -70,8 +70,8 @@ public final class AttributeElement extends ASN1Any {
|
||||||
throw new ASN1Exception("AttributeElement: incomplete");
|
throw new ASN1Exception("AttributeElement: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
attributeSetId = new AttributeSetId(p, false);
|
attributeSetId = new AttributeSetId(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -79,11 +79,11 @@ public final class AttributeElement extends ASN1Any {
|
||||||
throw new ASN1Exception("AttributeElement: incomplete");
|
throw new ASN1Exception("AttributeElement: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 120 ||
|
if (p.getTag() != 120 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("AttributeElement: bad tag in s_attributeType\n");
|
throw new ASN1EncodingException("AttributeElement: bad tag in s_attributeType\n");
|
||||||
}
|
}
|
||||||
sAttributeType = new ASN1Integer(p, false);
|
attributeType = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("AttributeElement: incomplete");
|
throw new ASN1Exception("AttributeElement: incomplete");
|
||||||
|
@ -102,6 +102,7 @@ public final class AttributeElement extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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#CONTEXT_SPECIFIC_TAG
|
||||||
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 2;
|
int numFields = 2;
|
||||||
if (attributeSetId != null) {
|
if (attributeSetId != null) {
|
||||||
|
@ -128,7 +130,7 @@ public final class AttributeElement extends ASN1Any {
|
||||||
if (attributeSetId != null) {
|
if (attributeSetId != null) {
|
||||||
fields[x++] = attributeSetId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
|
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();
|
fields[x] = attributeValue.berEncode();
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the AttributeElement.
|
* of the AttributeElement.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
@ -149,7 +152,7 @@ public final class AttributeElement extends ASN1Any {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("attributeType ");
|
str.append("attributeType ");
|
||||||
str.append(sAttributeType);
|
str.append(attributeType);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
|
|
|
@ -18,9 +18,9 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class AttributeElementAttributeValue extends ASN1Any {
|
public final class AttributeElementAttributeValue extends ASN1Any {
|
||||||
|
|
||||||
public ASN1Integer cNumeric;
|
public ASN1Integer numeric;
|
||||||
|
|
||||||
public AttributeElementAttributeValueComplex attributeValueComplex;
|
public AttributeElementAttributeValueComplex complex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a AttributeElement_attributeValue.
|
* Default constructor for a AttributeElement_attributeValue.
|
||||||
|
@ -52,16 +52,16 @@ public final class AttributeElementAttributeValue extends ASN1Any {
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
cNumeric = null;
|
numeric = null;
|
||||||
attributeValueComplex = null;
|
complex = null;
|
||||||
if (ber.tagGet() == 121 &&
|
if (ber.getTag() == 121 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
cNumeric = new ASN1Integer(ber, false);
|
numeric = new ASN1Integer(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 224 &&
|
if (ber.getTag() == 224 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
attributeValueComplex = new AttributeElementAttributeValueComplex(ber, false);
|
complex = new AttributeElementAttributeValueComplex(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new ASN1Exception("AttributeElement_attributeValue: bad BER encoding: choice not matched");
|
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 {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
if (cNumeric != null) {
|
if (numeric != null) {
|
||||||
chosen = cNumeric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 121);
|
chosen = numeric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 121);
|
||||||
}
|
}
|
||||||
if (attributeValueComplex != null) {
|
if (complex != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
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) {
|
if (chosen == null) {
|
||||||
throw new ASN1Exception("CHOICE not set");
|
throw new ASN1Exception("CHOICE not set");
|
||||||
|
@ -101,17 +101,17 @@ public final class AttributeElementAttributeValue extends ASN1Any {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (cNumeric != null) {
|
if (numeric != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("numeric ");
|
str.append("numeric ");
|
||||||
str.append(cNumeric);
|
str.append(numeric);
|
||||||
}
|
}
|
||||||
if (attributeValueComplex != null) {
|
if (complex != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: complex> ");
|
str.append("<ERROR: multiple CHOICE: complex> ");
|
||||||
}
|
}
|
||||||
str.append("complex ");
|
str.append("complex ");
|
||||||
str.append(attributeValueComplex);
|
str.append(complex);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -20,8 +20,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
||||||
|
|
||||||
public StringOrNumeric[] sList;
|
public StringOrNumeric[] list;
|
||||||
public ASN1Integer[] sSemanticAction; // optional
|
public ASN1Integer[] semanticAction; // optional
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a AttributeElement_attributeValue_complex from a BER encoding.
|
* Constructor for a AttributeElement_attributeValue_complex from a BER encoding.
|
||||||
|
@ -32,8 +32,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
public AttributeElementAttributeValueComplex(BEREncoding ber, boolean checkTag)
|
public AttributeElementAttributeValueComplex(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
throws ASN1Exception {
|
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +45,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -60,36 +60,36 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
||||||
throw new ASN1Exception("AttributeElement_attributeValue_complex: incomplete");
|
throw new ASN1Exception("AttributeElement_attributeValue_complex: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("AttributeElement_attributeValue_complex: bad tag in s_list\n");
|
throw new ASN1EncodingException("AttributeElement_attributeValue_complex: bad tag in s_list\n");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
sList = new StringOrNumeric[parts];
|
list = new StringOrNumeric[parts];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < parts; 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) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("Bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
sSemanticAction = null;
|
semanticAction = null;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 2 &&
|
if (p.getTag() == 2 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
sSemanticAction = new ASN1Integer[parts];
|
semanticAction = new ASN1Integer[parts];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < parts; 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) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("Bad BER");
|
||||||
|
@ -108,6 +108,7 @@ public final class AttributeElementAttributeValueComplex extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (sSemanticAction != null) {
|
if (semanticAction != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding f2[];
|
BEREncoding f2[];
|
||||||
int p;
|
int p;
|
||||||
f2 = new BEREncoding[sList.length];
|
f2 = new BEREncoding[list.length];
|
||||||
for (p = 0; p < sList.length; p++) {
|
for (p = 0; p < list.length; p++) {
|
||||||
f2[p] = sList[p].berEncode();
|
f2[p] = list[p].berEncode();
|
||||||
}
|
}
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, f2);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, f2);
|
||||||
if (sSemanticAction != null) {
|
if (semanticAction != null) {
|
||||||
f2 = new BEREncoding[sSemanticAction.length];
|
f2 = new BEREncoding[semanticAction.length];
|
||||||
for (p = 0; p < sSemanticAction.length; p++) {
|
for (p = 0; p < semanticAction.length; p++) {
|
||||||
f2[p] = sSemanticAction[p].berEncode();
|
f2[p] = semanticAction[p].berEncode();
|
||||||
}
|
}
|
||||||
fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 2, f2);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the AttributeElement_attributeValue_complex.
|
* of the AttributeElement_attributeValue_complex.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("list ");
|
str.append("list ");
|
||||||
str.append("{");
|
str.append("{");
|
||||||
for (p = 0; p < sList.length; p++) {
|
for (p = 0; p < list.length; p++) {
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append(sList[p]);
|
str.append(list[p]);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
outputted++;
|
outputted++;
|
||||||
if (sSemanticAction != null) {
|
if (semanticAction != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("semanticAction ");
|
str.append("semanticAction ");
|
||||||
str.append("{");
|
str.append("{");
|
||||||
for (p = 0; p < sSemanticAction.length; p++) {
|
for (p = 0; p < semanticAction.length; p++) {
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append(sSemanticAction[p]);
|
str.append(semanticAction[p]);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,12 @@ public final class AttributeList extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 44 ||
|
if (ber.getTag() != 44 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("AttributeList: bad BER: tag=" + ber.tagGet() + " expected 44\n");
|
throw new ASN1EncodingException("AttributeList: bad BER: tag=" + ber.getTag() + " expected 44\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -73,6 +74,7 @@ public final class AttributeList extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 44);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 44);
|
||||||
}
|
}
|
||||||
|
@ -85,6 +87,7 @@ public final class AttributeList extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
BEREncoding fields[] = new BERConstructed[value.length];
|
BEREncoding fields[] = new BERConstructed[value.length];
|
||||||
int p;
|
int p;
|
||||||
|
@ -98,6 +101,7 @@ public final class AttributeList extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the AttributeList.
|
* of the AttributeList.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int p;
|
int p;
|
||||||
|
|
|
@ -45,6 +45,7 @@ public final class AttributeSetId extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
value = new ASN1ObjectIdentifier(ber, checkTag);
|
value = new ASN1ObjectIdentifier(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -55,6 +56,7 @@ public final class AttributeSetId extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return value.berEncode();
|
return value.berEncode();
|
||||||
}
|
}
|
||||||
|
@ -67,6 +69,7 @@ public final class AttributeSetId extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +78,7 @@ public final class AttributeSetId extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the AttributeSetId.
|
* of the AttributeSetId.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,13 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class AttributesPlusTerm extends ASN1Any {
|
public final class AttributesPlusTerm extends ASN1Any {
|
||||||
|
|
||||||
public AttributeList sAttributes;
|
public AttributeList attributes;
|
||||||
|
|
||||||
public Term sTerm;
|
public Term term;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a AttributesPlusTerm.
|
* Default constructor for a AttributesPlusTerm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public AttributesPlusTerm() {
|
public AttributesPlusTerm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +37,7 @@ public final class AttributesPlusTerm extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,38 +50,37 @@ public final class AttributesPlusTerm extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 102 ||
|
if (ber.getTag() != 102 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 102");
|
||||||
("AttributesPlusTerm: bad BER: tag=" + ber.tagGet() + " expected 102\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("AttributesPlusTerm: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("AttributesPlusTerm: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sAttributes = new AttributeList(p, true);
|
attributes = new AttributeList(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("AttributesPlusTerm: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sTerm = new Term(p, true);
|
term = new Term(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 102);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 102);
|
||||||
}
|
}
|
||||||
|
@ -106,12 +103,13 @@ public final class AttributesPlusTerm extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 2;
|
int numFields = 2;
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
fields[x++] = sAttributes.berEncode();
|
fields[x++] = attributes.berEncode();
|
||||||
fields[x] = sTerm.berEncode();
|
fields[x] = term.berEncode();
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the AttributesPlusTerm.
|
* of the AttributesPlusTerm.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("attributes ");
|
str.append("attributes ");
|
||||||
str.append(sAttributes);
|
str.append(attributes);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("term ");
|
str.append("term ");
|
||||||
str.append(sTerm);
|
str.append(term);
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,17 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class Close extends ASN1Any {
|
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.
|
* Default constructor for a Close.
|
||||||
|
@ -66,6 +66,7 @@ public final class Close extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -82,45 +83,45 @@ public final class Close extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
try {
|
try {
|
||||||
sReferenceId = new ReferenceId(p, true);
|
referenceId = new ReferenceId(p, true);
|
||||||
part++;
|
part++;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
sReferenceId = null;
|
referenceId = null;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("Close: incomplete");
|
throw new ASN1Exception("Close: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sCloseReason = new CloseReason(p, true);
|
closeReason = new CloseReason(p, true);
|
||||||
part++;
|
part++;
|
||||||
sDiagnosticInformation = null;
|
diagnosticInformation = null;
|
||||||
sResourceReportFormat = null;
|
resourceReportFormat = null;
|
||||||
sResourceReport = null;
|
resourceReport = null;
|
||||||
sOtherInfo = null;
|
otherInformation = null;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 3 &&
|
if (p.getTag() == 3 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sDiagnosticInformation = new InternationalString(p, false);
|
diagnosticInformation = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 4 &&
|
if (p.getTag() == 4 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sResourceReportFormat = new ResourceReportId(p, false);
|
resourceReportFormat = new ResourceReportId(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 5 &&
|
if (p.getTag() == 5 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
|
@ -129,7 +130,7 @@ public final class Close extends ASN1Any {
|
||||||
if (tagged.numberComponents() != 1) {
|
if (tagged.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException("Close: bad BER encoding: s_resourceReport tag bad");
|
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++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
|
@ -137,10 +138,10 @@ public final class Close extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
try {
|
try {
|
||||||
sOtherInfo = new OtherInformation(p, true);
|
otherInformation = new OtherInformation(p, true);
|
||||||
part++;
|
part++;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
sOtherInfo = null;
|
otherInformation = null;
|
||||||
}
|
}
|
||||||
if (part < numParts) {
|
if (part < numParts) {
|
||||||
throw new ASN1Exception("Close: bad BER: extra data " + part + "/" + numParts + " processed");
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (sReferenceId != null) {
|
if (referenceId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (sDiagnosticInformation != null) {
|
if (diagnosticInformation != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (sResourceReportFormat != null) {
|
if (resourceReportFormat != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (sResourceReport != null) {
|
if (resourceReport != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (sOtherInfo != null) {
|
if (otherInformation != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
BEREncoding[] fields = new BEREncoding[numFields];
|
BEREncoding[] fields = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding[] enc;
|
BEREncoding[] enc;
|
||||||
if (sReferenceId != null) {
|
if (referenceId != null) {
|
||||||
fields[x++] = sReferenceId.berEncode();
|
fields[x++] = referenceId.berEncode();
|
||||||
}
|
}
|
||||||
fields[x++] = sCloseReason.berEncode();
|
fields[x++] = closeReason.berEncode();
|
||||||
if (sDiagnosticInformation != null) {
|
if (diagnosticInformation != null) {
|
||||||
fields[x++] = sDiagnosticInformation.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3);
|
fields[x++] = diagnosticInformation.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 3);
|
||||||
}
|
}
|
||||||
if (sResourceReportFormat != null) {
|
if (resourceReportFormat != null) {
|
||||||
fields[x++] = sResourceReportFormat.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4);
|
fields[x++] = resourceReportFormat.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4);
|
||||||
}
|
}
|
||||||
if (sResourceReport != null) {
|
if (resourceReport != null) {
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = sResourceReport.berEncode();
|
enc[0] = resourceReport.berEncode();
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc);
|
||||||
}
|
}
|
||||||
if (sOtherInfo != null) {
|
if (otherInformation != null) {
|
||||||
fields[x] = sOtherInfo.berEncode();
|
fields[x] = otherInformation.berEncode();
|
||||||
}
|
}
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the Close.
|
* of the Close.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
if (sReferenceId != null) {
|
if (referenceId != null) {
|
||||||
str.append("referenceId ");
|
str.append("referenceId ");
|
||||||
str.append(sReferenceId);
|
str.append(referenceId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("closeReason ");
|
str.append("closeReason ");
|
||||||
str.append(sCloseReason);
|
str.append(closeReason);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (sDiagnosticInformation != null) {
|
if (diagnosticInformation != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("diagnosticInformation ");
|
str.append("diagnosticInformation ");
|
||||||
str.append(sDiagnosticInformation);
|
str.append(diagnosticInformation);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
if (sResourceReportFormat != null) {
|
if (resourceReportFormat != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("resourceReportFormat ");
|
str.append("resourceReportFormat ");
|
||||||
str.append(sResourceReportFormat);
|
str.append(resourceReportFormat);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
if (sResourceReport != null) {
|
if (resourceReport != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("resourceReport ");
|
str.append("resourceReport ");
|
||||||
str.append(sResourceReport);
|
str.append(resourceReport);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
if (sOtherInfo != null) {
|
if (otherInformation != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("otherInfo ");
|
str.append("otherInfo ");
|
||||||
str.append(sOtherInfo);
|
str.append(otherInformation);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -55,11 +55,12 @@ public final class CloseReason extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 211 ||
|
if (ber.getTag() != 211 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("CloseReason: bad BER: tag=" + ber.tagGet() + " expected 211");
|
throw new ASN1EncodingException("CloseReason: bad BER: tag=" + ber.getTag() + " expected 211");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = new ASN1Integer(ber, false);
|
value = new ASN1Integer(ber, false);
|
||||||
|
@ -71,6 +72,7 @@ public final class CloseReason extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 211);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 211);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +85,7 @@ public final class CloseReason extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -91,6 +94,7 @@ public final class CloseReason extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the CloseReason.
|
* of the CloseReason.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,18 +23,14 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class CompSpec extends ASN1Any {
|
public final class CompSpec extends ASN1Any {
|
||||||
|
|
||||||
public ASN1Boolean sSelectAlternativeSyntax;
|
public ASN1Boolean selectAlternativeSyntax;
|
||||||
|
|
||||||
public Specification sGeneric; // optional
|
public Specification sGeneric; // optional
|
||||||
|
|
||||||
public CompSpecDbSpecific[] dbSpecifics; // optional
|
public CompSpecDbSpecific[] dbSpecifics; // optional
|
||||||
|
public ASN1ObjectIdentifier[] recordSyntax; // optional
|
||||||
public ASN1ObjectIdentifier[] objectIdentifiers; // optional
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a CompSpec.
|
* Default constructor for a CompSpec.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public CompSpec() {
|
public CompSpec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +56,7 @@ public final class CompSpec extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -74,21 +71,21 @@ public final class CompSpec extends ASN1Any {
|
||||||
throw new ASN1Exception("CompSpec: incomplete");
|
throw new ASN1Exception("CompSpec: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("CompSpec: bad tag in s_selectAlternativeSyntax\n");
|
throw new ASN1EncodingException("CompSpec: bad tag in s_selectAlternativeSyntax\n");
|
||||||
}
|
}
|
||||||
sSelectAlternativeSyntax = new ASN1Boolean(p, false);
|
selectAlternativeSyntax = new ASN1Boolean(p, false);
|
||||||
part++;
|
part++;
|
||||||
sGeneric = null;
|
sGeneric = null;
|
||||||
dbSpecifics = null;
|
dbSpecifics = null;
|
||||||
objectIdentifiers = null;
|
recordSyntax = null;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 2 &&
|
if (p.getTag() == 2 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sGeneric = new Specification(p, false);
|
sGeneric = new Specification(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -96,8 +93,8 @@ public final class CompSpec extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 3 &&
|
if (p.getTag() == 3 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
|
@ -115,15 +112,15 @@ public final class CompSpec extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 4 &&
|
if (p.getTag() == 4 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
objectIdentifiers = new ASN1ObjectIdentifier[parts];
|
recordSyntax = new ASN1ObjectIdentifier[parts];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < parts; 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) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("Bad BER");
|
||||||
|
@ -141,6 +138,7 @@ public final class CompSpec extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (sGeneric != null) {
|
if (sGeneric != null) {
|
||||||
|
@ -161,14 +160,14 @@ public final class CompSpec extends ASN1Any {
|
||||||
if (dbSpecifics != null) {
|
if (dbSpecifics != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (objectIdentifiers != null) {
|
if (recordSyntax != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding f2[];
|
BEREncoding f2[];
|
||||||
int p;
|
int p;
|
||||||
fields[x++] = sSelectAlternativeSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
|
fields[x++] = selectAlternativeSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
|
||||||
if (sGeneric != null) {
|
if (sGeneric != null) {
|
||||||
fields[x++] = sGeneric.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 2);
|
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);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, f2);
|
||||||
}
|
}
|
||||||
if (objectIdentifiers != null) {
|
if (recordSyntax != null) {
|
||||||
f2 = new BEREncoding[objectIdentifiers.length];
|
f2 = new BEREncoding[recordSyntax.length];
|
||||||
for (p = 0; p < objectIdentifiers.length; p++) {
|
for (p = 0; p < recordSyntax.length; p++) {
|
||||||
f2[p] = objectIdentifiers[p].berEncode();
|
f2[p] = recordSyntax[p].berEncode();
|
||||||
}
|
}
|
||||||
fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 4, f2);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the CompSpec.
|
* of the CompSpec.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("selectAlternativeSyntax ");
|
str.append("selectAlternativeSyntax ");
|
||||||
str.append(sSelectAlternativeSyntax);
|
str.append(selectAlternativeSyntax);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (sGeneric != null) {
|
if (sGeneric != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
|
@ -223,17 +223,17 @@ public final class CompSpec extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
if (objectIdentifiers != null) {
|
if (recordSyntax != null) {
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("recordSyntax ");
|
str.append("recordSyntax ");
|
||||||
str.append("{");
|
str.append("{");
|
||||||
for (p = 0; p < objectIdentifiers.length; p++) {
|
for (p = 0; p < recordSyntax.length; p++) {
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append(objectIdentifiers[p]);
|
str.append(recordSyntax[p]);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public final class CompSpecDbSpecific extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -60,8 +61,8 @@ public final class CompSpecDbSpecific extends ASN1Any {
|
||||||
throw new ASN1Exception("CompSpec_dbSpecific: incomplete");
|
throw new ASN1Exception("CompSpec_dbSpecific: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException
|
||||||
("CompSpec_dbSpecific: bad tag in s_db\n");
|
("CompSpec_dbSpecific: bad tag in s_db\n");
|
||||||
}
|
}
|
||||||
|
@ -81,8 +82,8 @@ public final class CompSpecDbSpecific extends ASN1Any {
|
||||||
throw new ASN1Exception("CompSpec_dbSpecific: incomplete");
|
throw new ASN1Exception("CompSpec_dbSpecific: incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 2 ||
|
if (p.getTag() != 2 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException
|
||||||
("CompSpec_dbSpecific: bad tag in s_spec\n");
|
("CompSpec_dbSpecific: bad tag in s_spec\n");
|
||||||
}
|
}
|
||||||
|
@ -99,6 +100,7 @@ public final class CompSpecDbSpecific extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 2;
|
int numFields = 2;
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
|
@ -127,6 +130,7 @@ public final class CompSpecDbSpecific extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the CompSpec_dbSpecific.
|
* of the CompSpec_dbSpecific.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
|
@ -45,16 +45,15 @@ public final class DatabaseName extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
// Check tag matches
|
// Check tag matches
|
||||||
|
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 105 ||
|
if (ber.getTag() != 105 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("DatabaseName: bad BER: tag=" + ber.tagGet() + " expected 105\n");
|
throw new ASN1EncodingException("DatabaseName: bad BER: tag=" + ber.getTag() + " expected 105\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = new InternationalString(ber, false);
|
value = new InternationalString(ber, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +63,7 @@ public final class DatabaseName extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 105);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 105);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ public final class DatabaseName extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +85,7 @@ public final class DatabaseName extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the DatabaseName.
|
* of the DatabaseName.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class DefaultDiagFormat extends ASN1Any {
|
public final class DefaultDiagFormat extends ASN1Any {
|
||||||
|
|
||||||
public ASN1ObjectIdentifier sDiagnosticSetId;
|
public ASN1ObjectIdentifier diagnosticSetId;
|
||||||
public ASN1Integer sCondition;
|
public ASN1Integer condition;
|
||||||
public DefaultDiagFormatAddinfo sAddinfo;
|
public DefaultDiagFormatAddinfo addinfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a DefaultDiagFormat from a BER encoding.
|
* Constructor for a DefaultDiagFormat from a BER encoding.
|
||||||
|
@ -35,7 +35,6 @@ public final class DefaultDiagFormat extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public DefaultDiagFormat(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public DefaultDiagFormat(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -49,36 +48,37 @@ public final class DefaultDiagFormat extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("DefaultDiagFormat: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("DefaultDiagFormat: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sDiagnosticSetId = new ASN1ObjectIdentifier(p, true);
|
diagnosticSetId = new ASN1ObjectIdentifier(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("DefaultDiagFormat: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sCondition = new ASN1Integer(p, true);
|
condition = new ASN1Integer(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("DefaultDiagFormat: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sAddinfo = new DefaultDiagFormatAddinfo(p, true);
|
addinfo = new DefaultDiagFormatAddinfo(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 3; // number of mandatories
|
int numFields = 3; // number of mandatories
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
fields[x++] = sDiagnosticSetId.berEncode();
|
fields[x++] = diagnosticSetId.berEncode();
|
||||||
fields[x++] = sCondition.berEncode();
|
fields[x++] = condition.berEncode();
|
||||||
fields[x] = sAddinfo.berEncode();
|
fields[x] = addinfo.berEncode();
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the DefaultDiagFormat.
|
* of the DefaultDiagFormat.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("diagnosticSetId ");
|
str.append("diagnosticSetId ");
|
||||||
str.append(sDiagnosticSetId);
|
str.append(diagnosticSetId);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("condition ");
|
str.append("condition ");
|
||||||
str.append(sCondition);
|
str.append(condition);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("addinfo ");
|
str.append("addinfo ");
|
||||||
str.append(sAddinfo);
|
str.append(addinfo);
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class DefaultDiagFormatAddinfo extends ASN1Any {
|
public final class DefaultDiagFormatAddinfo extends ASN1Any {
|
||||||
|
|
||||||
public ASN1VisibleString cV2Addinfo;
|
public ASN1VisibleString v2Addinfo;
|
||||||
public InternationalString cV3Addinfo;
|
public InternationalString v3Addinfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a DefaultDiagFormat_addinfo from a BER encoding.
|
* 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.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
cV2Addinfo = null;
|
v2Addinfo = null;
|
||||||
cV3Addinfo = null;
|
v3Addinfo = null;
|
||||||
try {
|
try {
|
||||||
cV2Addinfo = new ASN1VisibleString(ber, checkTag);
|
v2Addinfo = new ASN1VisibleString(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cV3Addinfo = new InternationalString(ber, checkTag);
|
v3Addinfo = new InternationalString(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// 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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
if (cV2Addinfo != null) {
|
if (v2Addinfo != null) {
|
||||||
chosen = cV2Addinfo.berEncode();
|
chosen = v2Addinfo.berEncode();
|
||||||
}
|
}
|
||||||
if (cV3Addinfo != null) {
|
if (v3Addinfo != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = cV3Addinfo.berEncode();
|
chosen = v3Addinfo.berEncode();
|
||||||
}
|
}
|
||||||
if (chosen == null) {
|
if (chosen == null) {
|
||||||
throw new ASN1Exception("CHOICE not set");
|
throw new ASN1Exception("CHOICE not set");
|
||||||
|
@ -84,28 +86,30 @@ public final class DefaultDiagFormatAddinfo extends ASN1Any {
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the DefaultDiagFormat_addinfo.
|
* of the DefaultDiagFormat_addinfo.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (cV2Addinfo != null) {
|
if (v2Addinfo != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("v2Addinfo ");
|
str.append("v2Addinfo ");
|
||||||
str.append(cV2Addinfo);
|
str.append(v2Addinfo);
|
||||||
}
|
}
|
||||||
if (cV3Addinfo != null) {
|
if (v3Addinfo != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: v3Addinfo> ");
|
str.append("<ERROR: multiple CHOICE: v3Addinfo> ");
|
||||||
}
|
}
|
||||||
str.append("v3Addinfo ");
|
str.append("v3Addinfo ");
|
||||||
str.append(cV3Addinfo);
|
str.append(v3Addinfo);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -53,18 +53,19 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("DeleteResultSetRequest: bad BER form");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("DeleteResultSetRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
try {
|
try {
|
||||||
|
@ -74,12 +75,12 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
referenceId = null;
|
referenceId = null;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("DeleteResultSetRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 32 ||
|
if (p.getTag() != 32 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("DeleteResultSetRequest: bad tag in s_deleteFunction");
|
throw new ASN1EncodingException("bad tag in s_deleteFunction");
|
||||||
}
|
}
|
||||||
sDeleteFunction = new ASN1Integer(p, false);
|
sDeleteFunction = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
|
@ -99,7 +100,7 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
sResultSetList[n] = new ResultSetId(cons.elementAt(n), true);
|
sResultSetList[n] = new ResultSetId(cons.elementAt(n), true);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
|
@ -116,7 +117,7 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
sOtherInfo = null; // no, not present
|
sOtherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (referenceId != null) {
|
if (referenceId != null) {
|
||||||
|
@ -174,6 +177,7 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the DeleteResultSetRequest.
|
* of the DeleteResultSetRequest.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
@ -214,5 +218,4 @@ public final class DeleteResultSetRequest extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
|
@ -81,8 +82,8 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 0 ||
|
if (p.getTag() != 0 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("DeleteResultSetResponse: bad tag in s_deleteOperationStatus\n");
|
throw new ASN1EncodingException("DeleteResultSetResponse: bad tag in s_deleteOperationStatus\n");
|
||||||
}
|
}
|
||||||
sDeleteOperationStatus = new DeleteSetStatus(p, false);
|
sDeleteOperationStatus = new DeleteSetStatus(p, false);
|
||||||
|
@ -96,8 +97,8 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sDeleteListStatuses = new ListStatuses(p, false);
|
sDeleteListStatuses = new ListStatuses(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -105,8 +106,8 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 34 &&
|
if (p.getTag() == 34 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sNumberNotDeleted = new ASN1Integer(p, false);
|
sNumberNotDeleted = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +115,8 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 35 &&
|
if (p.getTag() == 35 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sBulkStatuses = new ListStatuses(p, false);
|
sBulkStatuses = new ListStatuses(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -123,8 +124,8 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 36 &&
|
if (p.getTag() == 36 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sDeleteMessage = new InternationalString(p, false);
|
sDeleteMessage = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -149,6 +150,7 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (sReferenceId != null) {
|
if (sReferenceId != null) {
|
||||||
|
@ -209,6 +212,7 @@ public final class DeleteResultSetResponse extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the DeleteResultSetResponse.
|
* of the DeleteResultSetResponse.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
|
@ -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_NOT_ALL_REQUESTED_RESULT_SETS_DELETED = 9;
|
||||||
public static final int E_RESULT_SET_IN_USE = 10;
|
public static final int E_RESULT_SET_IN_USE = 10;
|
||||||
public ASN1Integer value;
|
public ASN1Integer value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a DeleteSetStatus from a BER encoding.
|
* Constructor for a DeleteSetStatus from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +38,6 @@ public final class DeleteSetStatus extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public DeleteSetStatus(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public DeleteSetStatus(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,12 @@ public final class DeleteSetStatus extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 33 ||
|
if (ber.getTag() != 33 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("DeleteSetStatus: bad BER: tag=" + ber.tagGet() + " expected 33\n");
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 33");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = new ASN1Integer(ber, false);
|
value = new ASN1Integer(ber, false);
|
||||||
|
@ -67,7 +68,7 @@ public final class DeleteSetStatus extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 33);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 33);
|
||||||
}
|
}
|
||||||
|
@ -80,6 +81,7 @@ public final class DeleteSetStatus extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -88,10 +90,8 @@ public final class DeleteSetStatus extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the DeleteSetStatus.
|
* of the DeleteSetStatus.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class DiagRec extends ASN1Any {
|
public final class DiagRec extends ASN1Any {
|
||||||
|
|
||||||
public DefaultDiagFormat cDefaultFormat;
|
public DefaultDiagFormat defaultFormat;
|
||||||
public ASN1External cExternallyDefined;
|
public ASN1External externallyDefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a DiagRec from a BER encoding.
|
* 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.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
cDefaultFormat = null;
|
defaultFormat = null;
|
||||||
cExternallyDefined = null;
|
externallyDefined = null;
|
||||||
try {
|
try {
|
||||||
cDefaultFormat = new DefaultDiagFormat(ber, checkTag);
|
defaultFormat = new DefaultDiagFormat(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cExternallyDefined = new ASN1External(ber, checkTag);
|
externallyDefined = new ASN1External(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// 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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
if (cDefaultFormat != null) {
|
if (defaultFormat != null) {
|
||||||
chosen = cDefaultFormat.berEncode();
|
chosen = defaultFormat.berEncode();
|
||||||
}
|
}
|
||||||
if (cExternallyDefined != null) {
|
if (externallyDefined != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = cExternallyDefined.berEncode();
|
chosen = externallyDefined.berEncode();
|
||||||
}
|
}
|
||||||
if (chosen == null) {
|
if (chosen == null) {
|
||||||
throw new ASN1Exception("CHOICE not set");
|
throw new ASN1Exception("CHOICE not set");
|
||||||
|
@ -85,28 +87,30 @@ public final class DiagRec extends ASN1Any {
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the DiagRec.
|
* of the DiagRec.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (cDefaultFormat != null) {
|
if (defaultFormat != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("defaultFormat ");
|
str.append("defaultFormat ");
|
||||||
str.append(cDefaultFormat);
|
str.append(defaultFormat);
|
||||||
}
|
}
|
||||||
if (cExternallyDefined != null) {
|
if (externallyDefined != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: externallyDefined> ");
|
str.append("<ERROR: multiple CHOICE: externallyDefined> ");
|
||||||
}
|
}
|
||||||
str.append("externallyDefined ");
|
str.append("externallyDefined ");
|
||||||
str.append(cExternallyDefined);
|
str.append(externallyDefined);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -25,9 +25,7 @@ public final class ElementSetName extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,16 +38,15 @@ public final class ElementSetName extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
// Check tag matches
|
// Check tag matches
|
||||||
|
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 103 ||
|
if (ber.getTag() != 103 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("ElementSetName: bad BER: tag=" + ber.tagGet() + " expected 103\n");
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 103");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value = new InternationalString(ber, false);
|
value = new InternationalString(ber, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +56,7 @@ public final class ElementSetName extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 103);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 103);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +69,7 @@ public final class ElementSetName extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -79,9 +78,8 @@ public final class ElementSetName extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the ElementSetName.
|
* of the ElementSetName.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ import org.xbib.asn1.BEREncoding;
|
||||||
public final class ElementSetNames extends ASN1Any {
|
public final class ElementSetNames extends ASN1Any {
|
||||||
|
|
||||||
public InternationalString cGenericElementSetName;
|
public InternationalString cGenericElementSetName;
|
||||||
|
|
||||||
public ElementSetNamesDatabaseSpecific[] cDatabaseSpecific;
|
public ElementSetNamesDatabaseSpecific[] cDatabaseSpecific;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a ElementSetNames.
|
* Default constructor for a ElementSetNames.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ElementSetNames() {
|
public ElementSetNames() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ public final class ElementSetNames extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ElementSetNames(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ElementSetNames(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -51,23 +50,24 @@ public final class ElementSetNames extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
cGenericElementSetName = null;
|
cGenericElementSetName = null;
|
||||||
cDatabaseSpecific = null;
|
cDatabaseSpecific = null;
|
||||||
if (ber.tagGet() == 0 &&
|
if (ber.getTag() == 0 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
cGenericElementSetName = new InternationalString(ber, false);
|
cGenericElementSetName = new InternationalString(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 1 &&
|
if (ber.getTag() == 1 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
BEREncoding berData;
|
BEREncoding berData;
|
||||||
berData = ber;
|
berData = ber;
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) berData;
|
berConstructed = (BERConstructed) berData;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("ElementSetNames: bad BER form");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int p;
|
int p;
|
||||||
|
@ -77,7 +77,7 @@ public final class ElementSetNames extends ASN1Any {
|
||||||
}
|
}
|
||||||
return;
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
BEREncoding[] f2;
|
BEREncoding[] f2;
|
||||||
|
@ -109,14 +110,16 @@ public final class ElementSetNames extends ASN1Any {
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the ElementSetNames.
|
* of the ElementSetNames.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
|
@ -20,13 +20,12 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class ElementSetNamesDatabaseSpecific extends ASN1Any {
|
public final class ElementSetNamesDatabaseSpecific extends ASN1Any {
|
||||||
|
|
||||||
public DatabaseName sDbName;
|
public DatabaseName dbName;
|
||||||
public ElementSetName elementSetName;
|
public ElementSetName elementSetName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a ElementSetNames_databaseSpecific.
|
* Default constructor for a ElementSetNames_databaseSpecific.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ElementSetNamesDatabaseSpecific() {
|
public ElementSetNamesDatabaseSpecific() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +38,6 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ElementSetNamesDatabaseSpecific(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ElementSetNamesDatabaseSpecific(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -53,32 +51,31 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("ElementSetNames_databaseSpecific: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ElementSetNames_databaseSpecific: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
sDbName = new DatabaseName(p, true);
|
dbName = new DatabaseName(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ElementSetNames_databaseSpecific: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
elementSetName = new ElementSetName(p, true);
|
elementSetName = new ElementSetName(p, true);
|
||||||
part++;
|
part++;
|
||||||
if (part < numParts) {
|
if (part < numParts) {
|
||||||
throw new ASN1Exception("ElementSetNames_databaseSpecific: bad BER: extra data "
|
throw new ASN1Exception("bad BER: extra data "
|
||||||
+ part + "/" + numParts + " processed");
|
+ part + "/" + numParts + " processed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +86,7 @@ public final class ElementSetNamesDatabaseSpecific extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 2;
|
int numFields = 2;
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
fields[x++] = sDbName.berEncode();
|
fields[x++] = dbName.berEncode();
|
||||||
fields[x] = elementSetName.berEncode();
|
fields[x] = elementSetName.berEncode();
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the ElementSetNames_databaseSpecific.
|
* of the ElementSetNames_databaseSpecific.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("dbName ");
|
str.append("dbName ");
|
||||||
str.append(sDbName);
|
str.append(dbName);
|
||||||
outputted++;
|
outputted++;
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
|
|
|
@ -30,9 +30,7 @@ public final class Entry extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,31 +43,30 @@ public final class Entry extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
cTermInfo = null;
|
cTermInfo = null;
|
||||||
cSurrogateDiagnostic = null;
|
cSurrogateDiagnostic = null;
|
||||||
if (ber.tagGet() == 1 &&
|
if (ber.getTag() == 1 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
cTermInfo = new TermInfo(ber, false);
|
cTermInfo = new TermInfo(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 2 &&
|
if (ber.getTag() == 2 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("Entry: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("Entry: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
cSurrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true);
|
cSurrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true);
|
||||||
return;
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
BEREncoding[] enc;
|
BEREncoding[] enc;
|
||||||
|
@ -98,14 +96,16 @@ public final class Entry extends ASN1Any {
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the Entry.
|
* of the Entry.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
|
@ -62,7 +62,6 @@ public final class ExtendedServicesRequest extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ExtendedServicesRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public ExtendedServicesRequest(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -76,19 +75,19 @@ public final class ExtendedServicesRequest extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("ExtendedServicesRequest: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
try {
|
try {
|
||||||
|
@ -99,88 +98,86 @@ public final class ExtendedServicesRequest extends ASN1Any {
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 3 ||
|
if (p.getTag() != 3 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad tag in s_function");
|
||||||
("ExtendedServicesRequest: bad tag in s_function\n");
|
|
||||||
}
|
}
|
||||||
sFunction = new ASN1Integer(p, false);
|
sFunction = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 4 ||
|
if (p.getTag() != 4 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad tag in s_packageType");
|
||||||
("ExtendedServicesRequest: bad tag in s_packageType\n");
|
|
||||||
}
|
}
|
||||||
sPackageType = new ASN1ObjectIdentifier(p, false);
|
sPackageType = new ASN1ObjectIdentifier(p, false);
|
||||||
part++;
|
part++;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 5 &&
|
if (p.getTag() == 5 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sPackageName = new InternationalString(p, false);
|
sPackageName = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 6 &&
|
if (p.getTag() == 6 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sUserId = new InternationalString(p, false);
|
sUserId = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 7 &&
|
if (p.getTag() == 7 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sRetentionTime = new IntUnit(p, false);
|
sRetentionTime = new IntUnit(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 8 &&
|
if (p.getTag() == 8 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sPermissions = new Permissions(p, false);
|
sPermissions = new Permissions(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 9 &&
|
if (p.getTag() == 9 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sDescription = new InternationalString(p, false);
|
sDescription = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 10 &&
|
if (p.getTag() == 10 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sTaskSpecificParameters = new ASN1External(p, false);
|
sTaskSpecificParameters = new ASN1External(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 11 ||
|
if (p.getTag() != 11 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("ExtendedServicesRequest: bad tag in s_waitAction\n");
|
throw new ASN1EncodingException("bad tag in waitAction");
|
||||||
}
|
}
|
||||||
sWaitAction = new ASN1Integer(p, false);
|
sWaitAction = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
|
@ -207,7 +204,7 @@ public final class ExtendedServicesRequest extends ASN1Any {
|
||||||
sOtherInfo = null; // no, not present
|
sOtherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 3;
|
int numFields = 3;
|
||||||
if (sReferenceId != null) {
|
if (sReferenceId != null) {
|
||||||
|
@ -297,6 +296,7 @@ public final class ExtendedServicesRequest extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the ExtendedServicesRequest.
|
* of the ExtendedServicesRequest.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
|
@ -42,7 +42,6 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ExtendedServicesResponse(BEREncoding ber, boolean checkTag)
|
public ExtendedServicesResponse(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -57,19 +56,20 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("ExtendedServicesResponse: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("ExtendedServicesResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
try {
|
try {
|
||||||
|
@ -79,12 +79,12 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
sReferenceId = null; // no, not present
|
sReferenceId = null; // no, not present
|
||||||
}
|
}
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
throw new ASN1Exception("ExtendedServicesResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() != 3 ||
|
if (p.getTag() != 3 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("ExtendedServicesResponse: bad tag in s_operationStatus\n");
|
throw new ASN1EncodingException("bad tag in operationStatus");
|
||||||
}
|
}
|
||||||
sOperationStatus = new ASN1Integer(p, false);
|
sOperationStatus = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
|
@ -95,8 +95,8 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 4 &&
|
if (p.getTag() == 4 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
|
@ -114,8 +114,8 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
if (p.tagGet() == 5 &&
|
if (p.getTag() == 5 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
sTaskPackage = new ASN1External(p, false);
|
sTaskPackage = new ASN1External(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
sOtherInfo = null; // no, not present
|
sOtherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
int numFields = 1;
|
int numFields = 1;
|
||||||
if (sReferenceId != null) {
|
if (sReferenceId != null) {
|
||||||
|
@ -194,7 +196,7 @@ public final class ExtendedServicesResponse extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the ExtendedServicesResponse.
|
* of the ExtendedServicesResponse.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
|
@ -44,7 +44,7 @@ public final class FragmentSyntax extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
c_externallyTagged = null;
|
c_externallyTagged = null;
|
||||||
c_notExternallyTagged = null;
|
c_notExternallyTagged = null;
|
||||||
|
@ -69,6 +69,7 @@ public final class FragmentSyntax extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
if (c_externallyTagged != null) {
|
if (c_externallyTagged != null) {
|
||||||
|
@ -100,7 +101,7 @@ public final class FragmentSyntax extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// This method must not be called!
|
// 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
|
// permitted to allow something else to apply an implicit
|
||||||
// tag on it, otherwise the tag identifying which CHOICE
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// it is will be overwritten and lost.
|
||||||
|
throw new ASN1EncodingException("cannot implicitly tag");
|
||||||
throw new ASN1EncodingException("FragmentSyntax: cannot implicitly tag");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the FragmentSyntax.
|
* of the FragmentSyntax.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (c_externallyTagged != null) {
|
if (c_externallyTagged != null) {
|
||||||
|
@ -137,5 +136,4 @@ public final class FragmentSyntax extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,14 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class IdAuthentication extends ASN1Any {
|
public final class IdAuthentication extends ASN1Any {
|
||||||
|
|
||||||
public ASN1VisibleString c_open;
|
public ASN1VisibleString open;
|
||||||
public IdAuthenticationIdPass c_idPass;
|
public IdAuthenticationIdPass idPass;
|
||||||
public ASN1Null c_anonymous;
|
public ASN1Null anonymous;
|
||||||
public ASN1External c_other;
|
public ASN1External other;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a IdAuthentication.
|
* Default constructor for a IdAuthentication.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public IdAuthentication() {
|
public IdAuthentication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public IdAuthentication(BEREncoding ber, boolean checkTag)
|
public IdAuthentication(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -59,20 +57,18 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Null out all choices
|
// Null out all choices
|
||||||
|
|
||||||
c_open = null;
|
open = null;
|
||||||
c_idPass = null;
|
idPass = null;
|
||||||
c_anonymous = null;
|
anonymous = null;
|
||||||
c_other = null;
|
other = null;
|
||||||
|
|
||||||
// Try choice open
|
// Try choice open
|
||||||
try {
|
try {
|
||||||
c_open = new ASN1VisibleString(ber, checkTag);
|
open = new ASN1VisibleString(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
|
@ -80,7 +76,7 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
|
|
||||||
// Try choice idPass
|
// Try choice idPass
|
||||||
try {
|
try {
|
||||||
c_idPass = new IdAuthenticationIdPass(ber, checkTag);
|
idPass = new IdAuthenticationIdPass(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
|
@ -88,7 +84,7 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
|
|
||||||
// Try choice anonymous
|
// Try choice anonymous
|
||||||
try {
|
try {
|
||||||
c_anonymous = new ASN1Null(ber, checkTag);
|
anonymous = new ASN1Null(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
|
@ -96,13 +92,13 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
|
|
||||||
// Try choice other
|
// Try choice other
|
||||||
try {
|
try {
|
||||||
c_other = new ASN1External(ber, checkTag);
|
other = new ASN1External(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// 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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
// Encoding choice: c_open
|
// Encoding choice: c_open
|
||||||
if (c_open != null) {
|
if (open != null) {
|
||||||
chosen = c_open.berEncode();
|
chosen = open.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_idPass
|
// Encoding choice: c_idPass
|
||||||
if (c_idPass != null) {
|
if (idPass != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = c_idPass.berEncode();
|
chosen = idPass.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_anonymous
|
// Encoding choice: c_anonymous
|
||||||
if (c_anonymous != null) {
|
if (anonymous != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = c_anonymous.berEncode();
|
chosen = anonymous.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_other
|
// Encoding choice: c_other
|
||||||
if (c_other != null) {
|
if (other != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = c_other.berEncode();
|
chosen = other.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for error of having none of the choices set
|
// Check for error of having none of the choices set
|
||||||
if (chosen == null) {
|
if (chosen == null) {
|
||||||
throw new ASN1Exception("CHOICE not set");
|
throw new ASN1Exception("CHOICE not set");
|
||||||
}
|
}
|
||||||
|
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +161,8 @@ public final class IdAuthentication extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// This method must not be called!
|
// This method must not be called!
|
||||||
|
|
||||||
// Method is not available because this is a basic CHOICE
|
// 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
|
// permitted to allow something else to apply an implicit
|
||||||
// tag on it, otherwise the tag identifying which CHOICE
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// it is will be overwritten and lost.
|
||||||
|
throw new ASN1EncodingException("cannot implicitly tag");
|
||||||
throw new ASN1EncodingException("IdAuthentication: cannot implicitly tag");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the IdAuthentication.
|
* of the IdAuthentication.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (c_open != null) {
|
if (open != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("open ");
|
str.append("open ");
|
||||||
str.append(c_open);
|
str.append(open);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_idPass != null) {
|
if (idPass != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: idPass> ");
|
str.append("<ERROR: multiple CHOICE: idPass> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("idPass ");
|
str.append("idPass ");
|
||||||
str.append(c_idPass);
|
str.append(idPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_anonymous != null) {
|
if (anonymous != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: anonymous> ");
|
str.append("<ERROR: multiple CHOICE: anonymous> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("anonymous ");
|
str.append("anonymous ");
|
||||||
str.append(c_anonymous);
|
str.append(anonymous);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_other != null) {
|
if (other != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: other> ");
|
str.append("<ERROR: multiple CHOICE: other> ");
|
||||||
}
|
}
|
||||||
str.append("other ");
|
str.append("other ");
|
||||||
str.append(c_other);
|
str.append(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
/**
|
/**
|
||||||
* Default constructor for a IdAuthentication_idPass.
|
* Default constructor for a IdAuthentication_idPass.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public IdAuthenticationIdPass() {
|
public IdAuthenticationIdPass() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +39,7 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,10 +52,8 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// IdAuthentication_idPass should be encoded by a constructed BER
|
// IdAuthentication_idPass should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -88,8 +83,8 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 0 &&
|
if (p.getTag() == 0 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_groupId = new InternationalString(p, false);
|
s_groupId = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -101,8 +96,8 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_userId = new InternationalString(p, false);
|
s_userId = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +109,8 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 2 &&
|
if (p.getTag() == 2 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_password = new InternationalString(p, false);
|
s_password = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -133,6 +128,7 @@ public final class IdAuthenticationIdPass extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// Calculate the number of fields in the encoding
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the IdAuthentication_idPass.
|
* of the IdAuthentication_idPass.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
if (s_groupId != null) {
|
if (s_groupId != null) {
|
||||||
str.append("groupId ");
|
str.append("groupId ");
|
||||||
str.append(s_groupId);
|
str.append(s_groupId);
|
||||||
|
|
|
@ -33,7 +33,6 @@ public final class InfoCategory extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public InfoCategory(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public InfoCategory(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -71,8 +70,8 @@ public final class InfoCategory extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_categoryTypeId = new ASN1ObjectIdentifier(p, false);
|
s_categoryTypeId = new ASN1ObjectIdentifier(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -85,8 +84,8 @@ public final class InfoCategory extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 2 ||
|
if (p.getTag() != 2 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("InfoCategory: bad tag in s_categoryValue\n");
|
throw new ASN1EncodingException("InfoCategory: bad tag in s_categoryValue\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +105,7 @@ public final class InfoCategory extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 1; // number of mandatories
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the InfoCategory.
|
* of the InfoCategory.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
|
|
|
@ -30,22 +30,24 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class InitializeRequest extends ASN1Any {
|
public final class InitializeRequest extends ASN1Any {
|
||||||
|
|
||||||
public ReferenceId s_referenceId; // optional
|
public ReferenceId referenceId; // optional
|
||||||
public ProtocolVersion s_protocolVersion;
|
public ProtocolVersion protocolVersion;
|
||||||
public Options s_options;
|
public Options options;
|
||||||
public ASN1Integer s_preferredMessageSize;
|
public ASN1Integer preferredMessageSize;
|
||||||
public ASN1Integer s_exceptionalRecordSize;
|
public ASN1Integer exceptionalRecordSize;
|
||||||
public IdAuthentication s_idAuthentication; // optional
|
public IdAuthentication idAuthentication; // optional
|
||||||
public InternationalString s_implementationId; // optional
|
public InternationalString implementationId; // optional
|
||||||
public InternationalString s_implementationName; // optional
|
public InternationalString implementationName; // optional
|
||||||
public InternationalString s_implementationVersion; // optional
|
public InternationalString implementationVersion; // optional
|
||||||
public ASN1External s_userInformationField; // optional
|
public ASN1External userInformationField; // optional
|
||||||
public OtherInformation s_otherInfo; // optional
|
public OtherInformation otherInfo; // optional
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a InitializeRequest.
|
* Default constructor for a InitializeRequest.
|
||||||
*/
|
*/
|
||||||
public InitializeRequest() {
|
public InitializeRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a InitializeRequest from a BER encoding.
|
* Constructor for a InitializeRequest from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -55,9 +57,7 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,17 +70,14 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// InitializeRequest should be encoded by a constructed BER
|
// InitializeRequest should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("InitializeRequest: bad BER form");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -94,80 +91,80 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_referenceId = new ReferenceId(p, true);
|
referenceId = new ReferenceId(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_referenceId = null; // no, not present
|
referenceId = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: protocolVersion ProtocolVersion
|
// Decoding: protocolVersion ProtocolVersion
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
s_protocolVersion = new ProtocolVersion(p, true);
|
protocolVersion = new ProtocolVersion(p, true);
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: options Options
|
// Decoding: options Options
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
s_options = new Options(p, true);
|
options = new Options(p, true);
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: preferredMessageSize [5] IMPLICIT INTEGER
|
// Decoding: preferredMessageSize [5] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 5 ||
|
if (p.getTag() != 5 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("InitializeRequest: bad tag in s_preferredMessageSize");
|
throw new ASN1EncodingException("bad tag in preferredMessageSize");
|
||||||
}
|
}
|
||||||
|
|
||||||
s_preferredMessageSize = new ASN1Integer(p, false);
|
preferredMessageSize = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER
|
// Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 6 ||
|
if (p.getTag() != 6 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("InitializeRequest: bad tag in s_exceptionalRecordSize");
|
throw new ASN1EncodingException("bad tag in exceptionalRecordSize");
|
||||||
}
|
}
|
||||||
|
|
||||||
s_exceptionalRecordSize = new ASN1Integer(p, false);
|
exceptionalRecordSize = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Remaining elements are optional, set variables
|
// Remaining elements are optional, set variables
|
||||||
// to null (not present) so can return at endStream of BER
|
// to null (not present) so can return at endStream of BER
|
||||||
|
|
||||||
s_idAuthentication = null;
|
idAuthentication = null;
|
||||||
s_implementationId = null;
|
implementationId = null;
|
||||||
s_implementationName = null;
|
implementationName = null;
|
||||||
s_implementationVersion = null;
|
implementationVersion = null;
|
||||||
s_userInformationField = null;
|
userInformationField = null;
|
||||||
s_otherInfo = null;
|
otherInfo = null;
|
||||||
|
|
||||||
// Decoding: idAuthentication [7] EXPLICIT IdAuthentication OPTIONAL
|
// Decoding: idAuthentication [7] EXPLICIT IdAuthentication OPTIONAL
|
||||||
|
|
||||||
|
@ -176,44 +173,38 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 7 &&
|
if (p.getTag() == 7 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} 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) {
|
if (tagged.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException("InitializeRequest: bad BER encoding: s_idAuthentication tag bad");
|
throw new ASN1EncodingException("bad BER encoding: idAuthentication tag bad");
|
||||||
}
|
}
|
||||||
|
idAuthentication = new IdAuthentication(tagged.elementAt(0), true);
|
||||||
s_idAuthentication = new IdAuthentication(tagged.elementAt(0), true);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL
|
// Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 110 &&
|
||||||
if (p.tagGet() == 110 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
implementationId = new InternationalString(p, false);
|
||||||
s_implementationId = new InternationalString(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL
|
// Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 111 &&
|
if (p.getTag() == 111 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_implementationName = new InternationalString(p, false);
|
implementationName = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,9 +215,9 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 112 &&
|
if (p.getTag() == 112 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_implementationVersion = new InternationalString(p, false);
|
implementationVersion = new InternationalString(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,18 +228,17 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 11 &&
|
if (p.getTag() == 11 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} 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) {
|
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");
|
||||||
}
|
}
|
||||||
|
userInformationField = new ASN1External(tagged.elementAt(0), true);
|
||||||
s_userInformationField = new ASN1External(tagged.elementAt(0), true);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,16 +250,14 @@ public final class InitializeRequest extends ASN1Any {
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_otherInfo = new OtherInformation(p, true);
|
otherInfo = new OtherInformation(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_otherInfo = null; // no, not present
|
otherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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
|
* @see org.xbib.asn1.BEREncoding#PRIVATE_TAG
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public BEREncoding
|
@Override
|
||||||
berEncode(int tagType, int tag)
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 4; // number of mandatories
|
int numFields = 4; // number of mandatories
|
||||||
if (s_referenceId != null) {
|
if (referenceId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_idAuthentication != null) {
|
if (idAuthentication != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationId != null) {
|
if (implementationId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationName != null) {
|
if (implementationName != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationVersion != null) {
|
if (implementationVersion != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_userInformationField != null) {
|
if (userInformationField != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_otherInfo != null) {
|
if (otherInfo != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode it
|
// Encode it
|
||||||
|
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding enc[];
|
BEREncoding enc[];
|
||||||
|
|
||||||
// Encoding s_referenceId: ReferenceId OPTIONAL
|
// Encoding s_referenceId: ReferenceId OPTIONAL
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
fields[x++] = referenceId.berEncode();
|
||||||
fields[x++] = s_referenceId.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_protocolVersion: ProtocolVersion
|
// Encoding s_protocolVersion: ProtocolVersion
|
||||||
|
fields[x++] = protocolVersion.berEncode();
|
||||||
fields[x++] = s_protocolVersion.berEncode();
|
|
||||||
|
|
||||||
// Encoding s_options: Options
|
// Encoding s_options: Options
|
||||||
|
fields[x++] = options.berEncode();
|
||||||
fields[x++] = s_options.berEncode();
|
|
||||||
|
|
||||||
// Encoding s_preferredMessageSize: INTEGER
|
// Encoding s_preferredMessageSize: INTEGER
|
||||||
|
fields[x++] = preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5);
|
||||||
fields[x++] = s_preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5);
|
|
||||||
|
|
||||||
// Encoding s_exceptionalRecordSize: INTEGER
|
// Encoding s_exceptionalRecordSize: INTEGER
|
||||||
|
fields[x++] = exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6);
|
||||||
fields[x++] = s_exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6);
|
|
||||||
|
|
||||||
// Encoding s_idAuthentication: IdAuthentication OPTIONAL
|
// Encoding s_idAuthentication: IdAuthentication OPTIONAL
|
||||||
|
if (idAuthentication != null) {
|
||||||
if (s_idAuthentication != null) {
|
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = s_idAuthentication.berEncode();
|
enc[0] = idAuthentication.berEncode();
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 7, enc);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 7, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_implementationId: InternationalString OPTIONAL
|
// Encoding s_implementationId: InternationalString OPTIONAL
|
||||||
|
if (implementationId != null) {
|
||||||
if (s_implementationId != null) {
|
fields[x++] = implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110);
|
||||||
fields[x++] = s_implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_implementationName: InternationalString OPTIONAL
|
// Encoding s_implementationName: InternationalString OPTIONAL
|
||||||
|
if (implementationName != null) {
|
||||||
if (s_implementationName != null) {
|
fields[x++] = implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111);
|
||||||
fields[x++] = s_implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_implementationVersion: InternationalString OPTIONAL
|
// Encoding s_implementationVersion: InternationalString OPTIONAL
|
||||||
|
if (implementationVersion != null) {
|
||||||
if (s_implementationVersion != null) {
|
fields[x++] = implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112);
|
||||||
fields[x++] = s_implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_userInformationField: EXTERNAL OPTIONAL
|
// Encoding s_userInformationField: EXTERNAL OPTIONAL
|
||||||
|
|
||||||
if (s_userInformationField != null) {
|
if (userInformationField != null) {
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = s_userInformationField.berEncode();
|
enc[0] = userInformationField.berEncode();
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
fields[x] = otherInfo.berEncode();
|
||||||
fields[x++] = s_otherInfo.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the InitializeRequest.
|
* of the InitializeRequest.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
|
||||||
str.append("referenceId ");
|
str.append("referenceId ");
|
||||||
str.append(s_referenceId);
|
str.append(referenceId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("protocolVersion ");
|
str.append("protocolVersion ");
|
||||||
str.append(s_protocolVersion);
|
str.append(protocolVersion);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("options ");
|
str.append("options ");
|
||||||
str.append(s_options);
|
str.append(options);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("preferredMessageSize ");
|
str.append("preferredMessageSize ");
|
||||||
str.append(s_preferredMessageSize);
|
str.append(preferredMessageSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("exceptionalRecordSize ");
|
str.append("exceptionalRecordSize ");
|
||||||
str.append(s_exceptionalRecordSize);
|
str.append(exceptionalRecordSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
if (idAuthentication != null) {
|
||||||
if (s_idAuthentication != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("idAuthentication ");
|
str.append("idAuthentication ");
|
||||||
str.append(s_idAuthentication);
|
str.append(idAuthentication);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (implementationId != null) {
|
||||||
if (s_implementationId != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationId ");
|
str.append("implementationId ");
|
||||||
str.append(s_implementationId);
|
str.append(implementationId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (implementationName != null) {
|
||||||
if (s_implementationName != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationName ");
|
str.append("implementationName ");
|
||||||
str.append(s_implementationName);
|
str.append(implementationName);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (implementationVersion != null) {
|
||||||
if (s_implementationVersion != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationVersion ");
|
str.append("implementationVersion ");
|
||||||
str.append(s_implementationVersion);
|
str.append(implementationVersion);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (userInformationField != null) {
|
||||||
if (s_userInformationField != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("userInformationField ");
|
str.append("userInformationField ");
|
||||||
str.append(s_userInformationField);
|
str.append(userInformationField);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("otherInfo ");
|
str.append("otherInfo ");
|
||||||
str.append(s_otherInfo);
|
str.append(otherInfo);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,17 +32,18 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class InitializeResponse extends ASN1Any {
|
public final class InitializeResponse extends ASN1Any {
|
||||||
|
|
||||||
public ReferenceId s_referenceId; // optional
|
public ReferenceId referenceId; // optional
|
||||||
public ProtocolVersion s_protocolVersion;
|
public ProtocolVersion protocolVersion;
|
||||||
public Options s_options;
|
public Options options;
|
||||||
public ASN1Integer s_preferredMessageSize;
|
public ASN1Integer preferredMessageSize;
|
||||||
public ASN1Integer s_exceptionalRecordSize;
|
public ASN1Integer exceptionalRecordSize;
|
||||||
public ASN1Boolean s_result;
|
public ASN1Boolean result;
|
||||||
public InternationalString s_implementationId; // optional
|
public InternationalString implementationId; // optional
|
||||||
public InternationalString s_implementationName; // optional
|
public InternationalString implementationName; // optional
|
||||||
public InternationalString s_implementationVersion; // optional
|
public InternationalString implementationVersion; // optional
|
||||||
public ASN1External s_userInformationField; // optional
|
public ASN1External userInformationField; // optional
|
||||||
public OtherInformation s_otherInfo; // optional
|
public OtherInformation otherInfo; // optional
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a InitializeResponse from a BER encoding.
|
* Constructor for a InitializeResponse from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -52,7 +53,6 @@ public final class InitializeResponse extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public InitializeResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public InitializeResponse(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
@ -66,204 +66,154 @@ public final class InitializeResponse extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// InitializeResponse should be encoded by a constructed BER
|
// InitializeResponse should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("InitializeResponse: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
BERConstructed tagged;
|
BERConstructed tagged;
|
||||||
|
|
||||||
// Decoding: referenceId ReferenceId OPTIONAL
|
// Decoding: referenceId ReferenceId OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_referenceId = new ReferenceId(p, true);
|
referenceId = new ReferenceId(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_referenceId = null; // no, not present
|
referenceId = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: protocolVersion ProtocolVersion
|
// Decoding: protocolVersion ProtocolVersion
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
protocolVersion = new ProtocolVersion(p, true);
|
||||||
s_protocolVersion = new ProtocolVersion(p, true);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: options Options
|
// Decoding: options Options
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
options = new Options(p, true);
|
||||||
s_options = new Options(p, true);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: preferredMessageSize [5] IMPLICIT INTEGER
|
// Decoding: preferredMessageSize [5] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() != 5 ||
|
||||||
if (p.tagGet() != 5 ||
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
throw new ASN1EncodingException("bad tag in preferredMessageSize");
|
||||||
throw new ASN1EncodingException
|
|
||||||
("InitializeResponse: bad tag in s_preferredMessageSize\n");
|
|
||||||
}
|
}
|
||||||
|
preferredMessageSize = new ASN1Integer(p, false);
|
||||||
s_preferredMessageSize = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER
|
// Decoding: exceptionalRecordSize [6] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() != 6 ||
|
||||||
if (p.tagGet() != 6 ||
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
throw new ASN1EncodingException("bad tag in exceptionalRecordSize");
|
||||||
throw new ASN1EncodingException
|
|
||||||
("InitializeResponse: bad tag in s_exceptionalRecordSize\n");
|
|
||||||
}
|
}
|
||||||
|
exceptionalRecordSize = new ASN1Integer(p, false);
|
||||||
s_exceptionalRecordSize = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: result [12] IMPLICIT BOOLEAN
|
// Decoding: result [12] IMPLICIT BOOLEAN
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("InitializeResponse: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() != 12 ||
|
||||||
if (p.tagGet() != 12 ||
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
throw new ASN1EncodingException("bad tag in result");
|
||||||
throw new ASN1EncodingException
|
|
||||||
("InitializeResponse: bad tag in s_result\n");
|
|
||||||
}
|
}
|
||||||
|
result = new ASN1Boolean(p, false);
|
||||||
s_result = new ASN1Boolean(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Remaining elements are optional, set variables
|
// Remaining elements are optional, set variables
|
||||||
// to null (not present) so can return at endStream of BER
|
// to null (not present) so can return at endStream of BER
|
||||||
|
implementationId = null;
|
||||||
s_implementationId = null;
|
implementationName = null;
|
||||||
s_implementationName = null;
|
implementationVersion = null;
|
||||||
s_implementationVersion = null;
|
userInformationField = null;
|
||||||
s_userInformationField = null;
|
otherInfo = null;
|
||||||
s_otherInfo = null;
|
|
||||||
|
|
||||||
// Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL
|
// Decoding: implementationId [110] IMPLICIT InternationalString OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 110 &&
|
||||||
if (p.tagGet() == 110 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
implementationId = new InternationalString(p, false);
|
||||||
s_implementationId = new InternationalString(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL
|
// Decoding: implementationName [111] IMPLICIT InternationalString OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 111 &&
|
||||||
if (p.tagGet() == 111 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
implementationName = new InternationalString(p, false);
|
||||||
s_implementationName = new InternationalString(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: implementationVersion [112] IMPLICIT InternationalString OPTIONAL
|
// Decoding: implementationVersion [112] IMPLICIT InternationalString OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 112 &&
|
||||||
if (p.tagGet() == 112 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
implementationVersion = new InternationalString(p, false);
|
||||||
s_implementationVersion = new InternationalString(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: userInformationField [11] EXPLICIT EXTERNAL OPTIONAL
|
// Decoding: userInformationField [11] EXPLICIT EXTERNAL OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 11 &&
|
||||||
if (p.tagGet() == 11 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER encoding: userInformationField tag bad");
|
||||||
("InitializeResponse: bad BER encoding: s_userInformationField tag bad\n");
|
|
||||||
}
|
}
|
||||||
if (tagged.numberComponents() != 1) {
|
if (tagged.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER encoding: s_userInformationField tag bad");
|
||||||
("InitializeResponse: bad BER encoding: s_userInformationField tag bad\n");
|
|
||||||
}
|
}
|
||||||
|
userInformationField = new ASN1External(tagged.elementAt(0), true);
|
||||||
s_userInformationField = new ASN1External(tagged.elementAt(0), true);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: otherInfo OtherInformation OPTIONAL
|
// Decoding: otherInfo OtherInformation OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_otherInfo = new OtherInformation(p, true);
|
otherInfo = new OtherInformation(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_otherInfo = null; // no, not present
|
otherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 5; // number of mandatories
|
int numFields = 5; // number of mandatories
|
||||||
if (s_referenceId != null) {
|
if (referenceId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationId != null) {
|
if (implementationId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationName != null) {
|
if (implementationName != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_implementationVersion != null) {
|
if (implementationVersion != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_userInformationField != null) {
|
if (userInformationField != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_otherInfo != null) {
|
if (otherInfo != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode it
|
// Encode it
|
||||||
|
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding enc[];
|
BEREncoding enc[];
|
||||||
|
|
||||||
// Encoding s_referenceId: ReferenceId OPTIONAL
|
// Encoding s_referenceId: ReferenceId OPTIONAL
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
fields[x++] = referenceId.berEncode();
|
||||||
fields[x++] = s_referenceId.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_protocolVersion: ProtocolVersion
|
// Encoding s_protocolVersion: ProtocolVersion
|
||||||
|
fields[x++] = protocolVersion.berEncode();
|
||||||
fields[x++] = s_protocolVersion.berEncode();
|
|
||||||
|
|
||||||
// Encoding s_options: Options
|
// Encoding s_options: Options
|
||||||
|
fields[x++] = options.berEncode();
|
||||||
fields[x++] = s_options.berEncode();
|
|
||||||
|
|
||||||
// Encoding s_preferredMessageSize: INTEGER
|
// Encoding s_preferredMessageSize: INTEGER
|
||||||
|
fields[x++] = preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5);
|
||||||
fields[x++] = s_preferredMessageSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 5);
|
|
||||||
|
|
||||||
// Encoding s_exceptionalRecordSize: INTEGER
|
// Encoding s_exceptionalRecordSize: INTEGER
|
||||||
|
fields[x++] = exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6);
|
||||||
fields[x++] = s_exceptionalRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 6);
|
|
||||||
|
|
||||||
// Encoding s_result: BOOLEAN
|
// Encoding s_result: BOOLEAN
|
||||||
|
fields[x++] = result.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 12);
|
||||||
fields[x++] = s_result.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 12);
|
|
||||||
|
|
||||||
// Encoding s_implementationId: InternationalString OPTIONAL
|
// Encoding s_implementationId: InternationalString OPTIONAL
|
||||||
|
if (implementationId != null) {
|
||||||
if (s_implementationId != null) {
|
fields[x++] = implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110);
|
||||||
fields[x++] = s_implementationId.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 110);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_implementationName: InternationalString OPTIONAL
|
// Encoding s_implementationName: InternationalString OPTIONAL
|
||||||
|
if (implementationName != null) {
|
||||||
if (s_implementationName != null) {
|
fields[x++] = implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111);
|
||||||
fields[x++] = s_implementationName.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 111);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_implementationVersion: InternationalString OPTIONAL
|
// Encoding s_implementationVersion: InternationalString OPTIONAL
|
||||||
|
if (implementationVersion != null) {
|
||||||
if (s_implementationVersion != null) {
|
fields[x++] = implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112);
|
||||||
fields[x++] = s_implementationVersion.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 112);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_userInformationField: EXTERNAL OPTIONAL
|
// Encoding s_userInformationField: EXTERNAL OPTIONAL
|
||||||
|
if (userInformationField != null) {
|
||||||
if (s_userInformationField != null) {
|
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = s_userInformationField.berEncode();
|
enc[0] = userInformationField.berEncode();
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 11, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
fields[x] = otherInfo.berEncode();
|
||||||
fields[x] = s_otherInfo.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the InitializeResponse.
|
* of the InitializeResponse.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
|
||||||
str.append("referenceId ");
|
str.append("referenceId ");
|
||||||
str.append(s_referenceId);
|
str.append(referenceId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("protocolVersion ");
|
str.append("protocolVersion ");
|
||||||
str.append(s_protocolVersion);
|
str.append(protocolVersion);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("options ");
|
str.append("options ");
|
||||||
str.append(s_options);
|
str.append(options);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("preferredMessageSize ");
|
str.append("preferredMessageSize ");
|
||||||
str.append(s_preferredMessageSize);
|
str.append(preferredMessageSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("exceptionalRecordSize ");
|
str.append("exceptionalRecordSize ");
|
||||||
str.append(s_exceptionalRecordSize);
|
str.append(exceptionalRecordSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("result ");
|
str.append("result ");
|
||||||
str.append(s_result);
|
str.append(result);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
if (implementationId != null) {
|
||||||
if (s_implementationId != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationId ");
|
str.append("implementationId ");
|
||||||
str.append(s_implementationId);
|
str.append(implementationId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (implementationName != null) {
|
||||||
if (s_implementationName != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationName ");
|
str.append("implementationName ");
|
||||||
str.append(s_implementationName);
|
str.append(implementationName);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (implementationVersion != null) {
|
||||||
if (s_implementationVersion != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("implementationVersion ");
|
str.append("implementationVersion ");
|
||||||
str.append(s_implementationVersion);
|
str.append(implementationVersion);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (userInformationField != null) {
|
||||||
if (s_userInformationField != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("userInformationField ");
|
str.append("userInformationField ");
|
||||||
str.append(s_userInformationField);
|
str.append(userInformationField);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("otherInfo ");
|
str.append("otherInfo ");
|
||||||
str.append(s_otherInfo);
|
str.append(otherInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,7 @@ public final class IntUnit extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,10 +46,8 @@ public final class IntUnit extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// IntUnit should be encoded by a constructed BER
|
// IntUnit should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -75,8 +71,8 @@ public final class IntUnit extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("IntUnit: bad tag in s_value\n");
|
throw new ASN1EncodingException("IntUnit: bad tag in s_value\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +87,8 @@ public final class IntUnit extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 2 ||
|
if (p.getTag() != 2 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("IntUnit: bad tag in s_unitUsed\n");
|
throw new ASN1EncodingException("IntUnit: bad tag in s_unitUsed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,10 +108,8 @@ public final class IntUnit extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 2; // number of mandatories
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the IntUnit.
|
* of the IntUnit.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
str.append("value ");
|
str.append("value ");
|
||||||
|
@ -171,5 +162,4 @@ public final class IntUnit extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public final class InternationalString extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return value.berEncode();
|
return value.berEncode();
|
||||||
}
|
}
|
||||||
|
@ -64,10 +65,8 @@ public final class InternationalString extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,9 +74,8 @@ public final class InternationalString extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the InternationalString.
|
* of the InternationalString.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ public final class KnownProximityUnit extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public KnownProximityUnit(BEREncoding ber, boolean checkTag)
|
public KnownProximityUnit(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -51,10 +50,8 @@ public final class KnownProximityUnit extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
value = new ASN1Integer(ber, checkTag);
|
value = new ASN1Integer(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,10 +61,8 @@ public final class KnownProximityUnit extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return value.berEncode();
|
return value.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +74,7 @@ public final class KnownProximityUnit extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +83,7 @@ public final class KnownProximityUnit extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the KnownProximityUnit.
|
* of the KnownProximityUnit.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class ListEntries extends ASN1Any {
|
public final class ListEntries extends ASN1Any {
|
||||||
|
|
||||||
public Entry s_entries[]; // optional
|
public Entry[] s_entries; // optional
|
||||||
public DiagRec s_nonsurrogateDiagnostics[]; // optional
|
public DiagRec[] s_nonsurrogateDiagnostics; // optional
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a ListEntries from a BER encoding.
|
* 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.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// ListEntries should be encoded by a constructed BER
|
// ListEntries should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) { throw new ASN1EncodingException("bad BER form");
|
||||||
throw new ASN1EncodingException("ListEntries: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -78,8 +74,8 @@ public final class ListEntries extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
|
@ -89,7 +85,7 @@ public final class ListEntries extends ASN1Any {
|
||||||
s_entries[n] = new Entry(cons.elementAt(n), true);
|
s_entries[n] = new Entry(cons.elementAt(n), true);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -101,8 +97,8 @@ public final class ListEntries extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 2 &&
|
if (p.getTag() == 2 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
|
@ -112,7 +108,7 @@ public final class ListEntries extends ASN1Any {
|
||||||
s_nonsurrogateDiagnostics[n] = new DiagRec(cons.elementAt(n), true);
|
s_nonsurrogateDiagnostics[n] = new DiagRec(cons.elementAt(n), true);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +116,7 @@ public final class ListEntries extends ASN1Any {
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// Calculate the number of fields in the encoding
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the ListEntries.
|
* of the ListEntries.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
|
@ -29,7 +29,6 @@ public final class ListStatuses extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ListStatuses(BEREncoding ber, boolean checkTag)
|
public ListStatuses(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -44,6 +43,7 @@ public final class ListStatuses extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
// ListStatuses should be encoded by a constructed BER
|
// ListStatuses should be encoded by a constructed BER
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ public final class ListStatuses extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
BEREncoding fields[] = new BERConstructed[value.length];
|
BEREncoding fields[] = new BERConstructed[value.length];
|
||||||
int p;
|
int p;
|
||||||
|
@ -98,7 +100,7 @@ public final class ListStatuses extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the ListStatuses.
|
* of the ListStatuses.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int p;
|
int p;
|
||||||
|
|
|
@ -33,7 +33,6 @@ public final class ListStatuses1 extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ListStatuses1(BEREncoding ber, boolean checkTag)
|
public ListStatuses1(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -48,10 +47,8 @@ public final class ListStatuses1 extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// ListStatuses1 should be encoded by a constructed BER
|
// ListStatuses1 should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -103,10 +100,8 @@ public final class ListStatuses1 extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 2; // number of mandatories
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the ListStatuses1.
|
* of the ListStatuses1.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
|
@ -20,13 +20,12 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class NamePlusRecord extends ASN1Any {
|
public final class NamePlusRecord extends ASN1Any {
|
||||||
|
|
||||||
public DatabaseName s_name; // optional
|
public DatabaseName name; // optional
|
||||||
public NamePlusRecordRecord s_record;
|
public NamePlusRecordRecord record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a NamePlusRecord.
|
* Default constructor for a NamePlusRecord.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public NamePlusRecord() {
|
public NamePlusRecord() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +38,7 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,17 +51,15 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// NamePlusRecord should be encoded by a constructed BER
|
// NamePlusRecord should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("NamePlusRecord: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -78,13 +73,13 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("NamePlusRecord: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 0 &&
|
if (p.getTag() == 0 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_name = new DatabaseName(p, false);
|
name = new DatabaseName(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,31 +87,31 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("NamePlusRecord: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("NamePlusRecord: bad tag in s_record\n");
|
throw new ASN1EncodingException("bad tag in record");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tagged = (BERConstructed) p;
|
tagged = (BERConstructed) p;
|
||||||
} catch (ClassCastException e) {
|
} 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) {
|
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++;
|
part++;
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 1; // number of mandatories
|
int numFields = 1; // number of mandatories
|
||||||
if (s_name != null) {
|
if (name != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,14 +151,14 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
|
|
||||||
// Encoding s_name: DatabaseName OPTIONAL
|
// Encoding s_name: DatabaseName OPTIONAL
|
||||||
|
|
||||||
if (s_name != null) {
|
if (name != null) {
|
||||||
fields[x++] = s_name.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
|
fields[x++] = name.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_record: NamePlusRecord_record
|
// Encoding s_record: NamePlusRecord_record
|
||||||
|
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = s_record.berEncode();
|
enc[0] = record.berEncode();
|
||||||
fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc);
|
fields[x] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc);
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the NamePlusRecord.
|
* of the NamePlusRecord.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
if (s_name != null) {
|
if (name != null) {
|
||||||
str.append("name ");
|
str.append("name ");
|
||||||
str.append(s_name);
|
str.append(name);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,11 +182,10 @@ public final class NamePlusRecord extends ASN1Any {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("record ");
|
str.append("record ");
|
||||||
str.append(s_record);
|
str.append(record);
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -22,11 +22,11 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class NamePlusRecordRecord extends ASN1Any {
|
public final class NamePlusRecordRecord extends ASN1Any {
|
||||||
|
|
||||||
public ASN1External c_retrievalRecord;
|
public ASN1External retrievalRecord;
|
||||||
public DiagRec c_surrogateDiagnostic;
|
public DiagRec surrogateDiagnostic;
|
||||||
public FragmentSyntax c_startingFragment;
|
public FragmentSyntax startingFragment;
|
||||||
public FragmentSyntax c_intermediateFragment;
|
public FragmentSyntax intermediateFragment;
|
||||||
public FragmentSyntax c_finalFragment;
|
public FragmentSyntax finalFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a NamePlusRecord_record from a BER encoding.
|
* Constructor for a NamePlusRecord_record from a BER encoding.
|
||||||
|
@ -37,9 +37,7 @@ public final class NamePlusRecordRecord extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,106 +50,93 @@ public final class NamePlusRecordRecord extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
|
|
||||||
// Null out all choices
|
// Null out all choices
|
||||||
|
|
||||||
c_retrievalRecord = null;
|
retrievalRecord = null;
|
||||||
c_surrogateDiagnostic = null;
|
surrogateDiagnostic = null;
|
||||||
c_startingFragment = null;
|
startingFragment = null;
|
||||||
c_intermediateFragment = null;
|
intermediateFragment = null;
|
||||||
c_finalFragment = null;
|
finalFragment = null;
|
||||||
|
|
||||||
// Try choice retrievalRecord
|
// Try choice retrievalRecord
|
||||||
if (ber.tagGet() == 1 &&
|
if (ber.getTag() == 1 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_retrievalRecord = new ASN1External(tagwrapper.elementAt(0), true);
|
retrievalRecord = new ASN1External(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice surrogateDiagnostic
|
// Try choice surrogateDiagnostic
|
||||||
if (ber.tagGet() == 2 &&
|
if (ber.getTag() == 2 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_surrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true);
|
surrogateDiagnostic = new DiagRec(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice startingFragment
|
// Try choice startingFragment
|
||||||
if (ber.tagGet() == 3 &&
|
if (ber.getTag() == 3 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_startingFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
startingFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice intermediateFragment
|
// Try choice intermediateFragment
|
||||||
if (ber.tagGet() == 4 &&
|
if (ber.getTag() == 4 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_intermediateFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
intermediateFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice finalFragment
|
// Try choice finalFragment
|
||||||
if (ber.tagGet() == 5 &&
|
if (ber.getTag() == 5 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("NamePlusRecord_record: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_finalFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
finalFragment = new FragmentSyntax(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
throw new ASN1Exception("bad BER encoding: choice not matched");
|
||||||
throw new ASN1Exception("NamePlusRecord_record: bad BER encoding: choice not matched");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,58 +145,56 @@ public final class NamePlusRecordRecord extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
BEREncoding enc[];
|
BEREncoding enc[];
|
||||||
|
|
||||||
// Encoding choice: c_retrievalRecord
|
// Encoding choice: c_retrievalRecord
|
||||||
if (c_retrievalRecord != null) {
|
if (retrievalRecord != null) {
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_retrievalRecord.berEncode();
|
enc[0] = retrievalRecord.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 1, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_surrogateDiagnostic
|
// Encoding choice: c_surrogateDiagnostic
|
||||||
if (c_surrogateDiagnostic != null) {
|
if (surrogateDiagnostic != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_surrogateDiagnostic.berEncode();
|
enc[0] = surrogateDiagnostic.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 2, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 2, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_startingFragment
|
// Encoding choice: c_startingFragment
|
||||||
if (c_startingFragment != null) {
|
if (startingFragment != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_startingFragment.berEncode();
|
enc[0] = startingFragment.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 3, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_intermediateFragment
|
// Encoding choice: c_intermediateFragment
|
||||||
if (c_intermediateFragment != null) {
|
if (intermediateFragment != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_intermediateFragment.berEncode();
|
enc[0] = intermediateFragment.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 4, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 4, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_finalFragment
|
// Encoding choice: c_finalFragment
|
||||||
if (c_finalFragment != null) {
|
if (finalFragment != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_finalFragment.berEncode();
|
enc[0] = finalFragment.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 5, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,10 +220,8 @@ public final class NamePlusRecordRecord extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// This method must not be called!
|
// This method must not be called!
|
||||||
|
|
||||||
// Method is not available because this is a basic CHOICE
|
// 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
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the NamePlusRecord_record.
|
* of the NamePlusRecord_record.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (c_retrievalRecord != null) {
|
if (retrievalRecord != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("retrievalRecord ");
|
str.append("retrievalRecord ");
|
||||||
str.append(c_retrievalRecord);
|
str.append(retrievalRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_surrogateDiagnostic != null) {
|
if (surrogateDiagnostic != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: surrogateDiagnostic> ");
|
str.append("<ERROR: multiple CHOICE: surrogateDiagnostic> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("surrogateDiagnostic ");
|
str.append("surrogateDiagnostic ");
|
||||||
str.append(c_surrogateDiagnostic);
|
str.append(surrogateDiagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_startingFragment != null) {
|
if (startingFragment != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: startingFragment> ");
|
str.append("<ERROR: multiple CHOICE: startingFragment> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("startingFragment ");
|
str.append("startingFragment ");
|
||||||
str.append(c_startingFragment);
|
str.append(startingFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_intermediateFragment != null) {
|
if (intermediateFragment != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: intermediateFragment> ");
|
str.append("<ERROR: multiple CHOICE: intermediateFragment> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("intermediateFragment ");
|
str.append("intermediateFragment ");
|
||||||
str.append(c_intermediateFragment);
|
str.append(intermediateFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_finalFragment != null) {
|
if (finalFragment != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: finalFragment> ");
|
str.append("<ERROR: multiple CHOICE: finalFragment> ");
|
||||||
}
|
}
|
||||||
str.append("finalFragment ");
|
str.append("finalFragment ");
|
||||||
str.append(c_finalFragment);
|
str.append(finalFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.xbib.asn1.BEREncoding;
|
||||||
public final class OccurrenceByAttributes extends ASN1Any {
|
public final class OccurrenceByAttributes extends ASN1Any {
|
||||||
public OccurrenceByAttributes1 value[];
|
public OccurrenceByAttributes1 value[];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a OccurrenceByAttributes from a BER encoding.
|
* Constructor for a OccurrenceByAttributes from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -28,7 +27,6 @@ public final class OccurrenceByAttributes extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public OccurrenceByAttributes(BEREncoding ber, boolean checkTag)
|
public OccurrenceByAttributes(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -43,10 +41,8 @@ public final class OccurrenceByAttributes extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// OccurrenceByAttributes should be encoded by a constructed BER
|
// OccurrenceByAttributes should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -72,10 +68,8 @@ public final class OccurrenceByAttributes extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding fields[] = new BERConstructed[value.length];
|
BEREncoding fields[] = new BERConstructed[value.length];
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
for (p = 0; p < value.length; p++) {
|
for (p = 0; p < value.length; p++) {
|
||||||
fields[p] = value[p].berEncode();
|
fields[p] = value[p].berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the OccurrenceByAttributes.
|
* of the OccurrenceByAttributes.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
for (p = 0; p < value.length; p++) {
|
for (p = 0; p < value.length; p++) {
|
||||||
str.append(value[p]);
|
str.append(value[p]);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ public final class OccurrenceByAttributes1 extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public OccurrenceByAttributes1(BEREncoding ber, boolean checkTag)
|
public OccurrenceByAttributes1(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -49,10 +48,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// OccurrenceByAttributes1 should be encoded by a constructed BER
|
// OccurrenceByAttributes1 should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -78,8 +75,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException
|
||||||
("OccurrenceByAttributes1: bad tag in s_attributes\n");
|
("OccurrenceByAttributes1: bad tag in s_attributes\n");
|
||||||
}
|
}
|
||||||
|
@ -145,10 +142,8 @@ public final class OccurrenceByAttributes1 extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// Calculate the number of fields in the encoding
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the OccurrenceByAttributes1.
|
* of the OccurrenceByAttributes1.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
|
@ -229,10 +223,7 @@ public final class OccurrenceByAttributes1 extends ASN1Any {
|
||||||
str.append("otherOccurInfo ");
|
str.append("otherOccurInfo ");
|
||||||
str.append(s_otherOccurInfo);
|
str.append(s_otherOccurInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.xbib.asn1.ASN1Integer;
|
||||||
import org.xbib.asn1.BERConstructed;
|
import org.xbib.asn1.BERConstructed;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>OccurrenceByAttributes_occurrences</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>OccurrenceByAttributes_occurrences</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -33,7 +32,6 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public OccurrenceByAttributesOccurrences(BEREncoding ber, boolean checkTag)
|
public OccurrenceByAttributesOccurrences(BEREncoding ber, boolean checkTag)
|
||||||
throws ASN1Exception {
|
throws ASN1Exception {
|
||||||
super(ber, checkTag);
|
super(ber, checkTag);
|
||||||
|
@ -48,39 +46,35 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
c_global = null;
|
c_global = null;
|
||||||
c_byDatabase = null;
|
c_byDatabase = null;
|
||||||
if (ber.tagGet() == 2 &&
|
if (ber.getTag() == 2 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("OccurrenceByAttributes_occurrences: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("OccurrenceByAttributes_occurrences: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
c_global = new ASN1Integer(tagwrapper.elementAt(0), true);
|
c_global = new ASN1Integer(tagwrapper.elementAt(0), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice byDatabase
|
// Try choice byDatabase
|
||||||
if (ber.tagGet() == 3 &&
|
if (ber.getTag() == 3 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
BEREncoding ber_data;
|
BEREncoding ber_data;
|
||||||
ber_data = ber;
|
ber_data = ber;
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber_data;
|
berConstructed = (BERConstructed) ber_data;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("OccurrenceByAttributes_occurrences: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
|
@ -94,7 +88,7 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
|
||||||
return;
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
BEREncoding f2[];
|
BEREncoding f2[];
|
||||||
|
@ -156,7 +148,7 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// This method must not be called!
|
// 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
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the OccurrenceByAttributes_occurrences.
|
* of the OccurrenceByAttributes_occurrences.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
|
@ -203,5 +194,4 @@ public final class OccurrenceByAttributesOccurrences extends ASN1Any {
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,18 +49,15 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// OccurrenceByAttributes_occurrences_byDatabase should be encoded by a constructed BER
|
// OccurrenceByAttributes_occurrences_byDatabase should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("OccurrenceByAttributes_occurrences_byDatabase: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -73,7 +70,7 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("OccurrenceByAttributes_occurrences_byDatabase: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
|
@ -93,8 +90,8 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_num = new ASN1Integer(p, false);
|
s_num = new ASN1Integer(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +113,7 @@ public final class OccurrenceByAttributesOccurrencesByDatabase extends ASN1Any {
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// Calculate the number of fields in the encoding
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the OccurrenceByAttributes_occurrences_byDatabase.
|
* of the OccurrenceByAttributes_occurrences_byDatabase.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import org.xbib.asn1.ASN1EncodingException;
|
||||||
import org.xbib.asn1.ASN1Exception;
|
import org.xbib.asn1.ASN1Exception;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>Operand</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>Operand</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -19,15 +18,13 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class Operand extends ASN1Any {
|
public final class Operand extends ASN1Any {
|
||||||
|
|
||||||
public AttributesPlusTerm c_attrTerm;
|
public AttributesPlusTerm attrTerm;
|
||||||
public ResultSetId c_resultSet;
|
public ResultSetId resultSet;
|
||||||
public ResultSetPlusAttributes c_resultAttr;
|
public ResultSetPlusAttributes resultAttr;
|
||||||
|
|
||||||
|
|
||||||
public Operand() {
|
public Operand() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Operand from a BER encoding.
|
* Constructor for a Operand from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -37,9 +34,7 @@ public final class Operand extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,19 +47,17 @@ public final class Operand extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Null out all choices
|
// Null out all choices
|
||||||
|
|
||||||
c_attrTerm = null;
|
attrTerm = null;
|
||||||
c_resultSet = null;
|
resultSet = null;
|
||||||
c_resultAttr = null;
|
resultAttr = null;
|
||||||
|
|
||||||
// Try choice attrTerm
|
// Try choice attrTerm
|
||||||
try {
|
try {
|
||||||
c_attrTerm = new AttributesPlusTerm(ber, checkTag);
|
attrTerm = new AttributesPlusTerm(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
|
@ -72,7 +65,7 @@ public final class Operand extends ASN1Any {
|
||||||
|
|
||||||
// Try choice resultSet
|
// Try choice resultSet
|
||||||
try {
|
try {
|
||||||
c_resultSet = new ResultSetId(ber, checkTag);
|
resultSet = new ResultSetId(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// failed to decode, continue on
|
||||||
|
@ -80,13 +73,13 @@ public final class Operand extends ASN1Any {
|
||||||
|
|
||||||
// Try choice resultAttr
|
// Try choice resultAttr
|
||||||
try {
|
try {
|
||||||
c_resultAttr = new ResultSetPlusAttributes(ber, checkTag);
|
resultAttr = new ResultSetPlusAttributes(ber, checkTag);
|
||||||
return;
|
return;
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
// failed to decode, continue on
|
// 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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
// Encoding choice: c_attrTerm
|
// Encoding choice: c_attrTerm
|
||||||
if (c_attrTerm != null) {
|
if (attrTerm != null) {
|
||||||
chosen = c_attrTerm.berEncode();
|
chosen = attrTerm.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_resultSet
|
// Encoding choice: c_resultSet
|
||||||
if (c_resultSet != null) {
|
if (resultSet != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = c_resultSet.berEncode();
|
chosen = resultSet.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_resultAttr
|
// Encoding choice: c_resultAttr
|
||||||
if (c_resultAttr != null) {
|
if (resultAttr != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
throw new ASN1Exception("CHOICE multiply set");
|
||||||
}
|
}
|
||||||
chosen = c_resultAttr.berEncode();
|
chosen = resultAttr.berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for error of having none of the choices set
|
// Check for error of having none of the choices set
|
||||||
|
@ -144,6 +135,7 @@ public final class Operand extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// This method must not be called!
|
// 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
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the Operand.
|
* of the Operand.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (c_attrTerm != null) {
|
if (attrTerm != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("attrTerm ");
|
str.append("attrTerm ");
|
||||||
str.append(c_attrTerm);
|
str.append(attrTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_resultSet != null) {
|
if (resultSet != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: resultSet> ");
|
str.append("<ERROR: multiple CHOICE: resultSet> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("resultSet ");
|
str.append("resultSet ");
|
||||||
str.append(c_resultSet);
|
str.append(resultSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_resultAttr != null) {
|
if (resultAttr != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: resultAttr> ");
|
str.append("<ERROR: multiple CHOICE: resultAttr> ");
|
||||||
}
|
}
|
||||||
str.append("resultAttr ");
|
str.append("resultAttr ");
|
||||||
str.append(c_resultAttr);
|
str.append(resultAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.xbib.asn1.ASN1Null;
|
||||||
import org.xbib.asn1.BERConstructed;
|
import org.xbib.asn1.BERConstructed;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>Operator</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>Operator</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -22,16 +21,14 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class Operator extends ASN1Any {
|
public final class Operator extends ASN1Any {
|
||||||
|
|
||||||
public ASN1Null c_and;
|
public ASN1Null andOp;
|
||||||
public ASN1Null c_or;
|
public ASN1Null orOp;
|
||||||
public ASN1Null c_and_not;
|
public ASN1Null andNotOp;
|
||||||
public ProximityOperator c_prox;
|
public ProximityOperator proxOp;
|
||||||
|
|
||||||
|
|
||||||
public Operator() {
|
public Operator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Operator from a BER encoding.
|
* Constructor for a Operator from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -41,9 +38,7 @@ public final class Operator extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,16 +51,14 @@ public final class Operator extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Check tag matches
|
// Check tag matches
|
||||||
|
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 46 ||
|
if (ber.getTag() != 46 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("Operator: bad BER: tag=" + ber.tagGet() + " expected 46\n");
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 46");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,51 +68,48 @@ public final class Operator extends ASN1Any {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER tag form");
|
||||||
("Operator: bad BER tag form\n");
|
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
if (tagwrapper.numberComponents() != 1) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER tag form");
|
||||||
("Operator: bad BER tag form\n");
|
|
||||||
}
|
}
|
||||||
ber = tagwrapper.elementAt(0);
|
ber = tagwrapper.elementAt(0);
|
||||||
|
|
||||||
// Null out all choices
|
// Null out all choices
|
||||||
|
|
||||||
c_and = null;
|
andOp = null;
|
||||||
c_or = null;
|
orOp = null;
|
||||||
c_and_not = null;
|
andNotOp = null;
|
||||||
c_prox = null;
|
proxOp = null;
|
||||||
|
|
||||||
// Try choice and
|
// Try choice and
|
||||||
if (ber.tagGet() == 0 &&
|
if (ber.getTag() == 0 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_and = new ASN1Null(ber, false);
|
andOp = new ASN1Null(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice or
|
// Try choice or
|
||||||
if (ber.tagGet() == 1 &&
|
if (ber.getTag() == 1 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_or = new ASN1Null(ber, false);
|
orOp = new ASN1Null(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice and-not
|
// Try choice and-not
|
||||||
if (ber.tagGet() == 2 &&
|
if (ber.getTag() == 2 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_and_not = new ASN1Null(ber, false);
|
andNotOp = new ASN1Null(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice prox
|
// Try choice prox
|
||||||
if (ber.tagGet() == 3 &&
|
if (ber.getTag() == 3 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_prox = new ProximityOperator(ber, false);
|
proxOp = new ProximityOperator(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
throw new ASN1Exception("bad BER encoding: choice not matched");
|
||||||
throw new ASN1Exception("Operator: bad BER encoding: choice not matched");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,10 +118,8 @@ public final class Operator extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 46);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 46);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,39 +129,37 @@ public final class Operator extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
// Encoding choice: c_and
|
// Encoding choice: c_and
|
||||||
if (c_and != null) {
|
if (andOp != null) {
|
||||||
chosen = c_and.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
|
chosen = andOp.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding choice: c_or
|
// Encoding choice: c_or
|
||||||
if (c_or != null) {
|
if (orOp != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
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
|
// Encoding choice: c_and_not
|
||||||
if (c_and_not != null) {
|
if (andNotOp != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
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
|
// Encoding choice: c_prox
|
||||||
if (c_prox != null) {
|
if (proxOp != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
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
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the Operator.
|
* of the Operator.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (c_and != null) {
|
if (andOp != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("and ");
|
str.append("and ");
|
||||||
str.append(c_and);
|
str.append(andOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_or != null) {
|
if (orOp != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: or> ");
|
str.append("<ERROR: multiple CHOICE: or> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("or ");
|
str.append("or ");
|
||||||
str.append(c_or);
|
str.append(orOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_and_not != null) {
|
if (andNotOp != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: and-not> ");
|
str.append("<ERROR: multiple CHOICE: and-not> ");
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
str.append("and-not ");
|
str.append("and-not ");
|
||||||
str.append(c_and_not);
|
str.append(andNotOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c_prox != null) {
|
if (proxOp != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: prox> ");
|
str.append("<ERROR: multiple CHOICE: prox> ");
|
||||||
}
|
}
|
||||||
found = true;
|
|
||||||
str.append("prox ");
|
str.append("prox ");
|
||||||
str.append(c_prox);
|
str.append(proxOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1EncodingException;
|
||||||
import org.xbib.asn1.ASN1Exception;
|
import org.xbib.asn1.ASN1Exception;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>Options</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>Options</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -15,6 +14,7 @@ import org.xbib.asn1.BEREncoding;
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public final class Options extends ASN1Any {
|
public final class Options extends ASN1Any {
|
||||||
|
|
||||||
public ASN1BitString value;
|
public ASN1BitString value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,6 @@ public final class Options extends ASN1Any {
|
||||||
public Options() {
|
public Options() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Options from a BER encoding.
|
* Constructor for a Options from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -33,9 +32,7 @@ public final class Options extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,16 +45,14 @@ public final class Options extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Check tag matches
|
// Check tag matches
|
||||||
|
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 4 ||
|
if (ber.getTag() != 4 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("Options: bad BER: tag=" + ber.tagGet() + " expected 4\n");
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +65,7 @@ public final class Options extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 4);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +78,7 @@ public final class Options extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
return value.berEncode(tagType, tag);
|
return value.berEncode(tagType, tag);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +87,8 @@ public final class Options extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the Options.
|
* of the Options.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import org.xbib.asn1.ASN1Exception;
|
||||||
import org.xbib.asn1.BERConstructed;
|
import org.xbib.asn1.BERConstructed;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>OtherInformation</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>OtherInformation</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -15,8 +14,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public final class OtherInformation extends ASN1Any {
|
public final class OtherInformation extends ASN1Any {
|
||||||
public OtherInformation1 value[];
|
|
||||||
|
|
||||||
|
public OtherInformation1[] value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a OtherInformation.
|
* Default constructor for a OtherInformation.
|
||||||
|
@ -25,7 +24,6 @@ public final class OtherInformation extends ASN1Any {
|
||||||
public OtherInformation() {
|
public OtherInformation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a OtherInformation from a BER encoding.
|
* Constructor for a OtherInformation from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -35,9 +33,7 @@ public final class OtherInformation extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,16 +46,14 @@ public final class OtherInformation extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Check tag matches
|
// Check tag matches
|
||||||
|
|
||||||
if (checkTag) {
|
if (checkTag) {
|
||||||
if (ber.tagGet() != 201 ||
|
if (ber.getTag() != 201 ||
|
||||||
ber.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException("OtherInformation: bad BER: tag=" + ber.tagGet() + " expected 201\n");
|
throw new ASN1EncodingException("bad BER: tag=" + ber.getTag() + " expected 201");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +63,7 @@ public final class OtherInformation extends ASN1Any {
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("OtherInformation: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -88,10 +82,8 @@ public final class OtherInformation extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 201);
|
return berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +95,8 @@ public final class OtherInformation extends ASN1Any {
|
||||||
* @return The BER encoding of the object.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding fields[] = new BERConstructed[value.length];
|
BEREncoding fields[] = new BERConstructed[value.length];
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
|
@ -121,9 +111,8 @@ public final class OtherInformation extends ASN1Any {
|
||||||
* Returns a new String object containing a text representing
|
* Returns a new String object containing a text representing
|
||||||
* of the OtherInformation.
|
* of the OtherInformation.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
|
@ -135,5 +124,4 @@ public final class OtherInformation extends ASN1Any {
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class OtherInformation1 extends ASN1Any {
|
public final class OtherInformation1 extends ASN1Any {
|
||||||
|
|
||||||
public InfoCategory s_category; // optional
|
public InfoCategory category; // optional
|
||||||
public OtherInformationInformation s_information;
|
public OtherInformationInformation information;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a OtherInformation1 from a BER encoding.
|
* Constructor for a OtherInformation1 from a BER encoding.
|
||||||
|
@ -31,9 +31,7 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +44,8 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// OtherInformation1 should be encoded by a constructed BER
|
// OtherInformation1 should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
|
@ -73,9 +69,9 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() == 1 &&
|
if (p.getTag() == 1 &&
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
s_category = new InfoCategory(p, false);
|
category = new InfoCategory(p, false);
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +83,7 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
s_information = new OtherInformationInformation(p, true);
|
information = new OtherInformationInformation(p, true);
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
@ -103,10 +99,8 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 1; // number of mandatories
|
int numFields = 1; // number of mandatories
|
||||||
if (s_category != null) {
|
if (category != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,13 +128,13 @@ public final class OtherInformation1 extends ASN1Any {
|
||||||
|
|
||||||
// Encoding s_category: InfoCategory OPTIONAL
|
// Encoding s_category: InfoCategory OPTIONAL
|
||||||
|
|
||||||
if (s_category != null) {
|
if (category != null) {
|
||||||
fields[x++] = s_category.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
|
fields[x++] = category.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_information: OtherInformation_information
|
// Encoding s_information: OtherInformation_information
|
||||||
|
|
||||||
fields[x] = s_information.berEncode();
|
fields[x] = information.berEncode();
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the OtherInformation1.
|
* of the OtherInformation1.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
|
||||||
if (s_category != null) {
|
if (category != null) {
|
||||||
str.append("category ");
|
str.append("category ");
|
||||||
str.append(s_category);
|
str.append(category);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
str.append("information ");
|
str.append("information ");
|
||||||
str.append(s_information);
|
str.append(information);
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -37,9 +37,7 @@ public final class OtherInformationInformation extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +50,8 @@ public final class OtherInformationInformation extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Null out all choices
|
// Null out all choices
|
||||||
|
|
||||||
c_characterInfo = null;
|
c_characterInfo = null;
|
||||||
|
@ -64,34 +60,34 @@ public final class OtherInformationInformation extends ASN1Any {
|
||||||
c_oid = null;
|
c_oid = null;
|
||||||
|
|
||||||
// Try choice characterInfo
|
// Try choice characterInfo
|
||||||
if (ber.tagGet() == 2 &&
|
if (ber.getTag() == 2 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_characterInfo = new InternationalString(ber, false);
|
c_characterInfo = new InternationalString(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice binaryInfo
|
// Try choice binaryInfo
|
||||||
if (ber.tagGet() == 3 &&
|
if (ber.getTag() == 3 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_binaryInfo = new ASN1OctetString(ber, false);
|
c_binaryInfo = new ASN1OctetString(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice externallyDefinedInfo
|
// Try choice externallyDefinedInfo
|
||||||
if (ber.tagGet() == 4 &&
|
if (ber.getTag() == 4 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_externallyDefinedInfo = new ASN1External(ber, false);
|
c_externallyDefinedInfo = new ASN1External(ber, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try choice oid
|
// Try choice oid
|
||||||
if (ber.tagGet() == 5 &&
|
if (ber.getTag() == 5 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_oid = new ASN1ObjectIdentifier(ber, false);
|
c_oid = new ASN1ObjectIdentifier(ber, false);
|
||||||
return;
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
|
|
||||||
// Encoding choice: c_characterInfo
|
// Encoding choice: c_characterInfo
|
||||||
|
@ -156,10 +150,8 @@ public final class OtherInformationInformation extends ASN1Any {
|
||||||
* @param tag the tag.
|
* @param tag the tag.
|
||||||
* @throws ASN1Exception if it cannot be BER encoded.
|
* @throws ASN1Exception if it cannot be BER encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// This method must not be called!
|
// This method must not be called!
|
||||||
|
|
||||||
// Method is not available because this is a basic CHOICE
|
// 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
|
// tag on it, otherwise the tag identifying which CHOICE
|
||||||
// it is will be overwritten and lost.
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the OtherInformation_information.
|
* of the OtherInformation_information.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (c_characterInfo != null) {
|
if (c_characterInfo != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("characterInfo ");
|
str.append("characterInfo ");
|
||||||
|
@ -212,10 +203,7 @@ public final class OtherInformationInformation extends ASN1Any {
|
||||||
str.append("oid ");
|
str.append("oid ");
|
||||||
str.append(c_oid);
|
str.append(c_oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.append("}");
|
str.append("}");
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 <code>PDU</code> from <code>Z39-50-APDU-1995</code>.
|
|
||||||
* <pre>
|
|
||||||
* 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
|
|
||||||
* }
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
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("<ERROR: multiple CHOICE: initResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("initResponse ");
|
|
||||||
str.append(c_initResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_searchRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: searchRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("searchRequest ");
|
|
||||||
str.append(c_searchRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_searchResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: searchResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("searchResponse ");
|
|
||||||
str.append(c_searchResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_presentRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: presentRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("presentRequest ");
|
|
||||||
str.append(c_presentRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_presentResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: presentResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("presentResponse ");
|
|
||||||
str.append(c_presentResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_deleteResultSetRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: deleteResultSetRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("deleteResultSetRequest ");
|
|
||||||
str.append(c_deleteResultSetRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_deleteResultSetResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: deleteResultSetResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("deleteResultSetResponse ");
|
|
||||||
str.append(c_deleteResultSetResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_accessControlRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: accessControlRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("accessControlRequest ");
|
|
||||||
str.append(c_accessControlRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_accessControlResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: accessControlResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("accessControlResponse ");
|
|
||||||
str.append(c_accessControlResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_resourceControlRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: resourceControlRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("resourceControlRequest ");
|
|
||||||
str.append(c_resourceControlRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_resourceControlResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: resourceControlResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("resourceControlResponse ");
|
|
||||||
str.append(c_resourceControlResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_triggerResourceControlRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: triggerResourceControlRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("triggerResourceControlRequest ");
|
|
||||||
str.append(c_triggerResourceControlRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_resourceReportRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: resourceReportRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("resourceReportRequest ");
|
|
||||||
str.append(c_resourceReportRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_resourceReportResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: resourceReportResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("resourceReportResponse ");
|
|
||||||
str.append(c_resourceReportResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_scanRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: scanRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("scanRequest ");
|
|
||||||
str.append(c_scanRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_scanResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: scanResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("scanResponse ");
|
|
||||||
str.append(c_scanResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_sortRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: sortRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("sortRequest ");
|
|
||||||
str.append(c_sortRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_sortResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: sortResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("sortResponse ");
|
|
||||||
str.append(c_sortResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_segmentRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: segmentRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("segmentRequest ");
|
|
||||||
str.append(c_segmentRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_extendedServicesRequest != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: extendedServicesRequest> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("extendedServicesRequest ");
|
|
||||||
str.append(c_extendedServicesRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_extendedServicesResponse != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: extendedServicesResponse> ");
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
str.append("extendedServicesResponse ");
|
|
||||||
str.append(c_extendedServicesResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c_close != null) {
|
|
||||||
if (found) {
|
|
||||||
str.append("<ERROR: multiple CHOICE: close> ");
|
|
||||||
}
|
|
||||||
str.append("close ");
|
|
||||||
str.append(c_close);
|
|
||||||
}
|
|
||||||
str.append("}");
|
|
||||||
return str.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,7 +17,7 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class Permissions extends ASN1Any {
|
public final class Permissions extends ASN1Any {
|
||||||
|
|
||||||
public Permissions1 value[];
|
public Permissions1[] value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Permissions from a BER encoding.
|
* Constructor for a Permissions from a BER encoding.
|
||||||
|
@ -28,9 +28,7 @@ public final class Permissions extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,17 +41,15 @@ public final class Permissions extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Permissions should be encoded by a constructed BER
|
// Permissions should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Permissions: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
value = new Permissions1[numParts];
|
value = new Permissions1[numParts];
|
||||||
|
@ -69,10 +65,8 @@ public final class Permissions extends ASN1Any {
|
||||||
* @return The BER encoding.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
BEREncoding fields[] = new BERConstructed[value.length];
|
BEREncoding fields[] = new BERConstructed[value.length];
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
for (p = 0; p < value.length; p++) {
|
for (p = 0; p < value.length; p++) {
|
||||||
fields[p] = value[p].berEncode();
|
fields[p] = value[p].berEncode();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the Permissions.
|
* of the Permissions.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int p;
|
int p;
|
||||||
for (p = 0; p < value.length; p++) {
|
for (p = 0; p < value.length; p++) {
|
||||||
|
@ -113,5 +102,4 @@ public final class Permissions extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.xbib.asn1.ASN1Sequence;
|
||||||
import org.xbib.asn1.BERConstructed;
|
import org.xbib.asn1.BERConstructed;
|
||||||
import org.xbib.asn1.BEREncoding;
|
import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing a <code>Permissions1</code> from <code>Z39-50-APDU-1995</code>.
|
* Class for representing a <code>Permissions1</code> from <code>Z39-50-APDU-1995</code>.
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -24,7 +23,6 @@ public final class Permissions1 extends ASN1Any {
|
||||||
public InternationalString s_userId;
|
public InternationalString s_userId;
|
||||||
public ASN1Integer s_allowableFunctions[];
|
public ASN1Integer s_allowableFunctions[];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a Permissions1 from a BER encoding.
|
* Constructor for a Permissions1 from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -34,9 +32,7 @@ public final class Permissions1 extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,18 +45,15 @@ public final class Permissions1 extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Permissions1 should be encoded by a constructed BER
|
// Permissions1 should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad BER form");
|
||||||
("Permissions1: bad BER form\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
@ -73,14 +66,13 @@ public final class Permissions1 extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("Permissions1: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 1 ||
|
if (p.getTag() != 1 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad tag in s_userId");
|
||||||
("Permissions1: bad tag in s_userId\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_userId = new InternationalString(p, false);
|
s_userId = new InternationalString(p, false);
|
||||||
|
@ -90,14 +82,13 @@ public final class Permissions1 extends ASN1Any {
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("Permissions1: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
if (p.tagGet() != 2 ||
|
if (p.getTag() != 2 ||
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
throw new ASN1EncodingException
|
throw new ASN1EncodingException("bad tag in s_allowableFunctions");
|
||||||
("Permissions1: bad tag in s_allowableFunctions\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -109,14 +100,14 @@ public final class Permissions1 extends ASN1Any {
|
||||||
s_allowableFunctions[n] = new ASN1Integer(cons.elementAt(n), true);
|
s_allowableFunctions[n] = new ASN1Integer(cons.elementAt(n), true);
|
||||||
}
|
}
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
// Calculate the number of fields in the encoding
|
// 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
|
* Returns a new String object containing a text representing
|
||||||
* of the Permissions1.
|
* of the Permissions1.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
@ -200,5 +189,4 @@ public final class Permissions1 extends ASN1Any {
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,23 +32,24 @@ import org.xbib.asn1.BEREncoding;
|
||||||
|
|
||||||
public final class PresentRequest extends ASN1Any {
|
public final class PresentRequest extends ASN1Any {
|
||||||
|
|
||||||
public ReferenceId s_referenceId; // optional
|
public ReferenceId referenceId; // optional
|
||||||
public ResultSetId s_resultSetId;
|
public ResultSetId resultSetId;
|
||||||
public ASN1Integer s_resultSetStartPoint;
|
public ASN1Integer resultSetStartPoint;
|
||||||
public ASN1Integer s_numberOfRecordsRequested;
|
public ASN1Integer numberOfRecordsRequested;
|
||||||
public Range s_additionalRanges[]; // optional
|
public Range[] additionalRanges; // optional
|
||||||
public PresentRequestRecordComposition s_recordComposition; // optional
|
public PresentRequestRecordComposition recordComposition; // optional
|
||||||
public ASN1ObjectIdentifier s_preferredRecordSyntax; // optional
|
public ASN1ObjectIdentifier preferredRecordSyntax; // optional
|
||||||
public ASN1Integer s_maxSegmentCount; // optional
|
public ASN1Integer maxSegmentCount; // optional
|
||||||
public ASN1Integer s_maxRecordSize; // optional
|
public ASN1Integer maxRecordSize; // optional
|
||||||
public ASN1Integer s_maxSegmentSize; // optional
|
public ASN1Integer maxSegmentSize; // optional
|
||||||
public OtherInformation s_otherInfo; // optional
|
public OtherInformation otherInfo; // optional
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor for a PresentRequest.
|
* Default constructor for a PresentRequest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public PresentRequest() {
|
public PresentRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for a PresentRequest from a BER encoding.
|
* Constructor for a PresentRequest from a BER encoding.
|
||||||
*
|
*
|
||||||
|
@ -58,9 +59,7 @@ public final class PresentRequest extends ASN1Any {
|
||||||
* usually be passing true.
|
* usually be passing true.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @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);
|
super(ber, checkTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,201 +72,157 @@ public final class PresentRequest extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
berDecode(BEREncoding ber, boolean checkTag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// PresentRequest should be encoded by a constructed BER
|
// PresentRequest should be encoded by a constructed BER
|
||||||
|
|
||||||
BERConstructed berConstructed;
|
BERConstructed berConstructed;
|
||||||
try {
|
try {
|
||||||
berConstructed = (BERConstructed) ber;
|
berConstructed = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("PresentRequest: bad BER form\n");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to decode the components
|
// Prepare to decode the components
|
||||||
|
|
||||||
int numParts = berConstructed.numberComponents();
|
int numParts = berConstructed.numberComponents();
|
||||||
int part = 0;
|
int part = 0;
|
||||||
BEREncoding p;
|
BEREncoding p;
|
||||||
|
|
||||||
// Decoding: referenceId ReferenceId OPTIONAL
|
// Decoding: referenceId ReferenceId OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("PresentRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_referenceId = new ReferenceId(p, true);
|
referenceId = new ReferenceId(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_referenceId = null; // no, not present
|
referenceId = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: resultSetId ResultSetId
|
// Decoding: resultSetId ResultSetId
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("PresentRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
resultSetId = new ResultSetId(p, true);
|
||||||
s_resultSetId = new ResultSetId(p, true);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: resultSetStartPoint [30] IMPLICIT INTEGER
|
// Decoding: resultSetStartPoint [30] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("PresentRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() != 30 ||
|
||||||
if (p.tagGet() != 30 ||
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
throw new ASN1EncodingException("bad tag in resultSetStartPoint\n");
|
||||||
throw new ASN1EncodingException("PresentRequest: bad tag in s_resultSetStartPoint\n");
|
|
||||||
}
|
}
|
||||||
|
resultSetStartPoint = new ASN1Integer(p, false);
|
||||||
s_resultSetStartPoint = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Decoding: numberOfRecordsRequested [29] IMPLICIT INTEGER
|
// Decoding: numberOfRecordsRequested [29] IMPLICIT INTEGER
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
// End of record, but still more elements to get
|
// End of record, but still more elements to get
|
||||||
throw new ASN1Exception("PresentRequest: incomplete");
|
throw new ASN1Exception("incomplete");
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() != 29 ||
|
||||||
if (p.tagGet() != 29 ||
|
p.getTagType() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() != BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
throw new ASN1EncodingException("PresentRequest: bad tag in numberOfRecordsRequested");
|
||||||
throw new ASN1EncodingException("PresentRequest: bad tag in s_numberOfRecordsRequested\n");
|
|
||||||
}
|
}
|
||||||
|
numberOfRecordsRequested = new ASN1Integer(p, false);
|
||||||
s_numberOfRecordsRequested = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
|
|
||||||
// Remaining elements are optional, set variables
|
// Remaining elements are optional, set variables
|
||||||
// to null (not present) so can return at endStream of BER
|
// to null (not present) so can return at endStream of BER
|
||||||
|
additionalRanges = null;
|
||||||
s_additionalRanges = null;
|
recordComposition = null;
|
||||||
s_recordComposition = null;
|
preferredRecordSyntax = null;
|
||||||
s_preferredRecordSyntax = null;
|
maxSegmentCount = null;
|
||||||
s_maxSegmentCount = null;
|
maxRecordSize = null;
|
||||||
s_maxRecordSize = null;
|
maxSegmentSize = null;
|
||||||
s_maxSegmentSize = null;
|
otherInfo = null;
|
||||||
s_otherInfo = null;
|
|
||||||
|
|
||||||
// Decoding: additionalRanges [212] IMPLICIT SEQUENCE OF Range OPTIONAL
|
// Decoding: additionalRanges [212] IMPLICIT SEQUENCE OF Range OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 212 &&
|
||||||
if (p.tagGet() == 212 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
|
||||||
try {
|
try {
|
||||||
BERConstructed cons = (BERConstructed) p;
|
BERConstructed cons = (BERConstructed) p;
|
||||||
int parts = cons.numberComponents();
|
int parts = cons.numberComponents();
|
||||||
s_additionalRanges = new Range[parts];
|
additionalRanges = new Range[parts];
|
||||||
int n;
|
int n;
|
||||||
for (n = 0; n < parts; 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) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("Bad BER");
|
throw new ASN1EncodingException("bad BER");
|
||||||
}
|
}
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: recordComposition PresentRequest_recordComposition OPTIONAL
|
// Decoding: recordComposition PresentRequest_recordComposition OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_recordComposition = new PresentRequestRecordComposition(p, true);
|
recordComposition = new PresentRequestRecordComposition(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_recordComposition = null; // no, not present
|
recordComposition = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: preferredRecordSyntax [104] IMPLICIT OBJECT IDENTIFIER OPTIONAL
|
// Decoding: preferredRecordSyntax [104] IMPLICIT OBJECT IDENTIFIER OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 104 &&
|
||||||
if (p.tagGet() == 104 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
preferredRecordSyntax = new ASN1ObjectIdentifier(p, false);
|
||||||
s_preferredRecordSyntax = new ASN1ObjectIdentifier(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: maxSegmentCount [204] IMPLICIT INTEGER OPTIONAL
|
// Decoding: maxSegmentCount [204] IMPLICIT INTEGER OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 204 &&
|
||||||
if (p.tagGet() == 204 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
maxSegmentCount = new ASN1Integer(p, false);
|
||||||
s_maxSegmentCount = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: maxRecordSize [206] IMPLICIT INTEGER OPTIONAL
|
// Decoding: maxRecordSize [206] IMPLICIT INTEGER OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 206 &&
|
||||||
if (p.tagGet() == 206 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
maxRecordSize = new ASN1Integer(p, false);
|
||||||
s_maxRecordSize = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: maxSegmentSize [207] IMPLICIT INTEGER OPTIONAL
|
// Decoding: maxSegmentSize [207] IMPLICIT INTEGER OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
if (p.getTag() == 207 &&
|
||||||
if (p.tagGet() == 207 &&
|
p.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
p.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
maxSegmentSize = new ASN1Integer(p, false);
|
||||||
s_maxSegmentSize = new ASN1Integer(p, false);
|
|
||||||
part++;
|
part++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decoding: otherInfo OtherInformation OPTIONAL
|
// Decoding: otherInfo OtherInformation OPTIONAL
|
||||||
|
|
||||||
if (numParts <= part) {
|
if (numParts <= part) {
|
||||||
return; // no more data, but ok (rest is optional)
|
return; // no more data, but ok (rest is optional)
|
||||||
}
|
}
|
||||||
p = berConstructed.elementAt(part);
|
p = berConstructed.elementAt(part);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s_otherInfo = new OtherInformation(p, true);
|
otherInfo = new OtherInformation(p, true);
|
||||||
part++; // yes, consumed
|
part++; // yes, consumed
|
||||||
} catch (ASN1Exception e) {
|
} catch (ASN1Exception e) {
|
||||||
s_otherInfo = null; // no, not present
|
otherInfo = null; // no, not present
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should not be any more parts
|
// Should not be any more parts
|
||||||
|
|
||||||
if (part < numParts) {
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
berEncode()
|
|
||||||
throws ASN1Exception {
|
|
||||||
return berEncode(BEREncoding.UNIVERSAL_TAG, ASN1Sequence.SEQUENCE_TAG);
|
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.
|
* @return The BER encoding of the object.
|
||||||
* @throws ASN1Exception When invalid or cannot be encoded.
|
* @throws ASN1Exception When invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding
|
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
||||||
berEncode(int tagType, int tag)
|
|
||||||
throws ASN1Exception {
|
|
||||||
// Calculate the number of fields in the encoding
|
// Calculate the number of fields in the encoding
|
||||||
|
|
||||||
int numFields = 3; // number of mandatories
|
int numFields = 3; // number of mandatories
|
||||||
if (s_referenceId != null) {
|
if (referenceId != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_additionalRanges != null) {
|
if (additionalRanges != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_recordComposition != null) {
|
if (recordComposition != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_preferredRecordSyntax != null) {
|
if (preferredRecordSyntax != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_maxSegmentCount != null) {
|
if (maxSegmentCount != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_maxRecordSize != null) {
|
if (maxRecordSize != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_maxSegmentSize != null) {
|
if (maxSegmentSize != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
if (s_otherInfo != null) {
|
if (otherInfo != null) {
|
||||||
numFields++;
|
numFields++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode it
|
// Encode it
|
||||||
|
|
||||||
BEREncoding fields[] = new BEREncoding[numFields];
|
BEREncoding fields[] = new BEREncoding[numFields];
|
||||||
int x = 0;
|
int x = 0;
|
||||||
BEREncoding f2[];
|
BEREncoding f2[];
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
// Encoding s_referenceId: ReferenceId OPTIONAL
|
// Encoding s_referenceId: ReferenceId OPTIONAL
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
fields[x++] = referenceId.berEncode();
|
||||||
fields[x++] = s_referenceId.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_resultSetId: ResultSetId
|
// Encoding s_resultSetId: ResultSetId
|
||||||
|
fields[x++] = resultSetId.berEncode();
|
||||||
fields[x++] = s_resultSetId.berEncode();
|
|
||||||
|
|
||||||
// Encoding s_resultSetStartPoint: INTEGER
|
// Encoding s_resultSetStartPoint: INTEGER
|
||||||
|
fields[x++] = resultSetStartPoint.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 30);
|
||||||
fields[x++] = s_resultSetStartPoint.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 30);
|
|
||||||
|
|
||||||
// Encoding s_numberOfRecordsRequested: INTEGER
|
// Encoding s_numberOfRecordsRequested: INTEGER
|
||||||
|
fields[x++] = numberOfRecordsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 29);
|
||||||
fields[x++] = s_numberOfRecordsRequested.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 29);
|
|
||||||
|
|
||||||
// Encoding s_additionalRanges: SEQUENCE OF OPTIONAL
|
// Encoding s_additionalRanges: SEQUENCE OF OPTIONAL
|
||||||
|
if (additionalRanges != null) {
|
||||||
if (s_additionalRanges != null) {
|
f2 = new BEREncoding[additionalRanges.length];
|
||||||
f2 = new BEREncoding[s_additionalRanges.length];
|
for (p = 0; p < additionalRanges.length; p++) {
|
||||||
|
f2[p] = additionalRanges[p].berEncode();
|
||||||
for (p = 0; p < s_additionalRanges.length; p++) {
|
|
||||||
f2[p] = s_additionalRanges[p].berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 212, f2);
|
fields[x++] = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 212, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_recordComposition: PresentRequest_recordComposition OPTIONAL
|
// Encoding s_recordComposition: PresentRequest_recordComposition OPTIONAL
|
||||||
|
if (recordComposition != null) {
|
||||||
if (s_recordComposition != null) {
|
fields[x++] = recordComposition.berEncode();
|
||||||
fields[x++] = s_recordComposition.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_preferredRecordSyntax: OBJECT IDENTIFIER OPTIONAL
|
// Encoding s_preferredRecordSyntax: OBJECT IDENTIFIER OPTIONAL
|
||||||
|
if (preferredRecordSyntax != null) {
|
||||||
if (s_preferredRecordSyntax != null) {
|
fields[x++] = preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104);
|
||||||
fields[x++] = s_preferredRecordSyntax.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 104);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_maxSegmentCount: INTEGER OPTIONAL
|
// Encoding s_maxSegmentCount: INTEGER OPTIONAL
|
||||||
|
if (maxSegmentCount != null) {
|
||||||
if (s_maxSegmentCount != null) {
|
fields[x++] = maxSegmentCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 204);
|
||||||
fields[x++] = s_maxSegmentCount.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 204);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_maxRecordSize: INTEGER OPTIONAL
|
// Encoding s_maxRecordSize: INTEGER OPTIONAL
|
||||||
|
if (maxRecordSize != null) {
|
||||||
if (s_maxRecordSize != null) {
|
fields[x++] = maxRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 206);
|
||||||
fields[x++] = s_maxRecordSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 206);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_maxSegmentSize: INTEGER OPTIONAL
|
// Encoding s_maxSegmentSize: INTEGER OPTIONAL
|
||||||
|
if (maxSegmentSize != null) {
|
||||||
if (s_maxSegmentSize != null) {
|
fields[x++] = maxSegmentSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 207);
|
||||||
fields[x++] = s_maxSegmentSize.berEncode(BEREncoding.CONTEXT_SPECIFIC_TAG, 207);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
// Encoding s_otherInfo: OtherInformation OPTIONAL
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
fields[x] = otherInfo.berEncode();
|
||||||
fields[x] = s_otherInfo.berEncode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BERConstructed(tagType, tag, fields);
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the PresentRequest.
|
* of the PresentRequest.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String
|
public String toString() {
|
||||||
toString() {
|
|
||||||
int p;
|
int p;
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
int outputted = 0;
|
int outputted = 0;
|
||||||
|
if (referenceId != null) {
|
||||||
if (s_referenceId != null) {
|
|
||||||
str.append("referenceId ");
|
str.append("referenceId ");
|
||||||
str.append(s_referenceId);
|
str.append(referenceId);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("resultSetId ");
|
str.append("resultSetId ");
|
||||||
str.append(s_resultSetId);
|
str.append(resultSetId);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("resultSetStartPoint ");
|
str.append("resultSetStartPoint ");
|
||||||
str.append(s_resultSetStartPoint);
|
str.append(resultSetStartPoint);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("numberOfRecordsRequested ");
|
str.append("numberOfRecordsRequested ");
|
||||||
str.append(s_numberOfRecordsRequested);
|
str.append(numberOfRecordsRequested);
|
||||||
outputted++;
|
outputted++;
|
||||||
|
if (additionalRanges != null) {
|
||||||
if (s_additionalRanges != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("additionalRanges ");
|
str.append("additionalRanges ");
|
||||||
str.append("{");
|
str.append("{");
|
||||||
for (p = 0; p < s_additionalRanges.length; p++) {
|
for (p = 0; p < additionalRanges.length; p++) {
|
||||||
if (p != 0) {
|
if (p != 0) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append(s_additionalRanges[p]);
|
str.append(additionalRanges[p]);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (recordComposition != null) {
|
||||||
if (s_recordComposition != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("recordComposition ");
|
str.append("recordComposition ");
|
||||||
str.append(s_recordComposition);
|
str.append(recordComposition);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (preferredRecordSyntax != null) {
|
||||||
if (s_preferredRecordSyntax != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("preferredRecordSyntax ");
|
str.append("preferredRecordSyntax ");
|
||||||
str.append(s_preferredRecordSyntax);
|
str.append(preferredRecordSyntax);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (maxSegmentCount != null) {
|
||||||
if (s_maxSegmentCount != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("maxSegmentCount ");
|
str.append("maxSegmentCount ");
|
||||||
str.append(s_maxSegmentCount);
|
str.append(maxSegmentCount);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (maxRecordSize != null) {
|
||||||
if (s_maxRecordSize != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("maxRecordSize ");
|
str.append("maxRecordSize ");
|
||||||
str.append(s_maxRecordSize);
|
str.append(maxRecordSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (maxSegmentSize != null) {
|
||||||
if (s_maxSegmentSize != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("maxSegmentSize ");
|
str.append("maxSegmentSize ");
|
||||||
str.append(s_maxSegmentSize);
|
str.append(maxSegmentSize);
|
||||||
outputted++;
|
outputted++;
|
||||||
}
|
}
|
||||||
|
if (otherInfo != null) {
|
||||||
if (s_otherInfo != null) {
|
|
||||||
if (0 < outputted) {
|
if (0 < outputted) {
|
||||||
str.append(", ");
|
str.append(", ");
|
||||||
}
|
}
|
||||||
str.append("otherInfo ");
|
str.append("otherInfo ");
|
||||||
str.append(s_otherInfo);
|
str.append(otherInfo);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
|
@ -19,14 +19,13 @@ import org.xbib.asn1.BEREncoding;
|
||||||
*/
|
*/
|
||||||
public final class PresentRequestRecordComposition extends ASN1Any {
|
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.
|
* Default constructor for a PresentRequest_recordComposition.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public PresentRequestRecordComposition() {
|
public PresentRequestRecordComposition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,29 +51,30 @@ public final class PresentRequestRecordComposition extends ASN1Any {
|
||||||
* @param checkTag if the tag should be checked.
|
* @param checkTag if the tag should be checked.
|
||||||
* @throws ASN1Exception if the BER encoding is bad.
|
* @throws ASN1Exception if the BER encoding is bad.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
public void berDecode(BEREncoding ber, boolean checkTag) throws ASN1Exception {
|
||||||
BERConstructed tagwrapper;
|
BERConstructed tagwrapper;
|
||||||
c_simple = null;
|
simple = null;
|
||||||
c_complex = null;
|
complex = null;
|
||||||
if (ber.tagGet() == 19 &&
|
if (ber.getTag() == 19 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
try {
|
try {
|
||||||
tagwrapper = (BERConstructed) ber;
|
tagwrapper = (BERConstructed) ber;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new ASN1EncodingException("PresentRequest_recordComposition: bad BER form");
|
throw new ASN1EncodingException("bad BER form");
|
||||||
}
|
}
|
||||||
if (tagwrapper.numberComponents() != 1) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (ber.tagGet() == 209 &&
|
if (ber.getTag() == 209 &&
|
||||||
ber.tagTypeGet() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
ber.getTagType() == BEREncoding.CONTEXT_SPECIFIC_TAG) {
|
||||||
c_complex = new CompSpec(ber, false);
|
complex = new CompSpec(ber, false);
|
||||||
return;
|
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.
|
* @return The BER encoding.
|
||||||
* @throws ASN1Exception Invalid or cannot be encoded.
|
* @throws ASN1Exception Invalid or cannot be encoded.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode() throws ASN1Exception {
|
public BEREncoding berEncode() throws ASN1Exception {
|
||||||
BEREncoding chosen = null;
|
BEREncoding chosen = null;
|
||||||
BEREncoding[] enc;
|
BEREncoding[] enc;
|
||||||
if (c_simple != null) {
|
if (simple != null) {
|
||||||
enc = new BEREncoding[1];
|
enc = new BEREncoding[1];
|
||||||
enc[0] = c_simple.berEncode();
|
enc[0] = simple.berEncode();
|
||||||
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 19, enc);
|
chosen = new BERConstructed(BEREncoding.CONTEXT_SPECIFIC_TAG, 19, enc);
|
||||||
}
|
}
|
||||||
if (c_complex != null) {
|
if (complex != null) {
|
||||||
if (chosen != null) {
|
if (chosen != null) {
|
||||||
throw new ASN1Exception("CHOICE multiply set");
|
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) {
|
if (chosen == null) {
|
||||||
throw new ASN1Exception("CHOICE not set");
|
throw new ASN1Exception("CHOICE not set");
|
||||||
|
@ -103,28 +104,30 @@ public final class PresentRequestRecordComposition extends ASN1Any {
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BEREncoding berEncode(int tagType, int tag) throws ASN1Exception {
|
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
|
* Returns a new String object containing a text representing
|
||||||
* of the PresentRequest_recordComposition.
|
* of the PresentRequest_recordComposition.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder str = new StringBuilder("{");
|
StringBuilder str = new StringBuilder("{");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (c_simple != null) {
|
if (simple != null) {
|
||||||
found = true;
|
found = true;
|
||||||
str.append("simple ");
|
str.append("simple ");
|
||||||
str.append(c_simple);
|
str.append(simple);
|
||||||
}
|
}
|
||||||
if (c_complex != null) {
|
if (complex != null) {
|
||||||
if (found) {
|
if (found) {
|
||||||
str.append("<ERROR: multiple CHOICE: complex> ");
|
str.append("<ERROR: multiple CHOICE: complex> ");
|
||||||
}
|
}
|
||||||
str.append("complex ");
|
str.append("complex ");
|
||||||
str.append(c_complex);
|
str.append(complex);
|
||||||
}
|
}
|
||||||
str.append("}");
|
str.append("}");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue